-
-
Couldn't load subscription status.
- Fork 233
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I am not fully sure if this should work, but saw some stuff in the code that sugegsts that it should.
MWE. The two p terms should become 0 at time 1.0, causing decay of X and Y, this does not happen.
using ModelingToolkit, OrdinaryDiffEqDefault, Plots
using ModelingToolkit: t_nounits as t, D_nounits as D
import ModelingToolkit: SymbolicDiscreteCallback
# Creates a standard MTK system.
@parameters p(t)[1:2] d
@variables X(t) Y(t)
eqs = [
D(X) ~ p[1] - d*X,
D(Y) ~ p[2] - d*Y
]
devent = SymbolicDiscreteCallback([1.0] => [p ~ [0.0, 0.0]]; discrete_parameters = [p])
@mtkbuild sys = ODESystem(eqs, t; discrete_events = devent)
sim_cond = [X => 1.0, Y => 2.0, p => [1.0, 2.0], d => 1.0]
oprob = ODEProblem(sys, sim_cond, 2.0)
plot(solve(oprob))
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working