@@ -9,7 +9,7 @@ or into more specialized callback types from the
99[ DiffEqCallbacks.jl] ( https://docs.sciml.ai/DiffEqDocs/stable/features/callback_library/ ) 
1010library.
1111
12- [ ` ODESystem ` ] ( @ref ) s and [ ` SDESystem ` ] ( @ref ) s accept keyword arguments
12+ [ ` System ` ] ( @ref ) s and [ ` SDESystem ` ] ( @ref ) s accept keyword arguments
1313` continuous_events `  and ` discrete_events `  to symbolically encode continuous or
1414discrete callbacks. [ ` JumpSystem ` ] ( @ref ) s currently support only
1515` discrete_events ` . Continuous events are applied when a given condition becomes
@@ -59,7 +59,7 @@ For example, consider the following system.
5959``` julia 
6060@variables  x (t) y (t)
6161@parameters  p (t)
62- @mtkcompile  sys =  ODESystem ([x *  y ~  p, D (x) ~  0 ], t)
62+ @mtkcompile  sys =  System ([x *  y ~  p, D (x) ~  0 ], t)
6363event =  [t ==  1 ] =>  [x ~  Pre (x) +  1 ]
6464``` 
6565
@@ -132,7 +132,7 @@ function UnitMassWithFriction(k; name)
132132    @variables x(t)=0 v(t)=0 
133133    eqs = [D(x) ~ v 
134134           D(v) ~ sin(t) - k * sign(v)] 
135-     ODESystem (eqs, t; continuous_events = [v ~ 0], name) # when v = 0 there is a discontinuity 
135+     System (eqs, t; continuous_events = [v ~ 0], name) # when v = 0 there is a discontinuity 
136136end 
137137@mtkcompile m = UnitMassWithFriction(0.7) 
138138prob = ODEProblem(m, Pair[], (0, 10pi)) 
@@ -154,7 +154,7 @@ like this
154154root_eqs = [x ~ 0]  # the event happens at the ground x(t) = 0 
155155affect = [v ~ -Pre(v)] # the effect is that the velocity changes sign 
156156
157- @mtkcompile ball = ODESystem ( 
157+ @mtkcompile ball = System ( 
158158    [D(x) ~ v 
159159     D(v) ~ -9.8], t; continuous_events = root_eqs => affect) # equation => affect 
160160
@@ -175,7 +175,7 @@ Multiple events? No problem! This example models a bouncing ball in 2D that is e
175175continuous_events = [[x ~ 0] => [vx ~ -Pre(vx)] 
176176                     [y ~ -1.5, y ~ 1.5] => [vy ~ -Pre(vy)]] 
177177
178- @mtkcompile ball = ODESystem ( 
178+ @mtkcompile ball = System ( 
179179    [ 
180180        D(x) ~ vx, 
181181        D(y) ~ vy, 
255255
256256reflect = [x ~ 0] => (bb_affect!, [v], [], [], nothing) 
257257
258- @mtkcompile bb_sys = ODESystem (bb_eqs, t, sts, par, 
258+ @mtkcompile bb_sys = System (bb_eqs, t, sts, par, 
259259    continuous_events = reflect) 
260260
261261u0 = [v => 0.0, x => 1.0] 
@@ -300,7 +300,7 @@ injection = (t == tinject) => [N ~ Pre(N) + M]
300300u0 = [N => 0.0] 
301301tspan = (0.0, 20.0) 
302302p = [α => 100.0, tinject => 10.0, M => 50] 
303- @mtkcompile osys = ODESystem (eqs, t, [N], [α, M, tinject]; discrete_events = injection) 
303+ @mtkcompile osys = System (eqs, t, [N], [α, M, tinject]; discrete_events = injection) 
304304oprob = ODEProblem(osys, u0, tspan, p) 
305305sol = solve(oprob, Tsit5(); tstops = 10.0) 
306306plot(sol) 
319319``` @example  events
320320injection = ((t == tinject) & (N < 50)) => [N ~ Pre(N) + M] 
321321
322- @mtkcompile osys = ODESystem (eqs, t, [N], [M, tinject, α]; discrete_events = injection) 
322+ @mtkcompile osys = System (eqs, t, [N], [M, tinject, α]; discrete_events = injection) 
323323oprob = ODEProblem(osys, u0, tspan, p) 
324324sol = solve(oprob, Tsit5(); tstops = 10.0) 
325325plot(sol) 
@@ -346,7 +346,7 @@ killing = ModelingToolkit.SymbolicDiscreteCallback(
346346
347347tspan = (0.0, 30.0) 
348348p = [α => 100.0, tinject => 10.0, M => 50, tkill => 20.0] 
349- @mtkcompile osys = ODESystem (eqs, t, [N], [α, M, tinject, tkill]; 
349+ @mtkcompile osys = System (eqs, t, [N], [α, M, tinject, tkill]; 
350350    discrete_events = [injection, killing]) 
351351oprob = ODEProblem(osys, u0, tspan, p) 
352352sol = solve(oprob, Tsit5(); tstops = [10.0, 20.0]) 
@@ -375,7 +375,7 @@ killing = ModelingToolkit.SymbolicDiscreteCallback(
375375    [20.0] => [α ~ 0.0], discrete_parameters = α, iv = t) 
376376
377377p = [α => 100.0, M => 50] 
378- @mtkcompile osys = ODESystem (eqs, t, [N], [α, M]; 
378+ @mtkcompile osys = System (eqs, t, [N], [α, M]; 
379379    discrete_events = [injection, killing]) 
380380oprob = ODEProblem(osys, u0, tspan, p) 
381381sol = solve(oprob, Tsit5()) 
@@ -415,7 +415,7 @@ example:
415415
416416ev = ModelingToolkit.SymbolicDiscreteCallback( 
417417    1.0 => [c ~ Pre(c) + 1], discrete_parameters = c, iv = t) 
418- @mtkcompile sys = ODESystem ( 
418+ @mtkcompile sys = System ( 
419419    D(x) ~ c * cos(x), t, [x], [c]; discrete_events = [ev]) 
420420
421421prob = ODEProblem(sys, [x => 0.0], (0.0, 2pi), [c => 1.0]) 
@@ -436,7 +436,7 @@ will be saved. If we repeat the above example with `c` not a `discrete_parameter
436436@variables x(t) 
437437@parameters c(t) 
438438
439- @mtkcompile sys = ODESystem ( 
439+ @mtkcompile sys = System ( 
440440    D(x) ~ c * cos(x), t, [x], [c]; discrete_events = [1.0 => [c ~ Pre(c) + 1]]) 
441441
442442prob = ODEProblem(sys, [x => 0.0], (0.0, 2pi), [c => 1.0]) 
@@ -537,7 +537,7 @@ will write `furnace_on = false` back to the system, and when `temp = furnace_on_
537537to the system.
538538
539539``` @example  events
540- @named sys = ODESystem ( 
540+ @named sys = System ( 
541541    eqs, t, [temp], params; continuous_events = [furnace_disable, furnace_enable]) 
542542ss = mtkcompile(sys) 
543543prob = ODEProblem(ss, [temp => 0.0, furnace_on => true], (0.0, 10.0)) 
@@ -650,7 +650,7 @@ affect activation point, with -1 mapped to 0.
650650We can now simulate the encoder.
651651
652652``` @example  events
653- @named sys = ODESystem ( 
653+ @named sys = System ( 
654654    eqs, t, [theta, omega], params; continuous_events = [qAevt, qBevt]) 
655655ss = mtkcompile(sys) 
656656prob = ODEProblem(ss, [theta => 0.0], (0.0, pi)) 
0 commit comments