Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

kyllingstad
Copy link
Member

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 kyllingstad added the bug Something isn't working label Mar 1, 2024
@kyllingstad kyllingstad requested a review from eidekrist March 1, 2024 08:30
@kyllingstad kyllingstad self-assigned this Mar 1, 2024
Base automatically changed from feature/conan-2 to master March 4, 2024 07:23
@kyllingstad kyllingstad force-pushed the bugfix/110-init-after-init branch from 71e2a9c to 3ef7af7 Compare March 4, 2024 07:26
Copy link
Member

@eidekrist eidekrist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the issue this PR fixes has been closed (user error/can't reproduce), I still feel it is nice to use the same calling order which would result from calling cosim run with an OspSystemStructure.xml.
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.

@kyllingstad kyllingstad merged commit 5dd7c93 into master Mar 4, 2024
8 checks passed
@kyllingstad kyllingstad deleted the bugfix/110-init-after-init branch March 4, 2024 14:57
@kyllingstad
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run-single initializes FMU before setting initial values
2 participants