-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Here I create a continuous callback that should add 20 units of X whenever X hits the threshold at 50.0. Practically, the about of X added seems a bit random, and typically less that 20.0.
using ModelingToolkit
@variables t X(t)
@parameters p d
D = Differential(t)
eqs = [D(X) ~ p - d*X]
noiseeqs = [0.1*X]
continuous_events =[[X ~ 50.0] => [X ~ X + 20.0]]
@named ssys = SDESystem(eqs, noiseeqs, t, [X], [p, d]; continuous_events)
ssys = complete(ssys) # because @mtkbuild/structural_simplify are broken for SDE systems.
u0 = [X => 55.0]
tspan = (0.0, 100.0)
ps = [p => 10.0, d => 0.2]
oprob = SDEProblem(ssys, u0, tspan, ps)
sol = solve(oprob, ImplicitEM())
plot(sol)Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
