Skip to content

Simulation is not terminated when terminateSimulation = true #482

@PTaeuberDS

Description

@PTaeuberDS

In the Stair FMU, in each event update a counter that is initialized with 1 is increased by 1. The events occur each full second beginning at t=1.0.
When the counter is >= 10, the terminateSimulation "return value" of fmi3UpdateDiscreteStates is set to true. This is the case at t=9.0. However, fmusim does not terminate the simulation but calculates until t=10.0, because this is the pre-defined stopTime in the FMU.

fmusim command:

fmusim.exe --interface-type cs --output-file Stair.csv --event-mode-used Stair.fmu

If event mode is not used, the simulation also does not terminate correctly, but this is also a problem with the FMU, because terminateSimulation is set to false and never updated in the fmi3DoStep function. terminateSimulation should be set in the fmi3DoStep function in the same way it is set in the fmi3UpdateDiscreteStates function:
if (terminateSimulation) *terminateSimulation = S->terminateSimulation;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfmusim

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions