Here you can find the source of isSteadyStateReached(Path integrationStepFile, double minStepAtEndOfStabilization)
public static boolean isSteadyStateReached(Path integrationStepFile, double minStepAtEndOfStabilization) throws IOException
//package com.java2s; /**/* w w w.j a va 2 s. c o m*/ * Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium) * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.stream.Stream; public class Main { public static boolean isSteadyStateReached(Path integrationStepFile, double minStepAtEndOfStabilization) throws IOException { if (Files.exists(integrationStepFile)) { try (Stream<String> stream = Files.lines(integrationStepFile)) { double[] values = stream.mapToDouble(Double::parseDouble).toArray(); if (values.length <= 1) { return false; } else { // check that next to last integration step was > minStepAtEndOfStabilization s // last has to be avoid because can be truncated because of the end of simulation return values[values.length - 2] >= minStepAtEndOfStabilization; } } } else { return false; } } }