set_uncertainty_values

Class method.

do_mpc.controller.MPC.set_uncertainty_values(self, uncertainty_values=None, **kwargs)

Define scenarios for the uncertain parameters. High-level API method to conveniently set all possible scenarios for multistage MPC. For more details on robust multi-stage MPC please read our background article.

Pass a number of keyword arguments, where each keyword refers to a user defined parameter name from the model definition. The value for each parameter must be an array (or list), with an arbitrary number of possible values for this parameter. The first element is the nominal case.

Example:

# in model definition:
alpha = model.set_variable(var_type='_p', var_name='alpha')
beta = model.set_variable(var_type='_p', var_name='beta')
gamma = model.set_variable(var_type='_p', var_name='gamma')
...
# in MPC configuration:
alpha_var = np.array([1., 0.9, 1.1])
beta_var = np.array([1., 1.05])
MPC.set_uncertainty_values(
    alpha = alpha_var,
    beta = beta_var
)

Note

Parameters that are not imporant for the MPC controller (e.g. MHE tuning matrices) can be ignored with the new interface (see gamma in the example above).

Legacy interface: Pass a list of arrays for the uncertain parameters. This list must have the same number of elements as uncertain parameters in the model definition. The first element is the nominal case. Each list element can be an array or list of possible values for the respective parameter. Note that the order of elements determine the assignment.

Example:

# in model definition:
alpha = model.set_variable(var_type='_p', var_name='alpha')
beta = model.set_variable(var_type='_p', var_name='beta')
...
# in MPC configuration:
alpha_var = np.array([1., 0.9, 1.1])
beta_var = np.array([1., 1.05])
MPC.set_uncertainty_values([alpha_var, beta_var])

Note the nominal case is now: alpha = 1, beta = 1 which is determined by the order in the arrays above (first element is nominal).

Parameters:
  • kwargs – Arbitrary number of keyword arguments.
  • uncertainty_values (list) – (Depreciated) List of lists / numpy arrays with the same number of elements as number of parameters in model.
Returns:

None

Return type:

None

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