Skip to content

Commit 4733044

Browse files
vyuduAayushSabharwal
authored andcommitted
fix: fix jumpsystem test
1 parent 11b7a56 commit 4733044

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/systems/callbacks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function make_affect(affect::Vector{Equation}; discrete_parameters = Any[],
283283
for eq in affect
284284
if !haspre(eq) && !(symbolic_type(eq.rhs) === NotSymbolic() ||
285285
symbolic_type(eq.lhs) === NotSymbolic())
286-
@warn "Affect equation $eq has no `Pre` operator. As such it will be interpreted as an algebraic equation to be satisfied after the callback. If you intended to use the value of a variable x before the affect, use Pre(x)."
286+
@warn "Affect equation $eq has no `Pre` operator. As such it will be interpreted as an algebraic equation to be satisfied after the callback. If you intended to use the value of a variable x before the affect, use Pre(x). Errors may be thrown if there is no `Pre` and algebraic equations are unsatisfiable, such as X ~ X + 1."
287287
end
288288
collect_vars!(dvs, params, eq, iv; op = Pre)
289289
diffvs = collect_applied_operators(eq, Differential)

test/jumpsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ end
556556
@parameters a b
557557
eq = D(X) ~ a
558558
rate = b * X
559-
affect = [X ~ X - 1]
559+
affect = [X ~ Pre(X) - 1]
560560
crj = ConstantRateJump(rate, affect)
561561
@named jsys = JumpSystem([crj, eq], t, [X], [a, b])
562562
jsys = complete(jsys)

test/symbolic_events.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ end
638638
sol = solve(prob, Tsit5(), saveat = 0.1)
639639

640640
@test typeof(oneosc_ce_simpl) == ODESystem
641-
@test sol[1, 6] < 1.0 # test whether x(t) decreases over time
642-
@test sol[1, 18] > 0.5 # test whether event happened
641+
@test sol(0.5, idxs = oscce.x) < 1.0 # test whether x(t) decreases over time
642+
@test sol(1.5, idxs = oscce.x) > 0.5 # test whether event happened
643643
end
644644

645645
@testset "Additional SymbolicContinuousCallback options" begin

0 commit comments

Comments
 (0)