pymgrid.algos.ModelPredictiveControl#

class pymgrid.algos.ModelPredictiveControl(microgrid, solver=None)[source]#

Run a model predictive control algorithm on a microgrid.

In model predictive control, a model of the microgrid is used to predict the microgrid’s response to taking certain actions. Armed with this prediction model, we can predict the microgrid’s response to simulating forward a certain number of steps (the forecast “horizon”). This results in an objective function – with the objective being the cost of running the microgrid over the entire horizon.

Given the solution of this optimization problem, we apply the control we found at the current step (ignoring the rest) and then repeat.

The specifics of the model implementation can be seen in the accompanying paper.

Warning

This implementation of model predictive control does not support arbitrary microgrid components. One each of load, renewable, battery, grid, and genset are allowed. Microgrids are not required to have both grid and genset but they must have one; they also must have one each of load, renewable, and battery.

Parameters#

microgridpymgrid.Microgrid

Microgrid on which to run model predictive control.

Methods

get_action([verbose])

reset()

Reset the underlying microgrid.

run([max_steps, verbose])

Run the model prediction control algorithm.

solver_context()