open-simulation-platform / cosim-cli

Command-line interface for libcosim
https://open-simulation-platform.github.io/cosim
Mozilla Public License 2.0
10 stars 4 forks source link

run-single: Call setup() after setting initial variable values #111

Closed kyllingstad closed 6 months ago

kyllingstad commented 6 months ago

Fixes #110.

I don't have Conan 1.x installed locally anymore, so I had to branch off feature/conan-2 for this PR. In other words, #109 should be merged before this one.

kyllingstad commented 6 months ago

I however can't at the moment wrap my head around any potential issues with the change in calling order for FMI 2 FMUs, as the setup() method actually does something here.

It means that the initial values will be set before the FMU instance enters initialisation mode, rather than during it. Doing it during initialisation mode is mainly useful when you want to solve for the initial values in an iterative fashion, which libcosim currently doesn't support. In other words, there are no drawbacks and one advantage: more types of variables can be set pre-initialisation mode.