Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Copyright
Vol. 31, No. 2, July, 2012, pp. 139148.
2012 Faculty of Engineering,
University of Nigeria. ISSN 1115-8443
P.E. Orukpe
a Department of Electrical/Electronic Engineering, University of Benin, Nigeria.
Email: patience.orukpe01@imperial.ac.uk
Abstract
Model Predictive Control (MPC) has developed considerably over the last two decades, both within
the research control community and in industries. MPC strategy involves the optimization of a
performance index with respect to some future control sequence, using predictions of the output
signal based on a process model, coping with constraints on inputs and outputs/states. In this
paper, we will present an introduction to the theory and application of MPC with Matlab codes
written to simulate an example of a randomly generated system. This paper can serve as tutorial
to anyone interested in this area of research.
Keywords: model predictive control, linear systems, discrete-time systems, constraints, quadratic programming
Step 3: Only the current control signal u(t|t) is coincidence points i.e. one must have a simulation
transmitted to the process. At the next sampling in- model capable of running faster than real time.
stant y(t + 1) is measured and step 1 is repeated and Model of the plant in state space is of the form
all sequences brought up to date. Thus u(t + 1|t + 1)
is then calculated using the receding horizon concept, x(k + 1) = Ax(k) + Bu(k) (1)
since the prediction horizon remains of the length as
before, but slides along by one sampling interval at y(k) = Cy x(k) (2)
each step. z(k) = Cz x(k) (3)
With the aid of increase speed in computer hard-
n l my mz
ware MPC can now be applied to fast processes in- where x R , u R , y R , z R
stead of the confinement to slow processes. MPC can x is the state vector, u is the input vector, y is the
be tuned easily apart from the fact that it handles measured outputs and z is the vector of outputs which
constraints properly. Constraints can be either on the are to be controlled, either to particular set-points, or
output of the controlled processes (control variable) to satisfy some constraints, or both.
or on the control signals that is inputs to the process The type of system model used in this paper can be
(manipulated variables). These constraints are in the of the following types:
form of saturation characteristics e.g. valves with a fi-
Linear model, nonlinear plant The plant in re-
nite range of adjustment, control surface with limited
ality behaves in some complicated nonlinear fash-
deflection angles etc. Input constraints also appear in
ion.
the form of rate constraints: valves and other actua-
tors with limited slew rates. First principles model and identification The
linearized model (1) (3) used in predictive con-
trol can be obtained by performing test on the
3. Problem Formulation
plant, which involves injecting known signals,
such as steps, multi-sines, pseudo random, at the
In this section, we describe the type of system model
plant inputs, and recording the resulting outputs.
used in this work, and give a brief formulation of the
Linearized models can then be obtained by us-
MPC problem. In this work a different method of
ing the techniques of system identification, which
formulation is used as opposed to that used in [11].
range from simple curve-fitting to sophisticated
statistically based methods. A model in which
3.1. State space model the equations are obtained from a knowledge of
MPC can be used on any model, all that is needed the underlying physical, chemical and thermody-
to know is the step response at the coincidence points namic processes is available in nonlinear model
and to be able to compute the free response at the of the plant. This is done for the purpose of
Figure 2: Model predictive control strategy.
operator training or safety certification. This is where = current error and s = set-point.
done by applying perturbations to the nonlinear
Hp
model, and estimating the Jacobian matrices nu- X
V (k) = z (k + i \ k) r(k + i \ k)||2Q(i)
||b
merically. Another very effective way is to use the
i=Hw
nonlinear model to generate simulation data for (4)
u 1
HX
particular conditions, and then to apply system
+ u(k + i \ k)||2R(i)
||b
identification techniques to this data, as if it has
i=0
been obtained from the plant itself [7].
Hp - prediction horizon, Hu - control horizon and Hw
- window parameter and is assumed to be one, Hu
3.2. A basic formulation Hp , bu(k + i \ k) = 0 for i = Hu , thus u
b(k + i \ k) =
b(k + Hu 1) for all i Hu .
u
A formulation is done on the assumption that the The form of the cost function (4) implies that the
plant model is linear, time invariant, the cost function error vector zb(k+i\k)r(k+i\k) is penalized at every
is quadratic and the constraints are in the form of lin- point in the prediction horizon, in the range Hw
ear inequalities. The cost function does not penalize i Hp . This is indeed the most common situation in
particular values of the input vector u(k), but only predictive control.
changes of the input vector u(k). The tuning parameters Hp , Hu , Hw , Q(i) and R(i)
affects the behaviour of the closed-loop combination of
the plant and predictive controller, which are adjusted
3.2.1. Cost function
to give satisfactory dynamic performance.
The cost function V penalizes deviations of the pre-
dicted control outputs zb(k + i \ k) from a (vector) ref- 3.2.2. Constraints and MPC
erence trajectory rb(k + i \ k). One of the major selling points of MPC is its abil-
The reference trajectory defines an important as- ity to do on-line constraint handling in a systematic
pect of closed-loop behaviour of a controlled plant way, hopefully retaining to some extent the stability
and it is frequently assumed that the reference trajec- margins and performance of the unconstrained law.
tory approaches the set-point exponentially from the The algorithm does this by optimizing predicted per-
current output value, with the time constant of the formance subject to constraint satisfaction. There are
exponential, which shall be denoted Tref . Sampling various types of constraints on input, output or state,
interval is denoted as Ts . namely:
3.3. Predictions ..
.
To solve the MPC problem, we must have a way b(k+Hu 1\k) = b
u u(k+Hu 1\k)+. . .+b u(k\k)+u(k1)
of computing the predicted values of the control vari- (15)
ables, zb(k + i \ k) from our best estimate of the cur- Substituting (13) (15) into (8) (12) and rearrang-
rent state xb(k \ k), and the assumed future inputs, or ing, we obtain the following matrix-vector form:
equivalently, the latest input u(k1) and the assumed
B
b(k + 1 \ k) A
x
future input changes, b u(k + i \ k). The choice of .. .. ..
prediction is another tuning parameter, it has great .
. .
H 1
Ai B
P u
AHu
effect on the performance of the closed-loop system. b(k + Hu \ k)
x
i=0
=
x(k) +
Hu iB
u(k 1)
AHu +1
P
b(k + Hu 1 \ k)
x A
The prediction of any system can be done base on
i=0
.. .. .
the following:
.
..
.
PHp 1 i
b(k + Hp \ k)
x AHp AB
i=0
1. No disturbance, full state measurement. In which | {z }
past
(1) (3) are iterated
B 0
AB + B 0
2. Using an observer. In this case the state of the
.. .. ..
plant is unknown i.e. one cannot measure the full
. . .
bu(k \ k)
=
.. .. .
.
. . . . b(k + 1 \ k)
z Cz 0
AHu
zb(k + Hp \ k) 0 Cz b(k + Hp \ k)
x
. = ..
.. .
x(k)
. . . A u +1
H
. . .
(17) b(k + Hp \ k)
z 0 Cz
.
.
.
AHp
Table 1: Dimensions of matrices and vectors involved in com- B
puting the optimal moves, (plant has l inputs, n states and m .
.
.
controlled outputs). Cz 0
PHu 1 i
. .. . i=0 A B
+ u(k 1)
.. . Hu i
P
. . i=0 A B
Matrix Dimensions
0 Cz .
Q m(Hp Hw + 1) m(Hp Hw + 1)
.
.
R lHu lHu PHp 1 i
A B
i=0
m(Hp Hw + 1) n
B 0
m(Hp Hw + 1) AB + B 0
m(Hp Hw + 1) lHu
. .
. .. .
m(Hp Hw + 1) 1 Cz 0
. . .
G lHu 1 . .. . Hu 1
Ai B
P
+ . . i=0 B
. . .
H
PHu i
lHu lHu
i=0 A B AB + B
0 Cz
. .
. .
. .
PHp 1 i PHp Hu i
i=0 A B i=0 A B
bu(k \ k)
.
.
.
4. Solving Predictive Control Problems
u(k + Hu 1 \ k)
b
(20)
In this section, we outline the solution of MPC prob-
lem for the unconstrained and constrained cases. Equation (20) implies that
Z(k) = x(k) + u(k 1) + U (k) (21)
4.1. Unconstrained problems defining
In this section, we will look at measured state, no (k) = T (k) x(k) u(k 1) (22)
disturbances. The cost function to be minimized is Making T the subject of the formula in (22) and
Hp subtracting it from (21) gives
X
V (k) = z (k + i \ k) r(k + i \ k)||2Q(i)
||b Z(k) T (k) = U (k) (k)
i=Hw
(18) Thus equation (19) is now in the form of
u 1
HX
+ ||b
u(k + i \ k)||2R(i) V (k) = ||U (k) (k)||2Q + ||U (k)||2R (23)
i=0 T T T T
= [U (k) (k) ]Q[U (k)(k)]+U (k) RU (k)
(24)
This is rewritten as
= (k)T Q(k)2U (k)T T Q(k)+U (k)T (T Q+R)U (k)
V (k) = ||Z(k) T (k)||2Q + ||U (k)||2R (19) (25)
Equation (25) implies
where
V (k) = constant U (k)T G + U (k)T HU (k)
zb(k + Hw \ k) rb(k + Hw \ k)
where G = 2T Q(k) and H = T Q + R which does
.. ..
Z(k) = ; T (k) = ; not depend on U (k).
. .
zb(k + Hp \ k) rb(k + Hp \ k) To get the optimal of U (k), we find the gradient
of V (k) and set it to zero, so that the optimal is
u(k \ k)
b U (k)opt = 0.5H1 G
U (k) =
..
.
If the number of plant inputs is l, then we just use
u(k + Hu 1 \ k)
b the first l rows of the vector U (k)opt which is repre-
and the weighting matrices Q and R are given as sented as
U (k)opt = [Il 0l 0l ]H1 T (k) (26)
Q(Hw ) 0 R(0) 0
Q=
.
. .. .
.
; R =
.
. .. .
.
The only part of the solution which changes from time
. . . . . .
0 Q(Hp ) 0 R(Hu 1) to time is the tracking error (k).
Figure 3: Cost function for unconstrained case.
!! !!
!
Figure 4: States for unconstrained case.
!!
!
Figure 5: Cost function for the constrained case.
!! #
!
!
Figure 6: States for the constrained case.
#
!
!