Closed AnHeuermann closed 1 week ago
After discussing with @lochel we want to have some sort of flag that can flip between the old and some new approach on event detection. It could be that some use-cases for FMU simulation want's to do the event iteration only after the given step and not at the event location.
I would suggest to use a bisection method for root finding: It is easy to implement, very reliable and has a descent convergence rate (but isn't spectacular fast).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Description
Looking at some FMUs from the FMI Cross Check there are a lot of examples where events are not hit sufficiently precise. If I remember it correctly OMSimulator does an event iteration directly after a step triggered an state event indicator (zero crossing) to change. Time events should be fine.
For state events the event handling must be improved. In OpenModelica there is a bisection method implemented to find the time point. This would be an option if we only have some discrete values (e.g.
-1
and+1
like in OpenModelcia FMUs) for the zero crossing function available.If the FMUs has continuous values for the zero crossing functions we can do something that will converge faster to the root, e.g. regula falsi or some Newton method. At least if the FMU supports
canGetAndSetFMUstate
this should be possible.Steps to reproduce the behavior
Run e.g. the FMI Cross Check in
fmus/2.0/me/win64/Dymola/2019FD01/ControlledTemperature/ControlledTemperature.fmu
.To simulate FMU
ControlledTemperature.fmu
with OMSimulator runLua file:
Expected behavior
Find state events with a given precision by some root finding algorithm.
Screenshots
In blue: Reference result In red: Result by OMSimulator
Version and OS