# plot_predictions¶

Class method.

do_mpc.graphics.Graphics.plot_predictions(self, t_ind=-1)

Plots the predicted trajectories for the plot configuration. The predicted trajectories are part of the optimal solution at each timestep and are optionally stored in the do_mpc.data.MPCData 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().

The plot_predictions method can only be called with data from the do_mpc.controller.MPC object and raises an error if called with data from other objects. Use the t_ind parameter to plot the prediction for the given time instance. This can be used in post-processing for animations.

Parameters: t_ind (int) – Plot predictions at this time index. assertion – Can only call plot_predictions with data object from do-mpc optimizer Exception – Cannot plot predictions if full solution is not stored or supplied when calling the method assertion – t_ind argument must be a int assertion – t_ind argument must not exceed the length of the results None