Functions: SimModel Internals
State-Space Functions
ModelPredictiveControl.f! — Functionf!(x0next, _ , model::LinModel, x0, u0, d0, _ ) -> nothingEvaluate x0next = A*x0 + Bu*u0 + Bd*d0 in-place when model is a LinModel.
f!(x0next, k0, model::NonLinModel, x0, u0, d0, p)Compute x0next using the DiffSolver in model.solver and model.f!.
The method mutates x0next and k0 arguments in-place. The latter is used to store the intermediate stage values of the solver.
ModelPredictiveControl.h! — Functionh!(y0, model::LinModel, x0, d0, _ ) -> nothingEvaluate y0 = C*x0 + Dd*d0 in-place when model is a LinModel.
h!(y0, model::NonLinModel, x0, d0, p)Compute y0 by calling model.h! directly for NonLinModel.
Steady-State Calculation
ModelPredictiveControl.steadystate! — Functionsteadystate!(model::LinModel, u0, d0)Set model.x0 to u0 and d0 steady-state if model is a LinModel.
Following setop! notation, the method evaluates the equilibrium from:
\[ \mathbf{x_0} = \mathbf{(I - A)^{-1}(B_u u_0 + B_d d_0 + f_{op} - x_{op})}\]
with constant manipulated inputs $\mathbf{u_0 = u - u_{op}}$ and measured disturbances $\mathbf{d_0 = d - d_{op}}$. The Moore-Penrose pseudo-inverse computes $\mathbf{(I - A)^{-1}}$ to support integrating model (integrator states will be 0).
Do nothing if model is a NonLinModel.