Class method.

do_mpc.model.Model.set_alg(self, expr_name, expr)

Introduce new algebraic equation to model.

For the continous time model, the expression must be formulated as

\[0 = g(x(t),u(t),z(t),p(t),p_{\text{tv}}(t))\]

or for a discrete model:

\[0 = g(x_k,u_k,z_k,p_k,p_{\text{tv},k})\]


For the introduced algebraic variables \(z \in \mathbb{R}^{n_z}\) it is required to introduce exactly \(n_z\) algebraic equations. Otherwise setup() will throw an error message.

  • expr_name (string) – Name of the introduced expression
  • expr (CasADi SX or MX) – CasADi SX or MX function depending on _x, _u, _z, _tvp, _p.

This page is auto-generated. Page source is not available on Github.