prediction

Class method.

do_mpc.data.MPCData.prediction(self, ind, t_ind=-1)

Query the MPC trajectories. Use this method to obtain specific MPC trajectories from the data object.

Warning

This method requires that the optimal solution is stored in the do_mpc.data.MPCData instance. Storing the optimal solution must be activated with do_mpc.controller.MPC.set_param().

Querying predicted trajectories requires the use of power indices, which is passed as tuple e.g.:

data.prediction((var_type, var_name, i), t_ind)

where

  • var_type refers to _x, _u, _z, _tvp, _p, _aux
  • var_name refers to the user-defined names in the do_mpc.model.Model
  • Use i to index vector valued variables.

The method returns a multidimensional numpy.ndarray. The dimensions refer to:

arr = data.prediction(('_x', 'x_1'))
arr.shape
>> (n_size, n_horizon, n_scenario)

with:

  • n_size denoting the number of elements in x_1, where n_size = 1 is a scalar variable.
  • n_horizon is the MPC horizon defined with do_mpc.controller.MPC.set_param()
  • n_scenario refers to the number of uncertain scenarios (for robust MPC).

Additional to the power index tuple, a time index (t_ind) can be passed to access the prediction for a certain time.

Parameters:ind (tuple) – Power index to query the prediction of a specific variable.
Returns:Predicted trajectories for the queries variable.
Return type:numpy.ndarray

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