What is MPC?
Model Predictive Control is a control strategy that uses a dynamic model of the system to predict future behaviour and optimise control inputs over a finite time horizon. It solves an optimisation problem at each control step to determine the best action, while explicitly handling constraints on inputs, states, and outputs.
Why use MPC?
In control engineering, we’re often faced with the task of designing a controller that not only keeps the system stable but also ensures good performance under physical and operational constraints. Classical control strategies—like PID, pole placement, or even LQR—tend to struggle when the system becomes complex, multivariable, nonlinear, or subject to tight limits on inputs or states. That’s where Model Predictive Control comes in.
MPC stands out by making explicit use of a model of the system to anticipate how the system will evolve over a future time horizon. Instead of reacting to the current error only (as in PID), MPC optimises a sequence of control inputs to achieve the best future behaviour, while ensuring that no physical or safety limits are violated. This predictive and optimising nature is what makes MPC uniquely powerful for modern, constraint-laden control problems.
Overview
Model Predictive Control, MPC, is an optimal control technique.
Following a state space model of the form:
Link to original
The optimal control problem is formulated as follows:
where
- : Prediction horizon
- : Current state
- : Reference state and input
- : Positive semi-definite weighting matrices
- : State and input constraint sets
- : Terminal constraint set (optional, used for stability guarantees)
Dual-mode MPC
Dual-mode MPC is a control strategy that splits the future control horizon into two modes:
- Mode 1 (MPC mode): The controller optimises the input sequence over a finite horizon as usual.
- Mode 2 (Terminal mode): After the finite horizon, it assumes a known stabilising controller (e.g., LQR) will take over and drive the system to the origin (or reference point).
This structure gives formal guarantees of closed-loop stability, because the optimisation ensures that the system ends up in a terminal region where the stabilising controller can handle everything safely from there.
Key Additions with Dual-mode MPC
- Terminal Cost
- is chosen as the solution to the discrete-time algebraic Riccati equation (DARE) for the stabilising feedback controller .
- This approximates the infinite-horizon cost-to-go if you were to use after the horizon ends.
- Terminal Constraint Set
- This is a positive invariant set under the stabilising control law .
- It ensures that if , then future states will remain within constraints even after switching to the backup controller.
- Backup Controller (used implicitly)
- Not part of the optimisation, but used in the theoretical analysis.
- Ensures that once the system reaches , it can be safely stabilized indefinitely.
Tuning an MPC
When developing an MPC, there are three key tuning parameters:
- The prediction horizon:
- The state cost matrix:
- The input cost matrix:
Assuming no modelling or constraint errors, these three parameters are what need to be tuned to ensure the controller effectively controls the system.
First let’s talk about , the prediction horizon. This is how far the controller will ‘look into the future’. When tuning an MPC you should also have context on the time-step, since MPCs are typically implemented in discrete time. Consider what your system is, what the control rate is, and whether how far the system should look into the future. has a sweet spot - too far into the future, or to little into the future, and the controller leads to instability. The in between those values leads to stability. is often easier to find than the cost matrices, since it is only one variable.
and should be chosen as positive definite matrices. They are penalty matrices, the higher you chose their elements, the harder the controller will punish that variable. For example, a high will make the controller focus on reducing the error on . On the other hand, a high will make the controller use the input less.