**2. Adopted MPC formulation**

Fig. 1. MPC with inner feedback loop.

in which Ψ = Ψ*<sup>T</sup>* > 0 is a weight matrix and **U** and **X** are the sets of admissible controls and

Infeasibility Handling in Constrained MPC 51

Following a receding horizon policy, the control at the *k*-th instant is given by *u*(*k*) = *v*ˆ∗(*k*|*k*) − *Kx*(*k*), where *K* is the gain of the internal loop represented in Fig. 1. At time *k* + 1, the

The inner-loop controller is designed as a Linear Quadratic Regulator (LQR) with the

*Qlqr* = *Q<sup>T</sup>*

in order to avoid violations of the constraints stated in Eqs. (14) and (15).

*v*ˆ(*k*|*k*) . . . *v*ˆ(*k* + *M* − 1|*k*)

2

*<sup>x</sup>*ˆ*T*(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*)*Qlqrx*ˆ(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*) + *<sup>u</sup>*ˆ*T*(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*)*Rlqru*ˆ(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*)

*lqr* <sup>≥</sup> 0, *Rlqr* <sup>=</sup> *<sup>R</sup><sup>T</sup>*

*lqr*) is detectable. Let *P* be the only non-negative symmetric solution of the Algebraic Riccati Equation *P* = *<sup>A</sup>TPA* <sup>−</sup> *<sup>A</sup>TPB*(*Rlqr* <sup>+</sup> *<sup>B</sup>TPB*)−1*BTPA* <sup>+</sup> *Qlqr*. It can then be shown that, if the weight matrix Ψ is chosen as Ψ = *Rlqr* + *BTPB*, then the minimization of the cost in Eq. (8) subject to the constraints of Eqs. (9) – (15) is equivalent to the minimization of the cost of Eq. (16) subject to the constraints of Eqs. (11) – (15) (Chisci et al., 2001). The outcome is that the cost function has an infinite horizon, which is useful for stability guarantees (Scokaert & Rawlings, 1998), (Kouvaritakis et al., 1998). It is worth noting that, due to the penalization of the control signal *v*ˆ in the cost of Eq. (8), the MPC acts only when it is necessary to correct the inner-loop control

> ⎤ ⎥ <sup>⎦</sup> , <sup>Ψ</sup> <sup>=</sup>

⎡ ⎢ ⎣ Ψ ... 0 . . . ... . . . 0 ... Ψ

*u*ˆ(*k*|*k*) . . . *u*ˆ(*k* + *N* − 1|*k*)

⎤ ⎥

*Jmpc* = *V*ˆ *<sup>T</sup>*Ψ*V*ˆ (18)

⎤ ⎥

*<sup>U</sup>*<sup>ˆ</sup> <sup>=</sup> *HuV*<sup>ˆ</sup> <sup>+</sup> <sup>Φ</sup>*ux*(*k*) (20)

� ,

<sup>⎦</sup> , (17)

<sup>⎦</sup> , (19)

*lqr* <sup>&</sup>gt; <sup>0</sup> (16)

states, respectively, according to Eqs. (6) and (7).

optimization is repeated to obtain *v*∗(*k* + 1|*k* + 1).

following cost function:

*Jlqr* = ∑<sup>∞</sup> *i*=0 �

with *Qlqr* chosen so that the pair (*A*, *<sup>Q</sup>*<sup>1</sup>

Defining vector *V*ˆ and matrix Ψ as

the cost function can be rewritten as

which is quadratic in terms of *V*ˆ .

Defining the vectors

*V*ˆ =

*X*ˆ =

⎡ ⎢ ⎣

*x*ˆ(*k* + 1|*k*) . . . *x*ˆ(*k* + *N*|*k*) ⎤ ⎥ <sup>⎦</sup> , *<sup>U</sup>*<sup>ˆ</sup> <sup>=</sup>

the state and control prediction vectors may be related to *V*ˆ as (Maciejowski, 2002):

*X*ˆ = *HV*ˆ + Φ*x*(*k*)

It is important to remark that the presence of an infinite number of constraints in Eqs. (14) and (15) does not allow the employment of computational methods for the solution of the

⎡ ⎢ ⎣

⎡ ⎢ ⎣

Fig. 1 presents the main elements of the MPC formulation adopted in this chapter. Since this is a regulator scheme, the desired equilibrium value *xref* for the state must be subtracted from the measured state of the plant *xP*, in order to generate the state *x* read by the controller:

$$\mathbf{x} = \mathbf{x}\_P - \mathbf{x}\_{ref} \tag{1}$$

In a similar manner, the corresponding equilibrium value of the control *uref* must be added to the output of the controller *u* to generate the control *uP* to be applied to the plant, that is:

$$
\mathfrak{u} = \mathfrak{u}\_P - \mathfrak{u}\_{ref} \tag{2}
$$

A mathematical model of the plant is employed to calculate state predictions *N* steps ahead, over the so-called "Prediction Horizon". These predictions are determined on the basis of the current state (*x*(*k*) <sup>∈</sup> **<sup>R</sup>***n*) and are also dependent on the future control sequence. ˆ•(*<sup>k</sup>* <sup>+</sup> *i*|*k*) denotes the predicted value of variable • at time *k* + *i* (*i* ≥ 1) based on the information available at time *k*. The optimization algorithm determines a control sequence, over a Control Horizon of *M* steps (*v*ˆ(*k* + *i* − 1|*k*), *i* = 1, . . . , *M*), that minimizes the cost function specified for the problem, possibly subject to state and/or input constraints. It is assumed that the MPC control sequence is set to zero after the end of the Control Horizon, i.e. *v*ˆ(*k* + *i* − 1|*k*) = 0, *i* > *M*. The control is implemented in a receding horizon fashion, i.e., only the first element of the optimized control sequence is applied to the plant and the solution is recalculated at the next sampling period taking into account the new sensor readings. Therefore, the controller output at time *k* is given by *u*(*k*) = *u*ˆ∗(*k*|*k*) = *v*ˆ∗(*k*|*k*) − *Kx*(*k*), where *K* is the gain of an internal loop.

It is assumed that the dynamics of the plant can be described by a discrete state-space equation of the form *xP*(*k* + 1) = *AxP*(*k*) + *BuP*(*k*). Therefore, the relation between *u* and *x* is given by

$$\mathbf{x}(k+1) = A\mathbf{x}(k) + Bu(k)\tag{3}$$

The MPC controller is designed to enforce constraints of the type

$$
\mu\_{P,\min} \le \mu\_P \le \mu\_{P,\max} \tag{4}
$$

$$
\propto \mathbf{x}\_{P,\min} \le \mathbf{x}\_P \le \mathbf{x}\_{P,\max} \tag{5}
$$

Considering Eqs. (1) and (2), the constrains in Eqs. (4) and (5) can be expressed as

$$
\mu\_{P,\min} - \mu\_{ref} \le \mu \le \mu\_{P,\max} - \mu\_{ref} \tag{6}
$$

$$
\lambda \mathbf{x}\_{P,min} - \mathbf{x}\_{ref} \le \mathbf{x} \le \mathbf{x}\_{P,max} - \mathbf{x}\_{ref} \tag{7}
$$

The optimization problem to be solved at instant *k* consists of minimizing a cost function of the form

$$J\_{\rm mpc} = \sum\_{i=0}^{M-1} \mathfrak{d}^T(k+i|k)\Psi \mathfrak{d}(k+i|k) \tag{8}$$

subject to the following constraints:

$$\text{if}(k+i|k) = -\text{K}\pounds(k+i|k) + \vartheta(k+i|k), \; i \ge 0 \tag{9}$$

$$
\hat{v}(k+i|k) = 0, \; i \ge M \tag{10}
$$

$$\pounds(k+i+1|k) = A\pounds(k+i|k) + B\pounds(k+i|k), \; i \ge 0 \tag{11}$$

$$\mathfrak{X}(k|k) = \mathfrak{x}(k) \tag{12}$$

$$\hat{y}(k+i|k) = \mathbb{C}\hat{x}(k+i|k), \; i \ge 0 \tag{13}$$


4 Will-be-set-by-IN-TECH

Fig. 1 presents the main elements of the MPC formulation adopted in this chapter. Since this is a regulator scheme, the desired equilibrium value *xref* for the state must be subtracted from the measured state of the plant *xP*, in order to generate the state *x* read by the controller:

In a similar manner, the corresponding equilibrium value of the control *uref* must be added to the output of the controller *u* to generate the control *uP* to be applied to the plant, that is:

A mathematical model of the plant is employed to calculate state predictions *N* steps ahead, over the so-called "Prediction Horizon". These predictions are determined on the basis of the current state (*x*(*k*) <sup>∈</sup> **<sup>R</sup>***n*) and are also dependent on the future control sequence. ˆ•(*<sup>k</sup>* <sup>+</sup> *i*|*k*) denotes the predicted value of variable • at time *k* + *i* (*i* ≥ 1) based on the information available at time *k*. The optimization algorithm determines a control sequence, over a Control Horizon of *M* steps (*v*ˆ(*k* + *i* − 1|*k*), *i* = 1, . . . , *M*), that minimizes the cost function specified for the problem, possibly subject to state and/or input constraints. It is assumed that the MPC control sequence is set to zero after the end of the Control Horizon, i.e. *v*ˆ(*k* + *i* − 1|*k*) = 0, *i* > *M*. The control is implemented in a receding horizon fashion, i.e., only the first element of the optimized control sequence is applied to the plant and the solution is recalculated at the next sampling period taking into account the new sensor readings. Therefore, the controller output at time *k* is given by *u*(*k*) = *u*ˆ∗(*k*|*k*) = *v*ˆ∗(*k*|*k*) − *Kx*(*k*), where *K* is the gain of an internal loop. It is assumed that the dynamics of the plant can be described by a discrete state-space equation of the form *xP*(*k* + 1) = *AxP*(*k*) + *BuP*(*k*). Therefore, the relation between *u* and *x* is given by

The MPC controller is designed to enforce constraints of the type

*Jmpc* =

the form

subject to the following constraints:

Considering Eqs. (1) and (2), the constrains in Eqs. (4) and (5) can be expressed as

*M*−1 ∑ *i*=0 *v*ˆ

The optimization problem to be solved at instant *k* consists of minimizing a cost function of

*x* = *xP* − *xref* (1)

*u* = *uP* − *uref* (2)

*x*(*k* + 1) = *Ax*(*k*) + *Bu*(*k*) (3)

*uP*,*min* ≤ *uP* ≤ *uP*,*max* (4) *xP*,*min* ≤ *xP* ≤ *xP*,*max* (5)

*<sup>T</sup>*(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*)Ψ*v*ˆ(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*) (8)

*uP*,*min* − *uref* ≤ *u* ≤ *uP*,*max* − *uref* (6) *xP*,*min* − *xref* ≤ *x* ≤ *xP*,*max* − *xref* (7)

*u*ˆ(*k* + *i*|*k*) = −*Kx*ˆ(*k* + *i*|*k*) + *v*ˆ(*k* + *i*|*k*), *i* ≥ 0 (9) *v*ˆ(*k* + *i*|*k*) = 0, *i* ≥ *M* (10) *x*ˆ(*k* + *i* + 1|*k*) = *Ax*ˆ(*k* + *i*|*k*) + *Bu*ˆ(*k* + *i*|*k*), *i* ≥ 0 (11) *x*ˆ(*k*|*k*) = *x*(*k*) (12) *y*ˆ(*k* + *i*|*k*) = *Cx*ˆ(*k* + *i*|*k*), *i* ≥ 0 (13) *u*ˆ(*k* + *i*|*k*) ∈ **U**, *i* ≥ 0 (14) *x*ˆ(*k* + *i*|*k*) ∈ **X**, *i* > 0 (15) in which Ψ = Ψ*<sup>T</sup>* > 0 is a weight matrix and **U** and **X** are the sets of admissible controls and states, respectively, according to Eqs. (6) and (7).

Following a receding horizon policy, the control at the *k*-th instant is given by *u*(*k*) = *v*ˆ∗(*k*|*k*) − *Kx*(*k*), where *K* is the gain of the internal loop represented in Fig. 1. At time *k* + 1, the optimization is repeated to obtain *v*∗(*k* + 1|*k* + 1).

The inner-loop controller is designed as a Linear Quadratic Regulator (LQR) with the following cost function:

$$\begin{aligned} J\_{lqr} = \boldsymbol{\Sigma}\_{i=0}^{\infty} \left[ \boldsymbol{\mathfrak{f}}^T (k+i|k) Q\_{lqr} \boldsymbol{\mathfrak{f}} (k+i|k) + \boldsymbol{\mathfrak{f}}^T (k+i|k) R\_{lqr} \boldsymbol{\mathfrak{f}} (k+i|k) \right], \\ Q\_{lqr} = Q\_{lqr}^T \ge 0, \quad R\_{lqr} = R\_{lqr}^T > 0 \end{aligned} \tag{16}$$

with *Qlqr* chosen so that the pair (*A*, *<sup>Q</sup>*<sup>1</sup> 2 *lqr*) is detectable.

Let *P* be the only non-negative symmetric solution of the Algebraic Riccati Equation *P* = *<sup>A</sup>TPA* <sup>−</sup> *<sup>A</sup>TPB*(*Rlqr* <sup>+</sup> *<sup>B</sup>TPB*)−1*BTPA* <sup>+</sup> *Qlqr*. It can then be shown that, if the weight matrix Ψ is chosen as Ψ = *Rlqr* + *BTPB*, then the minimization of the cost in Eq. (8) subject to the constraints of Eqs. (9) – (15) is equivalent to the minimization of the cost of Eq. (16) subject to the constraints of Eqs. (11) – (15) (Chisci et al., 2001). The outcome is that the cost function has an infinite horizon, which is useful for stability guarantees (Scokaert & Rawlings, 1998), (Kouvaritakis et al., 1998). It is worth noting that, due to the penalization of the control signal *v*ˆ in the cost of Eq. (8), the MPC acts only when it is necessary to correct the inner-loop control in order to avoid violations of the constraints stated in Eqs. (14) and (15).

Defining vector *V*ˆ and matrix Ψ as

$$
\hat{\mathcal{V}} = \begin{bmatrix}
\hat{v}(k|k) \\
\vdots \\
\hat{v}(k+M-1|k)
\end{bmatrix}, \overline{\Psi} = \begin{bmatrix}
\Psi \dots \ 0 \\
\vdots \ \ddots \ \vdots \\
0 \dots \ \Psi
\end{bmatrix}, \tag{17}
$$

the cost function can be rewritten as

$$J\_{mpc} = \hat{\mathcal{V}}^T \overline{\Psi} \hat{\mathcal{V}} \tag{18}$$

which is quadratic in terms of *V*ˆ .

Defining the vectors

$$\mathfrak{X} = \begin{bmatrix} \mathfrak{x}(k+1|k) \\ \vdots \\ \mathfrak{x}(k+N|k) \end{bmatrix}, \mathfrak{U} = \begin{bmatrix} \mathfrak{A}(k|k) \\ \vdots \\ \mathfrak{A}(k+N-1|k) \end{bmatrix} \tag{19}$$

the state and control prediction vectors may be related to *V*ˆ as (Maciejowski, 2002):

$$\begin{aligned} \hat{X} &= H\hat{V} + \Phi \mathbf{x}(k) \\ \hat{\mathcal{U}} &= H\_{\mu}\hat{V} + \Phi\_{\mu}\mathbf{x}(k) \end{aligned} \tag{20}$$

It is important to remark that the presence of an infinite number of constraints in Eqs. (14) and (15) does not allow the employment of computational methods for the solution of the

**3.2 Soft-constraint approach**

right-hand side of Eq. (8), as follows:

*JSo f t* =

*N*−1 ∑ *i*=0 *v*ˆ

In this approach the cost function is modified to include a penalization on the violation of operating constraints. This way, a compromise is achieved between time and peak values of the violations, as well as performance of the control-loop. Scokaert & Rawlings (1999) propose the penalization of the sum of the square of the values of the violations instead of the peak as means to reduce their time length. This can be accomplished by simply adding slack variables to the state/output constraints of Eq. (7) in case of infeasibility and adding a term to the

Infeasibility Handling in Constrained MPC 53

*<sup>T</sup>*(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*)Ψ*v*ˆ(*<sup>k</sup>* <sup>+</sup> *<sup>i</sup>*|*k*) + *<sup>T</sup>*

*xP*,*min* − *xref* − *<sup>n</sup>* ≤ *x* ≤ *xP*,*max* − *xref* + *<sup>p</sup>*,

where *W<sup>n</sup>* and *W<sup>n</sup>* are positive-definite weight matrices. The additional restrictions *<sup>p</sup>*, *<sup>n</sup>* ≥ 0 impose that the constraints are not made more restrictive than their original settings.

With the cost function of Eq. (21) subject to the constraints of Eq. (22), the amount by which

To this end, a rule of thumb known as "Bryson's rule" (Franklin et al., 2005), (Bryson & Ho, 1969) can be used as a guideline. It states that one may use the limits of the variables as parameters to choose their weights in the cost function so that their contribution is normalized. Therefore, the weights must be chosen so that the product between the admissible range (maximum value - minimum value) and the weight is approximately the same for all variables. However, in the present case, it is desirable that deviations of the slack variables from zero are more penalized than control deviations in order to enforce the constraints when possible. Therefore, it is reasonable to choose the weights for these variables an order of

Scokaert & Rawlings (1999) discuss the inclusion of a linear term of penalization of the slack variables as means to obtain exact relaxations, i. e., the controller relaxes the constraints only when necessary. This can be achieved by tuning the weights of this term based on the Lagrange multipliers associated to the constrained minimization problem. However, an advantage of introducing terms that penalize the square of the slack variables is that the choice of a positive-definite weight matrix leads to a well-posed quadratic program, since

There are methods which relax the operating constraints, possibly according to a priority list, in order to achieve feasibility of the optimization problem. There are various techniques employing such policies, some of which resort to optimization problems parallel to the MPC optimization in order to determine the minimum relaxation that is necessary to achieve feasibility. In this line, the priority list can be explored by solving many Linear Programming (LP) problems relaxing the constraints of lower priority until feasibility is achieved or by solving a single LP problem online as proposed by Vada et al. (2001). In their work, offline computations of the weights of the slack variables that relax the constraints are performed.

each constraint is prioritized can be tuned by the choice of the weight matrices.

magnitude greater than the values obtained via Bryson's rule.

the associated Hessian is positive definite.

**3.3 Hard constraint relaxation with prioritization**

*<sup>p</sup> <sup>W</sup><sup>p</sup> <sup>p</sup>* + *<sup>T</sup>*

*<sup>p</sup>*, *<sup>n</sup>* <sup>≥</sup> <sup>0</sup> (22)

*<sup>n</sup> W<sup>n</sup> <sup>n</sup>* (21)

optimization problem. However, this issue can be circumvented by introducing a terminal constraint for the state in the form of a Maximal Output Admissible Set (MAS) (Gilbert & Tan, 1991). This problem will be tackled in section 4. For now, it is sufficient to state that there exists a finite horizon within which enforcement of the constraints leads to enforcement of the constraints over an infinite horizon, given some reasonable assumptions on the plant dynamics (Rawlings & Muske, 1993).
