You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/systems/callbacks.jl
+17-15Lines changed: 17 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -94,17 +94,17 @@ A [`ContinuousCallback`](@ref SciMLBase.ContinuousCallback) specified symbolical
94
94
as well as the positive-edge `affect` and negative-edge `affect_neg` that apply when *any* of `eq` are satisfied.
95
95
By default `affect_neg = affect`; to only get rising edges specify `affect_neg = nothing`.
96
96
97
-
Assume without loss of generality that the equation is of the form `c(u,p,t) ~ 0`; we denote the integrator state as `i.u`.
97
+
Assume without loss of generality that the equation is of the form `c(u,p,t) ~ 0`; we denote the integrator state as `i.u`.
98
98
For compactness, we define `prev_sign = sign(c(u[t-1], p[t-1], t-1))` and `cur_sign = sign(c(u[t], p[t], t))`.
99
-
A condition edge will be detected and the callback will be invoked iff `prev_sign * cur_sign <= 0`.
99
+
A condition edge will be detected and the callback will be invoked iff `prev_sign * cur_sign <= 0`.
100
100
The positive edge `affect` will be triggered iff an edge is detected and if `prev_sign < 0`; similarly, `affect_neg` will be
101
-
triggered iff an edge is detected and `prev_sign > 0`.
101
+
triggered iff an edge is detected and `prev_sign > 0`.
102
102
103
-
Inter-sample condition activation is not guaranteed; for example if we use the dirac delta function as `c` to insert a
103
+
Inter-sample condition activation is not guaranteed; for example if we use the dirac delta function as `c` to insert a
104
104
sharp discontinuity between integrator steps (which in this example would not normally be identified by adaptivity) then the condition is not
105
105
guaranteed to be triggered.
106
106
107
-
Once detected the integrator will "wind back" through a root-finding process to identify the point when the condition became active; the method used
107
+
Once detected the integrator will "wind back" through a root-finding process to identify the point when the condition became active; the method used
108
108
is specified by `rootfind` from [`SciMLBase.RootfindOpt`](@ref). If we denote the time when the condition becomes active as `tc`,
109
109
the value in the integrator after windback will be:
110
110
* `u[tc-epsilon], p[tc-epsilon], tc` if `LeftRootFind` is used,
@@ -116,7 +116,7 @@ it passed through 0.
116
116
117
117
Multiple callbacks in the same system with different `rootfind` operations will be grouped
118
118
by their `rootfind` value into separate VectorContinuousCallbacks in the enumeration order of `SciMLBase.RootfindOpt`. This may cause some callbacks to not fire if several become
119
-
active at the same instant. See the `SciMLBase` documentation for more information on the semantic rules.
119
+
active at the same instant. See the `SciMLBase` documentation for more information on the semantic rules.
120
120
121
121
Affects (i.e. `affect` and `affect_neg`) can be specified as either:
122
122
* A list of equations that should be applied when the callback is triggered (e.g. `x ~ 3, y ~ 7`) which must be of the form `unknown ~ observed value` where each `unknown` appears only once. Equations will be applied in the order that they appear in the vector; parameters and state updates will become immediately visible to following equations.
@@ -327,14 +327,15 @@ The `SymbolicContinuousCallback`s in the returned vector are structs with two fi
327
327
`affect` which correspond to the first and second elements of a `Pair` used to define an event, i.e.
0 commit comments