eventTotalDerivative

Method of continuousTimeMdss.

Resolve the mode switch and consistent slopes of a hybrid implicit multilinear IVP at an event.

Source: src/simulator/@continuousTimeMdss/eventTotalDerivative.m

What is computed

At a single time t0t_0, produce a consistent post-event point of a hybrid mdss model: the state derivative ẋ1\dot x_1, algebraic signals y1y_1, binaries z1z_1, algebraic slopes ẏ1\dot y_1, and the equality / inequality function values FF, GG.

Input value and slope

u0=u(t0),u̇=u0u(tnear)t0tnear u_0 = u(t_0),\qquad \dot u = \frac{u_0 - u(t_{\mathrm{near}})}{t_0 - t_{\mathrm{near}}}

(finite difference against the nearest input sample tneart_{\mathrm{near}}).

Mode solve

The solving order is walked building the norm-1 monomial vector mm. Subproblems before the event are solved with the binaries fixed (solveSubProblemFixZ); explicit continuous variables use the affine closed form v=B/Av = -B/A (see solveStepBruteForce). When an event index ie is given, the binaries of the event’s subproblem are enumerated over all 2nz2^{n_z} combinations, ordered by descending Hamming distance to the previous zz (largest mode change first), and each is propagated through the following subproblems.

Consistent slopes (implicit function theorem)

From the equality Jacobian JFJ_F, the state second derivative and algebraic slope follow from differentiating F(ẋ,x,u,y)=0F(\dot x,x,u,y)=0 along the trajectory:

[ẍẏ]=JF,[ẋ,y]1JF,[x,u][ẋu̇]. \begin{bmatrix}\ddot x\\[2pt] \dot y\end{bmatrix} = -\,J_{F,[\dot x,\,y]}^{-1}\,J_{F,[x,\,u]} \begin{bmatrix}\dot x\\[2pt] \dot u\end{bmatrix}.

Acceptance test

A candidate mode is accepted only if it is feasible and every active inequality is being crossed inward — its total time derivative is non-increasing:

Gtol,Ġj=JGj[ẍ;ẋ;ẏ;u̇]0for active j. G \le \text{tol},\qquad \dot G_j = J_{G_j}\,[\,\ddot x;\ \dot x;\ \dot y;\ \dot u\,] \le 0 \quad\text{for active } j .

A binary belonging to the enumerated set keeps its enumerated value rather than being re-derived from sign(F0)\operatorname{sign}(F_0) — that re-derivation is degenerate at a coincident crossing (its switching surface sits at G0G\approx 0) and would otherwise pin the bit to its previous value. If no candidate passes both tests, the outputs are returned as NaN.

Input arguments

Argument Description
sys The continuousTimeMdss simulation object (carries the mdss model).
ie Triggering inequality (event) index; empty for a pure consistent-slope solve.
t0 Event time.
x0 Current state values.
y0 Current algebraic-signal values.
z0 Current binary-signal values.
u Input trajectory, one row per input-time sample, one column per input.
ut Time samples of the input trajectory.
solvingOrder The block solving order [varIdx, eqIdx, type, subset, subproblem].
opt Solver options.

Output arguments

Output Description
xp1 Post-event state derivative ẋ1\dot x_1.
y1 Post-event algebraic signals.
z1 Post-event binary signals.
dy1 Post-event algebraic slopes ẏ1\dot y_1.
F Equality function values.
G Inequality function values.

See also

continuousTimeMdss · continuousSimTotalDerivative · solveSubProblemFixZ · jacobian · msim


MyToolbox Documentation | Generated automatically by CI/CD pipeline