set_variable¶
Class method.
-
do_mpc.model.Model.set_variable(self, var_type, var_name, shape=(1, 1))¶ Introduce new variables to the model class. Define variable type, name and shape (optional).
Example:
# States struct (optimization variables): C_a = model.set_variable(var_type='_x', var_name='C_a', shape=(1,1)) T_K = model.set_variable(var_type='_x', var_name='T_K', shape=(1,1)) # Input struct (optimization variables): Q_dot = model.set_variable(var_type='_u', var_name='Q_dot') # Fixed parameters: alpha = model.set_variable(var_type='_p', var_name='alpha')
Note
var_typeallows a shorthand notation e.g._xwhich is equivalent tostates.Parameters: - var_type (string) –
Declare the type of the variable. The following types are valid (long or short name is possible):
Long name short name Remark states_xRequired inputs_uoptional algebraic_zOptional parameter_pOptional timevarying_parameter_tvpOptional - var_name – Set a user-defined name for the parameter. The names are reused throughout do_mpc.
- shape (int or tuple of length 2.) – Shape of the current variable (optional), defaults to
1.
Raises: - assertion – var_type must be string
- assertion – var_name must be string
- assertion – shape must be tuple or int
- assertion – Cannot call after
setup().
Returns: Returns the newly created symbolic variable.
Return type: casadi.SX
- var_type (string) –
This page is auto-generated. Page source is not available on Github.