Model Predictive Control (MPC)

MPC

Linear MPC requires solving a Quadratic Program (QP)

$\min\limits_{z} \ \frac{1}{2} z’Hz+x(t)’F’z + \frac{1}{2}x’(t)Yx(t)$

s.t. $Gz\le W+Sx$

where $z=\begin{bmatrix} u_0 \ u_1 \ \vdots \ u_{N-1} \end{bmatrix}$

These define a polyhedron where the solution should lie.

QP solver

fast gradient method for dual QP

  • apply fast gradient method to dual QP

    ​ $\min\limits_{z} \ \frac{1}{2} z’Hz+x’F’z$

    ​ s.t. $Gz\le W+Sx$

    Example:

    Model:

    ​ $\begin{align} w_k &= y_k+\beta_k(y_k - y_{k-1})\ z_k &= -Kw_k-Jx\ s_k &= \frac{1}{L}Gz_k-\frac{1}{L}(Sx+W)\ y_{k+1} &= \max { y_k+s_k, 0 }\end{align}$

    ​ Where $y_{-1}=y_0=0$, $K = H^{-1}G’$ , and $J=H^{-1}F’$, $\beta=\begin{cases}0,\quad k=0\ \frac{k_1}{k+2},\quad k>0 \end{cases}$

    Termination criterion:

    1. primal feasibility

      $s_k^i \leq \frac{1}{L}\epsilon_G,\quad \forall i =1,\cdots, m$

    2. primal oprimality

      $f(z_k)-f^*\leq f(z_k)-\phi(w_k)=-w’_ks_kL\leq\epsilon_V$

      and $-w’_k s_k \leq \frac{1}{L} \epsilon_V$

solve MPC:

Step 1: get a linear discrete-time model

system linearization

Step 2: design the MPC controller

LPV

LinearParameter-Varying(LPV) model

​ $$\begin{align} x_{k+1}&=A(p(t))x_k+B(p(t))u_k+B_v(p(t))v_k \ y_{k+1}&=C(p(t))x_k+D_v(p(t))v_k \end{align}$$

​ depends on $p(t)$

the quadratic perfirmance index can also be LPV, and the resulting optimization problem is still a QP:

​ $$\begin{align} \min\limits_{z}\quad \frac{1}{2} z’H(p(t))z+\begin{bmatrix} x(t)\ r(t)\ u(t-1) \end{bmatrix}’ F(p(t))’ z’ \ \text{s.t.} \quad G(p(t))z \leq W(p(t))+S(p(t))\begin{bmatrix} x(t) \ r(t)\ u(t-1) \end{bmatrix} \end{align}$$

The QP matrices must be constructed online, contrarily to the LTI case.

An LPV model can obtained by linearizing nonlinear model

​ $\begin{cases} \dot{x}_x(t)=f(x_c(t),u_c(t),p_c(t))\ y_c(t)=g(x_c(t),p_c(t)) \end{cases}$

​ where $p_c$ = a vector of exogeneous signals

Linearize:

​ $$\dot{x}c(t) \simeq \underbrace{ \frac{\partial f}{\partial x}|{\bar{x}_c,\bar{u}_c,\bar{p}c}}{A_c} (x_c(t)-\bar{x}c) + \underbrace{ \frac{\partial f}{\partial u}|{\bar{x}_c,\bar{u}_c,\bar{p}c}}{B_c} (u_c(t)-\bar{u}c)+ \underbrace{ \left[ \frac{\partial f}{\partial p}|{\bar{x}_c,\bar{u}_c,\bar{p}_c} f(\bar{x}_c,\bar{u}c,\bar{p}c) \right]}{B{vc}} \begin{bmatrix}[p_c(t)-\bar{p}_c\ 1]\end{bmatrix} $$

  • convert $\begin{bmatrix} A_c, [B_c \ \ B_{vc}] \end{bmatrix}$ to discrete-time and get prediction model $(A, []B\ \ B_{vc})$
  • same thing for the output equation, to get matrices $C$ and $D_v$

LTV

Linear time-varying (LTV) model

  • $\begin{align} x_{k+1}&=A_k(t) x_k +B_k(t)u_k\ y_k&=C_k(t)x_k \end{align}$

  • at each time the model can also change over the prediction horizon $k$

  • the optimization problem is still a QP

    ​ $$\begin{align} \min\limits_{z}\quad \frac{1}{2} z’H(t)z+\begin{bmatrix} x(t)\ r(t)\ u(t-1) \end{bmatrix}’ F(t)’ z’ \ \text{s.t.} \quad G(t)z \leq W(t)+S(t)\begin{bmatrix} x(t) \ r(t)\ u(t-1) \end{bmatrix} \end{align}$$

  • As for LPV-MPC, the QP matrices must be constructed online.

  • LTV/LPV model can be obtained by linearing nonlinear models
  • nominal trajectories:
    • $U={\bar{u}_c(t),\bar{u}_c(t+T_s),\cdots,\bar{u}_c (t+(N-1)T_s)}$
      • $U$=shifted previous optimal sequence, or reference trajectories.
    • $P={\bar{p}_c(t),\bar{p}_c(t+T_s),\cdots,\bar{p}_c (t+(N-1)T_s)}$
      • no preview: $\bar{p}_c(t+k)\equiv \bar{p}_c(t)$