Introduction to Model Predictive Control (MPC) Oscar Mauricio - - PowerPoint PPT Presentation
Introduction to Model Predictive Control (MPC) Oscar Mauricio - - PowerPoint PPT Presentation
Introduction to Model Predictive Control (MPC) Oscar Mauricio Agudelo Maozca Bart De Moor Course : Computergestuurde regeltechniek ESAT - KU Leuven May 11th, 2017 Basic Concepts Control method for handling input and state constraints
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
2
Basic Concepts
Control method for handling input and state constraints within an optimal control setting.
- It handles multivariable interactions
- It handles input and state constraints
- It can push the plants to their limits
- f performance.
- It is easy to explain to operators and
engineers
Principle of predictive control
1 k 2 k 3 k
Prediction horizon
k N k 1 k 2 k
( ) u k ( ) y k
Prediction of
( ) y k
Reference
Future Past
measurement
ref
y
2 ref ( ), , ( 1) 1
min ( )
N u k u k N i
y y k i
subject to
- model of the process
- input constraints
- output / state constraints
Why to use MPC ?
time
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
3
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
4
Some applications of MPC
Control of synthesis section of a urea plant
Results of a preliminary study done by
Throughput increment of 11.81 t/h thanks to the MPC controller
2NH3 + CO2 NH2COONH4
Ammonia Carbon dioxide Ammonium carbamate
Reaction 1: Fast and Exothermic
NH2COONH4 NH2CONH2 + H2O
Ammonium carbamate Urea Water
Reaction 2: Slow and Endothermic
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
5
Some applications of MPC
Flood Control: The Demer
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 the province of Limburg Control Strategy: PLC logic (e.g., three-pos controller) 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.
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
6
Some applications of MPC
Flood Control: The Demer
Flooded area during the flood event of 1998. Control Strategy: PLC logic (e.g., three-position controller)
DIEST HASSELT
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
7
Some applications of MPC
Flood Control: The Demer
Upstream part of the Demer that is modelled and controlled in a preliminary study carried
- ut by STADIUS
Maximal water levels for the five reaches for the current three-pos. controller and the MPC controller together with their flood levels (Flood event 2002) .
Notice: The MPC controller takes rain predictions into account!
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
8
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
Basic Concepts
9
Kinds of MPC
- Linear MPC : it uses a linear model of the plant
Convex optimization problem
- Nonlinear MPC: it uses a nonlinear model of the plant
Non-convex optimization problem
( 1) ( ) ( ) k k k x Ax Bu
( 1) ( ), ( ) k k k x f x u
Linear MPC formulation (Classical MPC)
Remark: Since linear MPC includes constraints, it is a non-linear control strategy !!!
1 ref re ref ref 1 f ,
( ) ( ) min ( ) ( ) ( ( ( ) ) ( ) )
N N
N N T i i T
k i k i k i k k i k i k i k i i
x u
x x Q x x u u R u u
subject to
( 1 ) ( ) ( ), 0,1, , 1, k i k i k i i N x Ax Bu
max
( ) , 0,1, , 1, k i i N u u
max
( ) , 1,2, , , k i i N x x
Model of the plant Input constraints State constraints
( 1); ( 2); ; ( ) ,
N
k k k N x x x x
( ); ( 1); ; ( 1)
N
k k k N u u u u
with:
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
MPC Algorithm
10
Typical MPC control Loop MPC Algorithm
At every sampling time:
MPC Plant Observer
( ) k u ( ) k y ˆ( ) k x
ref ( )
k x
ref ( )
k u
ZOH
( ) t u ( ) t y
s
T
Digital system
- Read the current state of the process, x(k)
- Compute an optimal control sequence by solving the MPC optimization problem
- Apply to the plant ONLY the first element of such a sequence u(k)
( ), ( 1), ( 2), , ( 1) k k k k N u u u u
Solution
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
LQR and Classical MPC
11 For simplicity, Let’s assume that the references are set to zero.
LQR CLassical Linear MPC
, 1
( ) min ( ) ( ( ) )
T T k
k k k k
x u
x Q R u x u
subject to
( 1) ( ) ( ), 0,1, , k k k k x Ax Bu
subject to
( 1) ( ) ( ), 0,1, , 1, k k k k N x Ax Bu
max
( ) , 0,1, , 1, k k N u u
max
( ) , 1,2, , , k k N x x
- Constraints are not taken into account
- No predictive capacity
The optimal solution has the form:
( ) ( ) k k u Kx
PRO
- Explicit, Linear solution
- Low online computational burden
CON PRO
- Takes constraints into account
- Proactive behavior
CON
- High online computational burden
- No explicit solution
- feasibility? Stability?
If N∞, and constraints are not considered the MPC and LQR give the same solution
1 , 1
( ) ( min ( ) ( ) )
N N
N T i k N T
k k k k
x u
u R u x Q x
k = 0
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
MPC optimization problem – Implementation details
12
The following optimization problem, can be rewritten as a LCQP (Linearly Constrained Quadratic Program) problem in as follows:
1 ref re ref ref 1 f ,
( ) ( ) min ( ) ( ) ( ( ( ) ) ( ) )
N N
N N T i i T
k i k i k i k k i k i k i k i i
x u
x x Q x x u u R u u
subject to
( 1 ) ( ) ( ), 0,1, , 1, k i k i k i i N x Ax Bu
max
( ) , 0,1, , 1, k i i N u u
max
( ) , 1,2, , , k i i N x x
with:
( 1); ( 2); ; ( ) ,
x
n N N
k k k N
x x x x
( ); ( 1); ; ( 1)
u
n N N
k k k N
u u u u
x
1 min 2
T T
x
x Hx f x
subject to
e e
A x b
i i
A x b
with:
;
x u
N n n N N
x x u
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
MPC optimization problem – Implementation Details
13
where
2
x u x u
N n n N n n
Q Q H R R
ref ref ref ref
(1) ( ) (0) ( 1)
x u
N n n
N N
x x f H u u
2 i
x x x u x u u u
n N n N N n n N n n n N n N
I I A I I
max 2 max i max max
x u
N n n
x x b u u
N times N times 2N times 2N times
nx = number of states, nu = number of inputs, N = prediction horizon
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
MPC optimization problem – Implementation Details
14
e
x x x x u x
n n N n N n n n
I B A I B A A I B
e
( )
x
N n
k
Ax b
N times N times
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
MPC with terminal cost
15
Short Prediction Horizon Large Prediction Horizon
N
What happens? We have a winner !!!
N
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
MPC with terminal cost
16
1 ref ref ref ref , 1 1
min ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
N N
N T T i N i
k i k i k i k i k i k i k i k i
x u
x x Q x x u u R u u
subject to
( 1 ) ( ) ( ), 0,1, , 1, k i k i k i i N x Ax Bu
max
( ) , 0,1, , 1, k i i N u u
max
( ) , 1,2, , , k i i N x x
ref ref
( ) ( ) ( ) ( )
T
k N k N k N k N x x S x x
Main goal of the terminal cost: What do we gain?
To include the terms for which i ≥ N in the cost function (To extend the prediction horizon to infinity)
“Stability”
( 1) k x ( 2) k x ( ) k N x
Effect of the stabilizing control law u(k) = -Kx(k)
1( )
x k
2( )
x k
ref ( )
k x ( ) k x ( ) k x
steady-state
Introduction to Model Predictive Control Course: Computergestuurde regeltechniek
MPC with terminal cost
17
How to calculate S ?
By solving the discrete-time Riccati equation,
How to carry out this calculation in Matlab?
1
( )( ) ( )
T T T T
A SA S A SB B SB R B SA Q
where u(k) = -Kx(k) is the stabilizing control law.
1
.
T T
K B SB R B SA
[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
2
x u x u
N n n N n n
Q Q H S R R N - 1 times N times