ModelingToolkit.jl
ModelingToolkit.jl copied to clipboard
PresetTimeCallback with symbolic times and function of times
It would be nice if MTK also offered PresetTimeCallback, such that we do not need to add tstops to the solve manually.
Towards that end, my most common events are discrete events where the event times are given by parameters. It would be nice to have tstops automatically calculated and setup from them instead of having to remember to pass them separately.
That is a very reasonable ask. Definitely should get implemented. Should probably wait for the overhaul of the symbolic event interface in v10 for ImplicitDiscreteSystem https://github.com/SciML/ModelingToolkit.jl/pull/3452 and be implemented in that form, but yes we should definitely add that.
@ChrisRackauckas, if there is someone that knows the new event system that would have time to look at it can we tag this as something to have ready for v10?
It's not breaking to add it, so I don't see why v10 would be delayed for it.
@AayushSabharwal I assume this would be quick, just different condition matching the setup in https://github.com/SciML/DiffEqCallbacks.jl/blob/master/src/preset_time.jl but with the symbolic-defined affect!.
Actually this is already done https://docs.sciml.ai/ModelingToolkit/stable/basics/Events/#Periodic-and-preset-time-events
But that does not support symbolic parameters as the event time, or requires one to use a more general symbolic discrete callback and have to then manually pass the tstop value to solve.
I see, you want parameters in time. We can make that work, but that wasn't mentioned 😅
Yeah a way to just give a list of symbolic parameters representing preset times or representing periodic times, along with the symbolic affects, and then just have everything work via the values given in the parameter map. So avoiding any need to pass a tstop or hardcode a numerical value in the symbolic callback.
Yup that's a reasonable ask.