Open
Description
Wanting to have the time(s) be parametric is probably a rather common thing, wouldn't something like this be good to permit:
using ModelingToolkit, OrdinaryDiffEq, Plots
@variables t X(t)
@parameters p d pT
D = Differential(t)
eqs = [
D(X) ~ p - d*X
]
discrete_events = [
[pT] => [p ~ 2*p]
]
@mtkbuild osys = ODESystem(eqs, t; discrete_events)
u0 = [X => 0.0]
tspan = (0.0, 10.)
ps = [p => 5.0, d => 1.0, pT => 2.0]
oprob = ODEProblem(osys, u0, tspan, ps)
sol = solve(oprob, Tsit5()) # Yields a `ERROR: TypeError: non-boolean (Num) used in boolean context`
?
I realise there might be a problem if the parameters of the even are changed due to e.g. other events. But this feels niche and is a situation we already have for a few things (like jump simulations).