-
Notifications
You must be signed in to change notification settings - Fork 58
Solver fixes #1524
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
base: maintenance/v2.1
Are you sure you want to change the base?
Solver fixes #1524
Conversation
|
I will make a force push on this branch, which rebases it to #1522 and adds some new commits. |
|
|
||
| fmus[i]->doEventIteration(); | ||
|
|
||
| fmistatus = fmi2_enterContinuousTimeMode(fmus[i]->getFMU()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation: This cannot happen before the updateInputs(eventGraph) below, as setting discrete inputs is forbidden in the continuous time mode.
| // set time | ||
| for (const auto& component : getComponents()) | ||
| component.second->setTime(time); | ||
| component.second->setTime(event_time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops.
| } | ||
|
|
||
| // Update all inputs, including non-continuous ones | ||
| updateInputs(eventGraph); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are not in continuous time mode.
|
I was wondering why I don't get a test failure for ./simulation/EventTest.lua on my local set-up. I hadn't even realized that its's not even configured to run in an ucrt64 Windows build: I seem to have messed up something in the CVODE event handling. I need to look into it. |
This says on which platform the tests can run on, so in case of failures you can copy the expected output from jenkins , if you feel the expected output is correct |
refs OpenModelica#1330 It seems that simply calling CVode with mode CV_NORMAL does not work correctly to return at the given stopping time, if the previous call stopped due to a root.
- Some errors made in commit 4c3fe79. - All discrete inputs should be updated before going back to continous time mode in any FMU. refs OpenModelica#1326
Even though the inputs values shouldn't change in continuous time mode, calling setters for such inputs is against the FMI standard and may result in error responses from FMUs. refs OpenModelica#1326
- Termination requests from completedIntegratorStep were not handled. - Unnecessary change to System::time in event-related termination with CVODE. refs OpenModelica#1515
refs OpenModelica#1516 It is necessary to reset the solver when the state variable values change.
|
Rebased branch to current state of #1522 |
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:
Related Issues
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
fmi2_completedIntegratorStep()in CVODE.doStepEuler().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 tofmi2_completedIntegratorStep().Includes some elimination of unnecessary FMI calls for models with no states or event indicators.