## Adaptive MPC

### When to Use Adaptive MPC

MPC control predicts future behavior using a linear-time-invariant (LTI) dynamic model. In practice, such predictions are never exact, and a key tuning objective is to make MPC insensitive to prediction errors. In many applications, this approach is sufficient for robust controller performance.

If the plant is strongly nonlinear or its characteristics vary dramatically with time, LTI prediction accuracy might degrade so much that MPC performance becomes unacceptable. Adaptive MPC can address this degradation by adapting the prediction model for changing operating conditions. As implemented in the Model Predictive Control Toolbox™ software, adaptive MPC uses a fixed model structure, but allows the models parameters to evolve with time. Ideally, whenever the controller requires a prediction (at the beginning of each control interval) it uses a model appropriate for the current conditions.

After you design an MPC controller for the average or most likely operating conditions of your control system, you can implement an adaptive MPC controller based on that design. For information about designing that initial controller, see Controller Creation.

At each control interval, the adaptive MPC controller updates the plant model and nominal conditions. Once updated, the model and conditions remain constant over the prediction horizon. If you can predict how the plant and nominal conditions vary in the future, you can use Time-Varying MPC to specify a model that changes over the prediction horizon.

An alternative option for controlling a nonlinear or time-varying plant is to use gain-scheduled MPC control. See Gain-Scheduled MPC.)

### Plant Model

The plant model used as the basis for adaptive MPC must be an LTI discrete-time, state-space model. See Basic Models or Linearization Basics (Simulink Control Design) for information about creating and modifying such systems. The plant model structure is as follows:

$\begin{array}{c}x\left(k+1\right)=Ax\left(k\right)+{B}_{u}u\left(k\right)+{B}_{v}v\left(k\right)+{B}_{d}d\left(k\right)\\ y\left(k\right)=Cx\left(k\right)+{D}_{v}v\left(k\right)+{D}_{d}d\left(k\right).\end{array}$

Here, the matrices *A*,
*B _{u}*,

*B*,

_{v}*B*,

_{d}*C*,

*D*, and

_{v}*D*are the parameters that can vary with time. The other variables in the expression are:

_{d}*k*— Time index (current control interval).*x*—*n*plant model states._{x}*u*—*n*manipulated inputs (MVs). These are the one or more inputs that are adjusted by the MPC controller._{u}*v*—*n*measured disturbance inputs._{v}*d*—*n*unmeasured disturbance inputs._{d}*y*—*n*plant outputs, including_{y}*n*measured and_{ym}*n*unmeasured outputs. The total number of outputs,_{yu}*n*=_{y}*n*+_{ym}*n*. Also,_{yu}*n*≥ 1 (there is at least one measured output)._{ym}

Additional requirements for the plant model in adaptive MPC control are:

Sample time (

`Ts`

) is a constant and identical to the MPC control interval.Time delay (if any) is absorbed as discrete states (see, for example, the Control System Toolbox™

`absorbDelay`

function).*n*,_{x}*n*,_{u}*n*,_{y}*n*,_{d}*n*, and_{ym}*n*are all constants._{yu}Adaptive MPC prohibits direct feed-through from any manipulated variable to any plant output. Thus,

*D*= 0 in the above model._{u}The input and output signal configuration remains constant.

For more details about creation of plant models for MPC control, see Linear Plant Specification.

### Nominal Operating Point

A traditional MPC controller includes a nominal operating point at which the plant
model applies, such as the condition at which you linearize a nonlinear model to
obtain the LTI approximation. The `Model.Nominal`

property of the
controller contains this information.

In adaptive MPC, as time evolves you should update the nominal operating point to be consistent with the updated plant model.

You can write the plant model in terms of deviations from the nominal conditions:

$\begin{array}{c}x\left(k+1\right)=\overline{x}+A\left(x\left(k\right)-\overline{x}\right)+B\left({u}_{t}\left(k\right)-{\overline{u}}_{t}\right)+\overline{\Delta x}\\ y\left(k\right)=\overline{y}+C\left(x\left(k\right)-\overline{x}\right)+D\left({u}_{t}\left(k\right)-{\overline{u}}_{t}\right).\end{array}$

Here, the matrices *A*, *B*,
*C*, and *D* are the parameter matrices to be
updated. *u _{t}* is the combined plant input
variable, comprising the

*u*,

*v*, and

*d*variables defined above. The nominal conditions to be updated are:

$$\overline{x}$$ —

*n*nominal states_{x}$$\overline{\Delta x}$$ —

*n*nominal state increments_{x}$${\overline{u}}_{t}$$ —

*n*nominal inputs_{ut}$$\overline{y}$$ —

*n*nominal outputs_{y}

### State Estimation

By default, MPC uses a static Kalman filter (KF) to update its controller states,
which include the *n _{xp}* plant model states,

*n*(≥ 0) disturbance model states, and

_{d}*n*(≥ 0) measurement noise model states. This KF requires two gain matrices,

_{n}*L*and

*M*. By default, the MPC controller calculates them during initialization. They depend upon the plant, disturbance, and noise model parameters, and assumptions regarding the stochastic noise signals driving the disturbance and noise models. For more details about state estimation in traditional MPC, see Controller State Estimation.

Adaptive MPC uses a Kalman filter and adjusts the gains, *L* and
*M*, at each control interval to maintain consistency with the
updated plant model. The result is a linear-time-varying Kalman filter
(LTVKF):

$\begin{array}{c}{L}_{k}=\left({A}_{k}{P}_{k|k-1}{C}_{m,k}^{T}+N\right){\left({C}_{m,k}{P}_{k|k-1}{C}_{m,k}^{T}+R\right)}^{-1}\\ {M}_{k}={P}_{k|k-1}{C}_{m,k}^{T}{\left({C}_{m,k}{P}_{k|k-1}{C}_{m,k}^{T}+R\right)}^{-1}\\ {P}_{k+1|k}={A}_{k}{P}_{k|k-1}{A}_{k}^{T}-\left({A}_{k}{P}_{k|k-1}{C}_{m,k}^{T}+N\right){L}_{k}^{T}+Q.\end{array}$

Here, *Q*, *R*, and *N* are
constant covariance matrices defined as in MPC state estimation.
*A _{k}* and

*C*are state-space parameter matrices for the entire controller state, defined as for traditional MPC but with the portions affected by the plant model updated to time

_{m,k}*k*. The value

*P*

_{k|k–1}is the state estimate error covariance matrix at time

*k*based on information available at time

*k*–1. Finally,

*L*and

_{k}*M*are the updated KF gain matrices. For details on the KF formulation used in traditional MPC, see Controller State Estimation. By default, the initial condition,

_{k}*P*

_{0|–1}, is the static KF solution prior to any model updates.

The KF gain and the state error covariance matrix depend upon the model parameters
and the assumptions leading to the constant *Q*,
*R*, and *N* matrices. If the plant model is
constant, the expressions for *L _{k}* and

*M*converge to the equivalent static KF solution used in traditional MPC.

_{k}The equations for the controller state evolution at time *k* are
identical to the KF formulation of traditional MPC described in Controller State Estimation, but with the estimator gains and state
space matrices updated to time *k*.

You have the option to update the controller state using a procedure external to
the MPC controller, and then supply the updated state to MPC at each control
instant, *k*. In this case, the MPC controller skips all KF and
LTVKF calculations.