modelica / Reference-FMUs

Functional Mock-up Units for development, testing and debugging
Other
153 stars 61 forks source link

Wrong behaviour before first doStep #593

Closed MarcoFilimonE closed 2 months ago

MarcoFilimonE commented 2 months ago

FMI version: 3.0 fmusim version: 0.0.34

I have a FMU with one input and one output. The problem observed is that before the first doStep, I was expecting to see only one command for getting the output and one for setting the input (this is at least what I saw with the previous versions of fmusim), but as we can see in the below screenshot, 2 extra GET commands are being called. Is this the expected behaviour?

image

fmusim version 0.0.32 behaviour for the same FMU image

FMU + input.csv: SimpleExample.zip input.csv

Simply run the FMU with --input-file input.csv to observe the problem.

t-sommer commented 2 months ago

It's sampling the initial values. What's exactly wrong with the call sequence?

MarcoFilimonE commented 2 months ago

Isn't fmi3GetX meant only outputs? Or that's how it was until version 0.0.34. We can see in the first screenshot that the GET command is being called for the simulation starting point, and then for both input AND output. Only the 3rd GET is solely the output, followed by a SET for the input. image

If this is the intended behaviour, then you can close this issue. I only opened it because this is not what I saw in the previous versions of FMUSIM

t-sommer commented 2 months ago

The reason for getting all variables after initialization is to have them available for plotting in the FMUSIM GUI, so we don't have to get variables that don't change during simulation in every step. For the command line version we could skip this step. Please open a new issue if this is a requirement for you.