continuousSimTotalDerivative

Method of continuousTimeMdss.

Solve the hybrid continuous-time IVP with event detection and mode switching.

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

What is solved

Integrate the equality differential-algebraic block with the binaries held fixed, and re-solve the binary mode whenever an inequality switching surface is crossed.

Per-segment integration

On each segment the equality block

0=Φeqm(ẋ,x,u(t),y,z),z fixed, 0 = \Phi_{\mathrm{eq}}\, m(\dot x, x, u(t), y, z),\qquad z \text{ fixed},

is integrated with ode15i (fully implicit, solver state [x;y][x;\,y], analytic Jacobian evaluated on a pre-sliced equality sub-tensor). The event function is the inequality function

g(t)=Φineqm(ẋ,x,u(t),y,z), g(t) = \Phi_{\mathrm{ineq}}\, m(\dot x, x, u(t), y, z),

with an ascending, stop-on-event zero crossing.

At an event

The step is re-evaluated with solveStepBruteForce to pick the new binary vector, and eventTotalDerivative produces the consistent restart (ẋ,y,z,ẏ)(\dot x, y, z, \dot y); the updated zz seeds the next segment. The loop guards against the time budget MaxTime, an event with no feasible discrete solution, and Zeno behaviour (an event at the segment start).

Initialization and assembly

The initial consistent slope (ẋ0,ẏ0)(\dot x_0,\dot y_0) and a feasible initial zz come from eventTotalDerivative, retried with a different algebraic guess if the first violates equality feasibility (|Fi||F_i|\le InequalityZeroTolerance) or inequality positivity (GiG_i\le InequalityPositivityTolerance). Segments are concatenated, the binary signal is resampled onto the full time grid, and the results are stored in sim.time, sim.variableTrajectory =[x,y,z]=[x,\,y,\,z] and sim.eventTime.

A one-off pre-compute collapses the three-way structure/parameter split and slices each equation block to the monomial columns it uses, so the ODE right-hand side, event function and Jacobian evaluate only those columns (via MTISIM in pass-through mode).

Input arguments

Argument Description
sim The continuousTimeMdss object, with the model, initial state, input trajectory and solver options set.

Output arguments

Output Description
sim The same object with time, variableTrajectory ([x, y, z]) and eventTime filled in.

See also

continuousTimeMdss · eventTotalDerivative · solveStepBruteForce · determineParallizedSolvingOrder · msim


MyToolbox Documentation | Generated automatically by CI/CD pipeline