Solver fixes
These changes are cherry picked from the branch "work", which includes changes originally made to the master branch in October 2024. I hadn't had the time earlier to rebase my code on the major refactoring done to SystemSC.cpp on 19.11.2024 (6d7a397).
Note:
- This request is based on the maintenance/v2.1 branch, on which I have been working on.
- This request includes the changes introduced by #1522 and can be directly merged after it.
Related Issues
- #1326
- #1515
- #1516
Purpose
This change request fixes some issues in simulation of strongly coupled systems. Some calls to FMUs are currently in the wrong order, so that fmi2_completedIntegratorStep() is called before all the inputs have been set to reflect the current state variable values and the time is updated for all components.
This request also adds support for
- Performing events requested by
fmi2_completedIntegratorStep()in CVODE.- Only adds a TODO comment to
doStepEuler().
- Only adds a TODO comment to
- Skipping CVODE solver resets for events in which state derivatives are unchanged.
This change enables use of some models from PLECS in a model exchange system.
Approach
Calls to updateInputs() are moved to a time before the call to fmi2_completedIntegratorStep().
Includes some elimination of unnecessary FMI calls for models with no states or event indicators.