Data-Driven MPC Principles
Data-Driven MPC Uses a Behavioral Plant Model
Data-driven model predictive control works by solving, at each control interval, a quadratic program (QP) in which input and output variables are constrained to satisfy a matrix equation representing a behavioral model (instead of a state-space model, as in classical linear MPC) of the plant that you want to control.
The behavioral model of an LTI system is based on the fundamental lemma by Willems et al. [1],[2]. This lemma states that all finite-length input-output trajectories of the system can be parameterized as a linear combination of time-shifted segments of a single trajectory, when such segments are arranged into a Hankel matrix. This result holds as long as the system is controllable and the input is persistently exciting (that is, sufficiently rich to excite all system modes).
The following sections describe in more detail this behavioral model and how it is used for data-driven MPC.
Hankel Matrix and Fundamental Lemma
Given the sequence:
collected from time k = 0 to time k = N-1, where each element wk is a column vector with m elements, the Hankel matrix of depth L associated with the sequence is defined as:
If HL(w) has full row rank, that is, if its rank is equal to the number of rows, mL, then the sequence w is said to be persistently exciting of order L.
The input-output sequence
is called a trajectory of an LTI system G if there is an initial condition x0∈ℝn as well as a state sequence
such that
for k = 0, …, N–1, where {A,B,C,D} is a minimal realization of G [3].
Given a trajectory, denoted with the d superscript, of the controllable LTI system G, that is persistently exciting of order L+n:
the fundamental lemma states that the input-output sequence from the same plant
is a trajectory of G if and only if there exist a predictor vector α such that:
Informally, when the input-output system trajectory is assembled in a Hankel matrix, it spans the set of all finite-length trajectories of the system. More precisely, the image of the Hankel matrix in the previous equation is equal to the set of all possible system trajectories of G, [2] and [3].
The significance of this results is twofold. First, it shows that a single, persistently exciting trajectory of a controllable LTI system contains enough information to reproduce all system trajectories. Second, it provides a way to represent any system trajectory using a linear combination of time-shifted segments of the collected trajectory.
In other words
Given an arbitrary α value, the resulting us and ys values on the right side of the equation form a legitimate trajectory from the plant.
Given enough arbitrary us and ys values measured from a plant, you can use the equation to find a value of α.
Note
When you create a DataDrivenMPC
object, the first two arguments dataU and dataY
represent the input-output data sequence
{ud,yd}
.
As an aside, note that the Hankel matrix representation of an input-output trajectory is
also related to its autoregressive moving average representation. Specifically, the
a and b coefficients of an armax (System Identification Toolbox) representation of the system, using L poles and
zeros, span the left null space of the Hankel matrix.
The following section describes in more detail how this way of representing system trajectories is used for data-driven MPC.
Data-Driven MPC Formulation
Like classical linear MPC, data-driven MPC also solves a QP problem involving decision variables, a cost function, and constraints, to determine the manipulated variables that the controller must use in the current control interval. The main difference is that, while classical MPC uses a state-space model of the system to express the dynamic constraints, data-driven MPC replaces the state space model with a behavioral model consisting of four Hankel matrix equalities based on the fundamental lemma.
The QP problem for the data-driven MPC problem is formulated as follows.
You can divide the QP problem into three main parts: the cost function, the constraints that express the dynamics of the system, and the constraints that express bounds on the inputs and outputs.
Decision Variables
The decision variables for the optimization problem are:
The predictor vector α. The number of elements of this vector is the number of columns of the stacked Hankel matrix in the data-driven MPC problem, and is available in the
Dimensions.HankelWidthproperty of aDataDrivenMPCobject.The input slack variable σu, used to soften the equality constraints applied to the past input trajectory. The number of elements of this vector is available in the
Dimensions.NumberOfSlacksOnPastInputproperty of aDataDrivenMPCobject.The output slack variable σy, used to soften the equality constraints applied to the past output trajectory. The number of elements of this vector is available in the
Dimensions.NumberOfSlacksOnPastOutputproperty of aDataDrivenMPCobject.
Cost Function
The cost function terms Jy, Ju, and JΔu are cost terms for output reference tracking, input reference tracking, and input move suppression, respectively. They are described in QP Optimization Problem for Linear MPC for classical MPC. For data-driven MPC, the scaling term is equal to one.
The last three terms of the cost function are penalties that are used to prevent the
decision variables from reaching exceedingly large values. Specifically, the weight
λα penalizes large values of the predictor
vector α, and corresponds to the
Weights.HankelVariables property of a DataDrivenMPC
object. The weights λu and
λy penalize large values of the slack
variables σu and
σy, and correspond to the
Weights.SlackPastY and Weights.SlackPastU
properties of a DataDrivenMPC
object, respectively.
Equality Constraints
The four Hankel matrix equalities in the data-driven MPC problem formulation serve as constraints that enforce the system dynamics.
In the first two equalities, the subscript p refers to the past
samples from k-Np to
k-1, with k being the current time.
Np corresponds to the
PastSteps property of a DataDrivenMPC object.
In the last two equalities, the subscript f refers to the future
samples from k to
k+Nf.
Nf corresponds to the
FutureSteps property of a DataDrivenMPC
object.
These four equalities are needed to calculate the correct predictor vector α based on the past Np plant inputs and outputs, and to obtain the future sequence {u,y} while enforcing that it must be a trajectory of the LTI system. The slack variables allow some robustness to noise in the data sequence {ud,yd}.
Inequality Constraints
The last three constraints of the data-driven MPC problem formulation enforce bounds for the outputs, manipulated variables, and manipulated variable rates, as described in Constraints for the classical MPC problem.
QP Matrices and Solver
The software arranges the QP matrices of the problem from the cost function and constraints, and uses the KWIK active-set QP solver to solve the optimization problem at each control interval. For more information on the solvers, see QP Solvers for Linear MPC.
Data-Driven Open-Loop Output Prediction
You can also use the Hankel matrices Hp(ud), Hp(yd), Hf(ud), and Hf(yd) to predict a future open-loop output sequence yf given the past input sequence {up,yp} and the future input sequence uf [2][4].
Specifically, you can stack the first three Hankel matrices as follows:
and then solve for the predictor vector α by left-multiplying both sides with the Moore-Penrose pseudo-inverse of the matrix on the left. Once you have α, you can then use it to calculate the output sequence by multiplying fourth Hankel matrix with α:
The function checkPrediction
uses this method to compare given validation outputs to the outputs predicted by the
internal model of a DataDrivenMPC
object.
Subspace predictive control (SPC) [4] uses the same two-step procedure to first explicitly identify a predictor from data and then use the predictor as a model to solve a QP problem and find the optimal manipulated variables. Because SPC involves an a priori estimation step, it is considered an indirect data-driven MPC method. By contrast, the direct data-driven MPC method used in Model Predictive Control Toolbox™ software, which is discussed in the previous section, is considered a direct data-driven MPC method.
References
[1] Berberich, Julian, Andrea Iannelli, Alberto Padoan, Jeremy Coulson, Florian Dörfler, and Frank Allgöwer. “A Quantitative and Constructive Proof of Willems’ Fundamental Lemma and Its Implications.” 2023 American Control Conference (ACC), IEEE, May 31, 2023, 4155–60.https://doi.org/10.23919/ACC55779.2023.10156227
[2] Markovsky, Ivan, Linbin Huang, and Florian Dörfler. “Data-Driven Control Based on the Behavioral Approach: From Theory to Applications in Power Systems.” IEEE Control Systems 43, no. 5 (2023): 28–68. https://doi.org/10.1109/MCS.2023.3291638.
[3] Berberich, Julian, Johannes Kohler, Matthias A. Muller, and Frank Allgöwer. “Data-Driven Model Predictive Control With Stability and Robustness Guarantees.” IEEE Transactions on Automatic Control 66, no. 4 (2021): 1702–17. https://doi.org/10.1109/TAC.2020.3000182.
[4] Berberich, Julian, and Frank Allgöwer. “An Overview of Systems-Theoretic Guarantees in Data-Driven Model Predictive Control.” arXiv:2406.04130. Preprint, arXiv, June 6, 2024. https://arxiv.org/abs/2406.04130.