ModelingToolkit.jl
ModelingToolkit.jl copied to clipboard
Event trigger directionality
I am trying to introduce directionality in an event trigger (i.e. only fire as either up or downpass). IIUC this correctly it should be possible in principle with affect_neg!=nothing
in the ContinuousVectorCallback .
But in MTK, I am using a Pair{Vector{Equation}, Vector{Equation}}[]
that is passed to continuous_events
in the ODESystem constructor. Is there a good way to introduce directionality in a trigger using the ODESystem constructor/continuous_events keyword? My current code is here. Perhaps rather than using ~
in the trigger equation <
or >
could be used?
SymbolicContinuousCallback
s could be modified to accept an affect_neg!
function too:
https://github.com/SciML/ModelingToolkit.jl/blob/01186a4b41c0100dfd65f84dd188d0739f238976/src/systems/callbacks.jl#L73
@paulflang I can add that for you, but might not be till later in the week.
@isaacsas : that would be great. But not urgent rn.
I'm trying to finish off getting normal events into SDEs and jump processes first: https://github.com/SciML/ModelingToolkit.jl/pull/1714
Hi, is there any progress or a workaround for this issue yet?
I have the same need for a directional callback. Currently using ifelse
but thinking a directional callback can be more efficient.
We were discussing this more recently in https://github.com/SciML/SBMLToolkit.jl/issues/101. I close it there, let's continue discussing here.