You are on page 1of 17

Introduction to Model Predictive

Control (MPC)

Oscar Mauricio Agudelo Mañozca


Bart De Moor

Course :
Computergestuurde regeltechniek

ESAT - KU Leuven
May 11th, 2017
Basic Concepts
Control method for handling input and state constraints within an optimal control setting.

Principle of predictive control

  yref  y(k  i) 
2
min
u ( k ), ,u ( k  N 1)
Past Future i 1
subject to
Reference  yref  model of the process
 input constraints
Prediction of y (k )  output / state constraints
measurement

y (k ) Why to use MPC ?

u (k )  It handles multivariable interactions


time
 It handles input and state constraints
k 2 k 1 k k 1 k 2 k 3 kN
 It can push the plants to their limits
Prediction horizon
of performance.
 It is easy to explain to operators and
engineers

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 2


Some applications of MPC
Control of synthesis section of a urea plant

MPC strategies have been used for stabilizing and maximizing the throughput of the
synthesis section of a urea plant, while satisfying all the process constraints.

Urea plant of Yara at Brunsbüttel (Germany), where a MPC control system has been
set by IPCOS

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 3


Some applications of MPC
Control of synthesis section of a urea plant
Reaction 1: Fast and Exothermic

2NH3 + CO2  NH2COONH4


Carbon Ammonium
Ammonia
dioxide carbamate

Reaction 2: Slow and Endothermic

NH2COONH4  NH2CONH2 + H2O


Ammonium Urea Water
carbamate

Throughput increment of 11.81 t/h


thanks to the MPC controller
Results of a preliminary study done by

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 4


Some applications of MPC
Flood Control: The Demer

A Nonlinear MPC control strategy has been implemented (2016) for avoiding future
floodings of the Demer river in Belgium. Partners: STADIUS, Dept. Civil Engineering of KU
Leuven, IPCOS, IMDC, Antea Group, and Cofely Fabricom.

The Demer in Hasselt

Flooding events due to heavy rainfall:


1905, 1926, 1965, 1966, 1993-1994,
1995, 1998, 2002 and 2010.
The Demer and its tributaries in the south of
Control Strategy: PLC logic the province of Limburg
(e.g., three-pos controller)

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 5


Some applications of MPC
Flood Control: The Demer

DIEST

HASSELT

Flooded area during the flood event of 1998.


Control Strategy: PLC logic (e.g., three-position controller)

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 6


Some applications of MPC
Flood Control: The Demer

Upstream part of the Demer that is modelled


and controlled in a preliminary study carried
out by STADIUS

Maximal water levels for the


five reaches for the current
Notice: The MPC controller takes rain three-pos. controller and the
MPC controller together with
predictions into account! their flood levels (Flood event
2002) .

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 7


Some applications of MPC

In addition MPC, has been used


 in all sort of petrochemical and chemical plants,
 in food processing,
 in automotive industry,
 in the control of tubular chemical reactors,
 in the normalization of the blood glucose level of
critical ill patients,
 in power converters,
 for the control of power generating kites under
changing wind conditions,
 in mechatronic systems (e.g., mobile robots),
 in power generation,
 in aerospace,
 in HVAC systems (building control)
 …

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 8


Basic Concepts
Kinds of MPC

 Linear MPC : it uses a linear model of the plant x(k  1)  Ax(k )  Bu(k )
 Convex optimization problem
 Nonlinear MPC: it uses a nonlinear model of the plant x(k  1)  f  x(k ), u(k ) 
 Non-convex optimization problem

Remark: Since linear MPC includes constraints, it is a non-linear control strategy !!!

Linear MPC formulation (Classical MPC)

N N 1
min   x(k  i)  xref (k  i)  Q  x(k  i )  xref (k  i)     u(k  i)  u ref (k  i)  T R  u(k  i )  u ref (k  i ) 
T

x N ,u N
i 1 i 0

subject to
x(k  1  i)  Ax(k  i)  Bu(k  i), i  0,1, , N 1, Model of the plant

u(k  i)  umax , i  0,1, , N  1, Input constraints

x(k  i)  xmax , i  1, 2, , N, State constraints

with: x N   x(k  1); x(k  2); ; x(k  N ) , u N  u(k ); u(k  1); ; u(k  N 1)
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 9
MPC Algorithm
Typical MPC control Loop

xref (k )
u( k ) u(t )
u ref (k ) MPC ZOH Plant y (t )

xˆ (k )
Observer y (k )
Ts
Digital system
MPC Algorithm
At every sampling time:

 Read the current state of the process, x(k)


 Compute an optimal control sequence by solving the MPC optimization problem

Solution  u(k ), u(k  1), u(k  2), , u(k  N 1)

 Apply to the plant ONLY the first element of such a sequence  u(k)

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 10


LQR and Classical MPC
For simplicity, Let’s assume that the references are set to zero.

LQR CLassical Linear MPC


N N 1

min  x(k ) Q x(k )  u(k ) R u(k )
T T min  x(k ) Q x(k )   u(k ) T R u(k )
T
x N ,u N
x ,u k 1 ki 
=00
k 1

subject to subject to
x(k  1)  Ax(k )  Bu(k ), k  0,1, , N 1,
x(k  1)  Ax(k )  Bu(k ), k  0,1, ,
x(k )  xmax , k  1, 2, , N,
u(k )  umax , k  0,1, , N  1,
The optimal solution has the form: u(k )  Kx(k )
PRO PRO
 Explicit, Linear solution  Takes constraints into account
 Low online computational burden  Proactive behavior

CON CON

 Constraints are not taken into account  High online computational burden

 No predictive capacity  No explicit solution


 feasibility? Stability?

If N∞, and constraints are not considered  the MPC and LQR give the same solution

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 11


MPC optimization problem – Implementation details
The following optimization problem,

N N 1
min   x(k  i)  xref (k  i)  Q  x(k  i )  xref (k  i)     u(k  i)  u ref (k  i)  T R  u(k  i )  u ref (k  i ) 
T

x N ,u N
i 1 i 0

subject to
x(k  1  i)  Ax(k  i)  Bu(k  i), i  0,1, , N 1,
u(k  i)  umax , i  0,1, , N  1,
x(k  i)  xmax , i  1, 2, , N,

with: x N    x(k  1); x(k  2); ; x(k  N ) , u N   u(k ); u(k  1); ; u(k  N 1)
n N x n N u

can be rewritten as a LCQP (Linearly Constrained Quadratic Program) problem in x as follows:

1 T
min x Hx  f T x
x 2
with:
subject to
 xN ; u N 
N  nx  nu 
Ae x  be x 
Ai x  bi

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 12


MPC optimization problem – Implementation Details

where
N times
Q   x ref (1) 
   
   
 Q   x (N ) 
 N  nx  nu   N  nx  nu  
f  x u    H  ref
N  n  n 
H   2  
 R   u ref (0) 
   
   
 R u ref ( N  1) 
N times

 x max 
 I nx  N   
    2N times
  I nx  N   x max 
Ai 
2 N  nx  nu   N  nx  nu   2 N  nx  nu 
 bi   
I nu  N   u 
  max

 I nu  N    2N times
  
 max 
u

nx = number of states, nu = number of inputs, N = prediction horizon

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 13


MPC optimization problem – Implementation Details

 I nx N times B   Ax(k ) 
   0 
  A I nx B 
A e  x  x u     
 N n  N  n  n 
b e  N nx
  
   
  A I nx N times B   0 

nx = number of states, nu = number of inputs, N = prediction horizon

Remarks:
 The problem is convex if Q and R are positive semi-definite

 The hessian matrix H, and the matrices Ae and Ai are sparse.

 Number of optimization variables: N(nx + nu). This number can be reduced to N·nu (Condensed
form of the MPC) through elimination of the states x(k) but at the cost of sparsity !!!

Matlab function for solving the LCQP optimization problem

x_tilde = quadprog (H, f, Ai, bi , Ae, be)

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 14


MPC with terminal cost
Large Prediction Horizon

What
happens?

We have a
winner !!!

Short Prediction Horizon

What
happens?
We have an
accident !!!

N should be large enough in order to keep the process under control

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 15


MPC with terminal cost
N 1 N 1
min   x(k  i)  xref (k  i)  Q  x(k  i)  xref (k  i)     u(k  i)  u ref (k  i)  T R  u(k  i)  u ref (k  i) 
T

x N ,u N
i 1 i 0

  x(k  N )  xref (k  N )  S  x(k  N )  xref (k  N ) 


T

subject to
x(k  1  i)  Ax(k  i)  Bu(k  i), i  0,1, , N 1,
u(k  i)  umax , i  0,1, , N  1,
x(k  i)  xmax , i  1, 2, , N,

x2 (k )
Main goal of the terminal cost:
x(k  2) x(k  1)
To include the terms for which i ≥ N in the cost
function (To extend the prediction horizon to
infinity) x( k )
x(k  N )
What do we gain?
Effect of the stabilizing
control law u(k) = -Kx(k)
“Stability”

x(k  ) x1 (k )
steady-state xref (k )  0

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 16


MPC with terminal cost
How to calculate S ?
By solving the discrete-time Riccati equation,

AT SA  S  (AT SB)(BT SB  R)1 (BT SA)  Q  0

where u(k) = -Kx(k) is the stabilizing control law. K   B SB  R   B SA  .


T 1 T

How to carry out this calculation in Matlab?

[K,S] = dlqr (A, B, Q, R )

Implementation details of the MPC with terminal constraint


The only change in the LCQP is the hessian matrix
N - 1 times
Q 
 
 
 Q 
 N  nx  nu   N  nx  nu    
H   2 S 
 R 
 
 
 R 
 N times

Introduction to Model Predictive Control Course: Computergestuurde regeltechniek 17

You might also like