644
644
dprob = DiscreteProblem (jsys, u0, tspan, p)
645
645
jprob = JumpProblem (jsys, dprob, Direct (); kwargs... )
646
646
sol = solve (jprob, SSAStepper (); tstops = tstops)
647
- @show sol
648
647
@test (sol (1.000000000001 )[1 ] - sol (0.99999999999 )[1 ]) == 1
649
648
paramtotest === nothing || (@test sol. ps[paramtotest] == 1.0 )
650
649
@test sol (40.0 )[1 ] == 0
@@ -1153,7 +1152,7 @@ end
1153
1152
f = ModelingToolkit. FunctionalAffect (
1154
1153
f = (i, u, p, c) -> seen = true , sts = [], pars = [], discretes = [])
1155
1154
cb1 = ModelingToolkit. SymbolicContinuousCallback (
1156
- [x ~ 0 ], Equation[] , initialize = [x ~ 1.5 ], finalize = f)
1155
+ [x ~ 0 ], nothing , initialize = [x ~ 1.5 ], finalize = f)
1157
1156
@mtkbuild sys = ODESystem (D (x) ~ - 1 , t, [x], []; continuous_events = [cb1])
1158
1157
prob = ODEProblem (sys, [x => 1.0 ], (0.0 , 2 ), [])
1159
1158
sol = solve (prob, Tsit5 (); dtmax = 0.01 )
@@ -1166,15 +1165,15 @@ end
1166
1165
f = ModelingToolkit. FunctionalAffect (
1167
1166
f = (i, u, p, c) -> seen = true , sts = [], pars = [], discretes = [])
1168
1167
cb1 = ModelingToolkit. SymbolicContinuousCallback (
1169
- [x ~ 0 ], Equation[] , initialize = [x ~ 1.5 ], finalize = f)
1168
+ [x ~ 0 ], nothing , initialize = [x ~ 1.5 ], finalize = f)
1170
1169
inited = false
1171
1170
finaled = false
1172
1171
a = ModelingToolkit. FunctionalAffect (
1173
1172
f = (i, u, p, c) -> inited = true , sts = [], pars = [], discretes = [])
1174
1173
b = ModelingToolkit. FunctionalAffect (
1175
1174
f = (i, u, p, c) -> finaled = true , sts = [], pars = [], discretes = [])
1176
1175
cb2 = ModelingToolkit. SymbolicContinuousCallback (
1177
- [x ~ 0.1 ], Equation[] , initialize = a, finalize = b)
1176
+ [x ~ 0.1 ], nothing , initialize = a, finalize = b)
1178
1177
@mtkbuild sys = ODESystem (D (x) ~ - 1 , t, [x], []; continuous_events = [cb1, cb2])
1179
1178
prob = ODEProblem (sys, [x => 1.0 ], (0.0 , 2 ), [])
1180
1179
sol = solve (prob, Tsit5 ())
@@ -1238,7 +1237,7 @@ end
1238
1237
@variables x (t) [irreducible = true ] y (t) [irreducible = true ]
1239
1238
eqs = [x ~ y, D (x) ~ - 1 ]
1240
1239
cb = [x ~ 0.0 ] => [x ~ 0 , y ~ 1 ]
1241
- @test_throws ErrorException @mtkbuild pend = ODESystem (eqs, t; continuous_events = [cb])
1240
+ @test_throws Exception @mtkbuild pend = ODESystem (eqs, t; continuous_events = [cb])
1242
1241
1243
1242
cb = [x ~ 0.0 ] => [y ~ 1 ]
1244
1243
@mtkbuild pend = ODESystem (eqs, t; continuous_events = [cb])
0 commit comments