Skip to content
Snippets Groups Projects
Commit e3490adf authored by Tim Übelhör's avatar Tim Übelhör
Browse files

Fixed the nasty wrong values bug after stopping the simulation.

parent 0bc054d2
Branches
Tags v0.1.1
No related merge requests found
......@@ -100,10 +100,6 @@ namespace ModeliChart.LocalMode
private void FmuInstance_Log(string instanceName, FmiWrapper_Net.Fmi2Status status, string category, string message)
{
if(status == FmiWrapper_Net.Fmi2Status.fmi2OK)
{
return;
}
if (!message.EndsWith("The solver will continue anyway.") && !message.StartsWith("fmiDoStep: currentCommunicationPoint"))
{
ConsoleLogger.WriteLine(Name, "Fmu: " + instanceName
......
......
......@@ -140,6 +140,11 @@ namespace ModeliChart.LocalMode
public async Task Stop()
{
await Pause().ConfigureAwait(false);
// Wait for the simulation to finish before resetting the fmus.
// Otherwise the state gets corrupted.
// Waiting instide the taskQueue causes a deadlock if the
// Simulation task is not finished.
await simulationTask.ConfigureAwait(false);
// Reset the data
Interlocked.Exchange(ref currentTime, 0);
await taskQueue.Add(() =>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment