-
-
Notifications
You must be signed in to change notification settings - Fork 232
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Very possibly having to do with the new MTKv10 update and Catalyst not following the new way to do things correctly. I tried to adapt Catalyst to handle jump here: SciML/Catalyst.jl#1322
However, when I try this:
the event does not trigger (reseting the parameters) anymore, and I am not sure why.
using Catalyst, OrdinaryDiffEqTsit5, Test
begin
# Creates model (a production/degradation system, but both reactions stop at `t=2.5`).
t = default_t()
@parameters α=5.0 β=1.0
@species V(t)=0.0
rxs = [
Reaction(α, nothing, [V]),
Reaction(β, [V], nothing)
]
continuous_events = [V ~ 2.5] => [α ~ 0, β ~ 0]
@named rs = ReactionSystem(rxs, t; continuous_events)
@test length(ModelingToolkit.continuous_events(rs)) == 1
@test length(ModelingToolkit.discrete_events(rs)) == 0
# Tests in simulation.
osys = complete(make_rre_ode(complete(rs)))
@test length(ModelingToolkit.continuous_events(osys)) == 1
@test length(ModelingToolkit.discrete_events(osys)) == 0
oprob = ODEProblem(osys, [], (0.0, 20.0))
sol = solve(oprob, Tsit5())
@test sol(20.0, idxs = V) ≈ 2.5 # The event should trigger at V = 2.5, stopping further change to the system. However, this is not the case.
end
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working