do-mpc data container for the do_mpc.controller.MPC instance. This method inherits from Data and extends it to query the MPC predictions.


Query data fields. This method can be used to obtain the stored results in the Data instance.

The full list of available fields can be inspected with:


The dict also denotes the dimension of each field.

The method allows for power indexing the results for the fields _x, _u, _z, _tvp, _p, _aux, _y where further indices refer to the configured variables in the do_mpc.model.Model instance.


# Assume the following model was used (excerpt):
model = do_mpc.model.Model('continuous')

model.set_variable('_x', 'Temperature', shape=(5,1)) # Vector
model.set_variable('_p', 'disturbance', shape=(3,3)) # Matrix
model.set_variable('_u', 'heating')                  # scalar


# the model was used (among others) for the MPC controller
mpc = do_mpc.controller.MPC(model)


# Query the instance:['_x']                      # Return all states['_x', 'Temperature']       # Return the 5 temp states['_x', 'Temperature', :2]   # Return the first 2 temp. states['_p', 'disturbance', 0, 2] # Matrix allows for further indices

# Other fields can also be queried, e.g.:['_time']                   # current time['t_wall_total']            # optimizer runtime
# These do not allow further indices.
Returns:Returns the queried data field (for all time instances)
Return type:numpy.ndarray


MPCData.export The export method returns a dictionary of the stored data.
MPCData.init_storage Create new (empty) arrays for all variables.
MPCData.prediction Query the MPC trajectories.
MPCData.set_meta Set meta data for the current instance of the data object.
MPCData.update Update value(s) of the data structure with key word arguments.

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