solveSubProblemFixZ

Method of continuousTimeMdss.

Solve one coupled subproblem for its continuous unknowns with the binaries held fixed.

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

What is solved

Given a coupled subproblem (a block of the solving order) and the binaries fixed at zz, solve for the block’s continuous unknowns w=[ẋs;ys]w=[\dot x_s;\, y_s] from its equality rows

Fs(w)=Φeq,sm(w)=0, F_s(w) = \Phi_{\mathrm{eq},s}\, m(w) = 0 ,

where mm is the norm-1 monomial vector with the fixed zz already folded in (substitution rule as in solveStepBruteForce).

Explicit (type = 1) rows never reach this function — they are solved directly by solveStepBruteForce while walking the solving order. This routine only handles coupled subproblems, which are either linear (type = -1) or nonlinear (type = 0), selected by the block’s type flag.

Linear (type = -1): FsF_s is affine, Fs=Aw+bF_s = A\,w + b, with

A:,j=Φeq,s[(tjfj+cj)m],b=Φeq,s[mj(1|cj|)(1tj)], A_{:,j} = \Phi_{\mathrm{eq},s}\big[(t_j - f_j + c_j)\odot m\big], \qquad b = \Phi_{\mathrm{eq},s}\Big[m \odot \textstyle\prod_{j}(1-|c_j|)(1-t_j)\Big],

solved directly by w=A1bw = -A^{-1}b (backslash).

Nonlinear (type = 0): solved with lsqnonlin (Levenberg–Marquardt) on Fs(w)=0F_s(w)=0 with the analytic Jacobian from the product rule,

Fswo=Φeq,s[mwo],mwo=(poφp(wp))φo(wo), \frac{\partial F_s}{\partial w_o} = \Phi_{\mathrm{eq},s}\!\left[\frac{\partial m}{\partial w_o}\right], \qquad \frac{\partial m}{\partial w_o} = \Big(\textstyle\prod_{p\ne o}\varphi_p(w_p)\Big)\,\varphi_o'(w_o),

where φo\varphi_o' is the derivative of the row-oo factor: coc_o from the continuous part plus (tofo)(t_o-f_o) from the true/false part.

Each solved wow_o is folded back into mm, and the subproblem function values FF (equality) and GG (inequality) are returned.

Used by eventTotalDerivative for the subproblems that precede an event and for each fixed candidate of the enumerated event subproblem.

Input arguments

Argument Description
sys The continuousTimeMdss simulation object (carries the mdss model and solver constants).
solvingOrderSubProblem The solving-order rows of this block [varIdx, eqIdx, type, subset, subproblem].
EqXUZ The running monomial vector mm, with all upstream blocks already folded in.
xpInit Initial values / guess for the block’s state derivatives.
yInit Initial values / guess for the block’s algebraic variables.
y0 Algebraic seed used to start the nonlinear solve.
zInit The (fixed) binary values for this block.

Output arguments

Output Description
xp Solved state derivatives.
y Solved algebraic variables.
G Inequality function values.
F Equality function values.
EqXUZ The monomial vector mm updated with the solved block.

See also

continuousTimeMdss · solveSubProblemVariableZ · eventTotalDerivative · msim


MyToolbox Documentation | Generated automatically by CI/CD pipeline