Open casella opened 1 year ago
One easy step to improve the accuracy of event processing, in lieu of implementing a more accurate zero-crossing solver, at least when using CVODE, would be to check for events after each integrator step instead of the precision provided by the maximum time step size, as is currently done by oms::SystemSC::doStep
I will push an implementation for this to my fork shortly.
Please make a PR out of it so we can run it on our testsuite and see what happens
Currently, OMSimulator only checks for event-triggering conditions (e.g. zero-crossing functions changing their sign) at each time step, but doesn't try to figure out the exact time when the zero-crossing function changed sign. This results in delays of up to one time step in the triggering of events.
In many cases this is no big deal, but in some cases this may seriously change or disrupt the simulation results.
We should eventually implement a proper state event detection mechanism in OMSimulator.