set_rhs¶
Class method.
-
do_mpc.model.Model.
set_rhs
(self, var_name, expr, process_noise=False)¶ Formulate the right hand side (rhs) of the ODE:
\[\dot{x}(t) = f(x(t),u(t),z(t),p(t),p_{\text{tv}}(t)) + w(t),\]or the update equation in case of discrete dynamics:
\[x_{k+1} = f(x_k,u_k,z_k,p_k,p_{\text{tv},k}) + w_k,\]Each defined state variable must have a respective equation (of matching dimension) for the rhs. Match the rhs with the state by choosing the corresponding names. rhs must be formulated with respect to
_x
,_u
,_z
,_tvp
,_p
.Example:
tank_level = model.set_variable('states', 'tank_level') tank_temp = model.set_variable('states', 'tank_temp') tank_level_next = 0.5*tank_level tank_temp_next = ... model.set_rhs('tank_level', tank_level_next) model.set_rhs('tank_temp', tank_temp_next)
Optionally, set
process_noise = True
to introduce an additive process noise variable. This is meaningful for thedo_mpc.estimator.MHE
(Seedo_mpc.estimator.MHE.set_default_objective()
for more details). Furthermore, it can be set with eachdo_mpc.simulator.Simulator
call to obtain imperfect (realistic) simulation results.Parameters: - var_name (string) – Reference to previously introduced state names (with
Model.set_variable()
) - expr (CasADi SX or MX) – CasADi SX or MX function depending on
_x
,_u
,_z
,_tvp
,_p
. - process_noise (boolean) – (optional) Make the respective state variable non-deterministic.
Raises: - assertion – var_name must be str
- assertion – expr must be a casadi SX or MX type
- assertion – var_name must refer to the previously defined states
- assertion – Cannot call after :py:func`setup`.
Returns: None
Return type: None
- var_name (string) – Reference to previously introduced state names (with
This page is auto-generated. Page source is not available on Github.