C21 Model Predictive Control
Mark Cannon 4 lectures Hilary Term 2016 0 - 1 Lecture 1Introduction
Organisation
B 4 lectures: week 3 Monday 10-11 am LR5 Thursday 10-11 am LR5 week 4 Monday 10-11 am LR5Thursday 4-5 pm LR2 (place/time changed)
B 1 example sheet
B 1 class (for 2 groups) by end of week 5
1 - 3
Course outline
1. Introduction to MPC and constrained control
2. Prediction and optimization
3. Closed loop properties
4. Disturbances and integral action
Books
1 B. Kouvaritakis and M. Cannon, Model Predictive Control:
Classical, Robust and Stochastic, Springer 2015
Recommended reading: Chap. 1, 2 & 3
2 J.B. Rawlings and D.Q. Mayne, Model Predictive Control: Theory
and Design. Nob Hill Publishing, 2009
3 J.M. Maciejowski, Predictive control with constraints. Prentice Hall,
2002
Recommended reading: Chap. 1–3, 6 & 8
1 - 5
Introduction
Classical controller design:
1. Determine plant model
2. Design controller (e.g. PID)
3. Apply controller
Model predictive control (MPC):
1. Use model to predict system behaviour
2. Choose optimal trajectory
3. Repeat procedure (feedback)
discard model xk+1
= f(xk, u
k)
↓
Overview of MPC
Model predictive control strategy:
1. Prediction
2. Online optimization
3. Receding horizon implementation
1. Prediction
? Plant model: xk+1 = f (xk, uk)
? Simulate forward in time (over a prediction horizon of N steps)
input sequence: uk = u0|k u1|k .. . uN −1|k defines −−−−→ state sequence: xk = x1|k x2|k .. . xN |k
Notation: (ui|k, xi|k) = predicted i steps ahead | evaluated at time k
1 - 7
Overview of MPC
2. Optimization
? Predicted quality criterion/cost: Jk = N X
i=0
li(xi|k, ui|k)
li(x, u): stage cost
? Solve numerically to determine optimal input sequence: u∗k = arg min
uk Jk
3. Implementation
? Use first element of u∗k =⇒ actual plant input uk = u∗k|k
Overview of MPC
time prediction horizon at time
prediction horizon at time
time u x k k + 1 k k + 1 k + N k + N + 1 1 - 9
Overview of MPC
Optimization is repeated online at each sampling instant k = 0, 1, . . .
⇓ receding horizon: uk = (u0|k, . . . , uN −1|k) xk = (x1|k, . . . , xN |k) uk+1 = (u1|k+1, . . . , uN |k) xk+1 = (x2|k, . . . , xN +1|k) .. . ...
? This provides feedback
→ so reduces effects of model error and measurement noise
? and compensates for finite number of free variables in predictions
Example
Plant model: xk+1 = 1.1 2 0 0.95 xk + 0 0.0787 uk yk = −1 1xk Cost: N −1 X i=0 (yi|k2 + u2i|k) + y2N |k Prediction horizon: N = 3Free variables in predictions: uk = u0|k u1|k u2|k 1 - 11
Example
0 1 2 3 4 5 6 7 8 9 10 input -4 -2 0 2 4 6 predicted at k=0 closed loop sample 0 1 2 3 4 5 6 7 8 9 10 output -1 -0.5 0 0.5 1Motivation for MPC
Advantages
B Flexible plant model
e.g. multivariable linear or nonlinear
deterministic, stochastic or fuzzy
B Handles constraints on control inputs and states
e.g. actuator limits
safety, environmental and economic constraints
B Approximately optimal control
Disadvantages
B Requires online optimization
e.g. large computation for nonlinear and uncertain systems
1 - 13
Historical development
Control strategy reinvented several times
LQ(G) optimal control 1950’s–1980’s
industrial process control 1980’s
constrained nonlinear control 1990’s–today
Development of commercial MPC algorithms:
In recent years the MPC landscape has changed drastically, with a large increase in the number of reported applications, significant improvements in technical capability, and mergers between several of the vendor companies. The primary purpose of this paper is to present an updated, representative snapshot of commercially available MPC technology. The in-formation reported here was collected from vendors starting in mid-1999, reflecting the status of MPC practice just prior to the new millennium, roughly 25 years after the first applications.
A brief history of MPC technology development is presented first, followed by the results of our industrial survey. Significant features of each offering are outlined and discussed. MPC applications to date by each vendor are then summarized by application area. The final section presents a view of next-generation MPC technology, emphasizing potential business and research opportunities.
2. A brief history of industrial MPC
This section presents an abbreviated history of industrial MPC technology.Fig. 1shows an evolution-ary tree for the most significant industrial MPC algorithms, illustrating their connections in a concise way. Control algorithms are emphasized here because relatively little information is available on the develop-ment of industrial identification technology. The follow-ing sub-sections describe key algorithms on the MPC evolutionary tree.
2.1. LQG
The development of modern control concepts can be traced to the work of Kalman et al. in the early 1960s (Kalman, 1960a, b). A greatly simplified description of their results will be presented here as a reference point for the discussion to come. In the discrete-time context,
the process considered by Kalman and co-workers can be described by a discrete-time, linear state-space model: xkþ1¼ Axkþ Bukþ Gwk; ð1aÞ
yk¼ Cxkþ nk: ð1bÞ
The vector u represents process inputs, or manipulated variables, and vector y describes measured process outputs. The vector x represents process states to be controlled. The state disturbance wk and measurement
noise nk are independent Gaussian noise with zero
mean. The initial state x0 is assumed to be Gaussian
with non-zero mean.
The objective function F to be minimized penalizes expected values of squared input and state deviations from the origin and includes separate state and input weight matrices Q and R to allow for tuning trade-offs:
F ¼ EðJÞ; J ¼X
N j¼1
ðjjxkþjjj2Qþ jjukþjjj2RÞ: ð2Þ
The norm terms in the objective function are defined as follows:
jjxjj2
Q¼ xTQx: ð3Þ
Implicit in this formulation is the assumption that all variables are written in terms of deviations from a desired steady state. It was found that the solution to this problem, known as the linear quadratic Gaussian (LQG) controller, involves two separate steps. At time interval k; the output measurement yk is first used to
obtain an optimal state estimate #xkjk:
#
xkjk%1¼ A#xk%1jk%1þ Buk%1; ð4aÞ
#
xkjk¼ #xkjk%1þ Kfðyk% C#xkjk%1Þ: ð4bÞ
Then the optimal input ukis computed using an optimal
proportional state controller:
uk¼ %Kcx#kjk: ð5Þ LQG IDCOM-M HIECON SMCA PCT PFC IDCOM SMOC Connoisseur DMC DMC+ QDMC RMPC RMPCT 1960 1970 1980 1990 2000 1st generation MPC 2nd generation MPC 3rd generation MPC 4th generation MPC
Fig. 1. Approximate genealogy of linear MPC algorithms. S.J. Qin, T.A. Badgwell / Control Engineering Practice 11 (2003) 733–764 734
Applications: Process Control
Steel hot rolling mill
Inputs: Outputs: G, H, ✓, ! , t G G H t ✓ !
Objectives: control residual stress σ
and thickness t Characteristics: ? MIMO ? Constraints ? Delays 1 - 15
Applications: Chemical Process Control
Applications of predictive control to more than 4,500 different chemical processes (based on a 2006 survey)
MPC applications in the chemical industry
[from Nagy, 2006]
Characteristics: ? area-wide
Applications: Electromechanical systems
Variable-pitch wind turbines Characteristics:
? stochastic uncertainty
? fatigue
constraints
1 - 17
Applications: Electromechanical systems
Predictive swing-up and balancing controllers
Autonomous racing for remote controlled cars
Characteristics:
? reference tracking
Prediction model
Linear plant model: xk+1 = Axk + Buk
B Predicted xk depends linearly on uk [details in Lecture 2]
B Therefore the cost is quadratic in uk uTkHuk + 2fTuk + g(xk) and constraints are linear Acuk ≤ b(xk)
B Online optimization:
min
u u
THu + 2fTu s.t. A
cu ≤ bc
is a convex Quadratic Program (QP), which is reliably and efficiently solvable
1 - 19
Prediction model
Nonlinear plant model: xk+1 = f (xk, uk)
B Predicted xk depends nonlinearly on uk
B In general the cost is nonconvex in uk Jk(xk, uk)
and the constraints are nonconvex gc(xk, uk) ≤ 0
B Online optimization:
min
u Jk(xk, u) s.t. gc(xk, u) ≤ 0
is nonconvex
may have local minima
Prediction model
Discrete time prediction model
B Predictions optimized periodically at t = 0, T, 2T, . . .
B Usually T = Ts = sampling interval of model
B But T = nTs for n > 1 is also possible, e.g. if Ts < time required to perform online optimization
n = integer so a time-shifted version of the optimal input sequence at time k can be implemented at time k + 1
(allows a guarantee of stability – [Lecture 3])
e.g. if n = 1, then uk+1 = (u1|k, . . . ,uN −1|k, uN |k) is possible, where (u0|k,u1|k, . . . ,uN −1|k) = u∗k
1 - 21
Prediction model
Continuous time prediction model
B Predicted u(t) need not be piecewise constant,
e.g. 1st order hold gives continuous, piecewise linear u(t) or u(t) = polynomial in t (piecewise quadratic, cubic etc)
B Continuous time prediction model can be integrated online,
which is useful for nonlinear continuous time systems
Constraints
Constraints are present in almost all control problems
B Input constraints, e.g. box constraints:
u ≤ uk ≤ u (absolute)
∆u ≤ uk − uk−1 ≤ ∆u (rate)
? typically active during transients, e.g. valve saturation
or d.c. motor saturation
B State constraints, e.g. box constraints
x ≤ xk ≤ x (linear)
? can be active during transients, e.g. aircraft stall speed
? and in steady state, e.g. economic constraints
1 - 23
Constraints
Classify constraints as either hard or soft
B Hard constraints must be satisfied at all times, if this is not possible, then the problem is infeasible
B Soft constraints can be violated to avoid infeasibility
B Strategies for handling soft constraints:
? impose (hard) constraints on the probability of violating each soft constraint
? or remove active constraints until the problem becomes feasible
Constraint handling
Suboptimal methods for handling input constraints:
(a). Saturate the unconstrained control law
constraints are then usually ignored in controller design
(b). “De-tune” the unconstrained control law
increase the penalty on u in the performance objective
(c). Use an anti-windup strategy
to put limits on the state of a dynamic controller (typically the integral term of a PI or PID controller)
1 - 25
Constraint handling
Effects of input saturation, u ≤ uk ≤ u
unconstrained control law: u = u0
saturated control law: u = maxmin{u0, u}, u
Example:
(A, B, C) as before u = −1, u = 1 u0 = KLQx Input saturation causes
? poor performance
? possible instability (since the open-loop system is unstable) 0 5 10 15 20 25 30 35 40 −2 0 2 4 6 8 u 0 5 10 15 20 25 30 35 40 −4 −2 0 2 4 6 y sample saturated lqr unconstrained lqr
Constraint handling
De-tuning of optimal control law:
KLQ = optimal gain for LQ cost J∞ =
∞
X
k=0
kxkk2Q + kukk2R
Increase R until u = KLQx satisfies constraints for all initial conditions
Example:
(A, B, C) as before
10−2 ≤ R ≤ 103
⇓
settling time increased from 6 to 40
? y(t) → 0 slowly
? stability can be ensured
0 10 20 30 40 50 60 −2 0 2 4 6 y sample 0 10 20 30 40 50 60 −2 0 2 4 6 8 u lqr, R=1000 lqr, R=0.01 1 - 27
Constraint handling
Anti-windup prevents instability of the controller while the input is
saturated
Many possible approaches, e.g. anti-windup PI controller:
u = maxmin{(Ke + v), u}, u Ti˙v + v = u ⇓ u ≤ u ≤ u =⇒ u = Ke + 1 Ti Z t e dt u = u or u =⇒ v(t) → u or u exponentially
Constraint handling
Anti-windup is based in the past behaviour of the system, whereas MPC optimizes future performance
Example:
(A, B, C) as before
MPC vs saturated LQ (both based on cost J∞):
? settling time reduced to 20 by MPC ? stability is guaranteed with MPC 0 5 10 15 20 25 30 35 40 −1 0 1 2 3 u 0 5 10 15 20 25 30 35 40 −4 −2 0 2 4 6 y sample mpc, N=16 saturated lqr 1 - 29
Summary
B Predict performance using plant model
e.g. linear or nonlinear, discrete or continuous time
B Optimize future (open loop) control sequence
computationally much easier than optimizing over feedback laws
B Implement first sample, then repeat optimization
provides feedback to reduce effect of uncertainty
B Comparison of common methods of handling constraints: