C. Defining the inequality constraints
Given |∆p
ref
| = |u| ≤ u
min,max
, and |∆f| = |y| ≤
y
min,max
, for y = C x,
C
−C
x(k + j|k) ≤
y
max
−y
min
I
−I
u(k + j|k) ≤
u
max
−u
min
can be written in terms of ξ and v as follows,
C
−C
| {z }
P
x
ξ(k + j|k) ≤
y
max
−y
min
| {z }
q
x
−
C
−C
| {z }
P
x
x
ss
I
−I
|{z}
P
u
v(k + j|k) ≤
u
max
−u
min
| {z }
q
u
−
I
−I
|{z}
P
u
u
ss
(7)
and using a proper deadbeat mode-2 terminal inequality
constraint to ensure a fast convergence to zero,
I
n×n
⊗
P
x
P
u
K
∞
(A + BK
∞
)
0
.
.
.
(A + BK
∞
)
N−1
| {z }
P
x
N
ξ(k + N|k)
≤ 1
n
⊗
q
x
− P
x
x
ss
q
u
− P
u
u
ss
| {z }
˜q
x
N
(8)
where K
∞
is the deadbeat mode-2 gain calculated using
Linear Quadratic Regulator (LQR) method.
D. Target equilibrium optimization under constraints (SSTO)
The offset-free equilibrium points (x
ss
, u
ss
) that satisfies
the constraints exits if only if x
ss
= Ax
ss
+ Bu
ss
+ B
d
d
and y
ss
= Cx
ss
+ D
d
d = r.
Thus, the SSTO problem is
min
{x
ss
,u
ss
}
kC x
ss
+ D
d
d − rk + ρku
ss
k (9)
subject to,
I − A −B
C 0
| {z }
A
eq
=T
x
ss
u
ss
|{z}
x
eq
=
B
d
r − D
d
d
| {z }
b
eq
P
x
0
0 P
u
| {z }
A
neq
x
ss
u
ss
|{z}
x
neq
≤
q
x
q
u
|{z}
b
neq
(10)
III. SOLVING THE LQ-MPC OPTIMIZATION
PROBLEM
The solution of the LQ-MPC problem (3) in the compress
form can written as,
min
v (k)
1
2
v
|
(k) H v(k) + ξ
|
(k) L
|
v(k) + ξ
|
(k) M ξ(k)
(11)
subject to
P
c
v(k) ≤ q
c
+ S
c
ξ(k) (12)
where H, L, M are the cost matrices given Q and
R. P
c
, q
c
, S
c
are the stacked inequality constraints for
P
x
, P
u
, P
x
N
, q
u
, q
x
, ˜q
x
N
given the predictions matrices x =
F x(k) + Gu(k), [1]. Note that the prediction matrices are
constructed using the states and input without the tracking
model.
The solution of (11) is the optimal control input sequence,
v
∗
= {v
∗
(k|k), v
∗
(k + 1|k), . . . , v
∗
(k + N − 1|k)}
which can be solved numerically.
Because MPC uses the receding-horizon principle, only
the first optimized control input is needed
v(k) = v
∗
(k|k) = K
N
(ξ(k))
but the real control input applied to the system is
u(k) = u
ss
+ v
∗
(k|k) (13)
A. Stability
In order to ensure stability it is necessary to compute a
terminal cost matrix P that satisfies the Lyapunov equation
(A + B K)
|
P (A + B K) − P + (Q + K
|
R K) = 0 (14)
which solution can be computed numerically. A good ap-
proach is to use a deadbeat mode-2 control gain K that
converges the states to the origin x = 0 as long as (A+BK)
is stable, which means that the eigenvalues λ are inside the
unit circle |λ| < 1.
IV. ALGORITHM FOR THE IMPLEMENTATION
Now that the solution of the LQ-MPC is established and
the stability can be guaranteed, there are basic conditions to
meet such as,
• (A, B) is stabilizable which can be proved by the
controllability, in Matlab rank(ctrb(A,B)).
• Q 0, can be C
|
C
• R 0, changed later for tuning.
The following steps reflect the Matlab implementation
algorithm
Off-line mode:
1. Discretization of the model (1) using
zero holder (zoh), in Matlab will be
sys=c2d(idss(Ac,Bc,C,D,Bd,x0,0),Ts),
where T
s
is the sampling time.
2. Construct the target equilibrium constraints (10)
3. Define the optimization equation as z=[xss;uss]
and fun=@(z) C(1)
*
z(1)+Dd
*
d-r+rho
*
z(4)
4. Solve the optimization problem for SSTO using
f=fmincon(fun,z0,Aneq,bneq,Aeq,beq) in
Matlab, where z0=[r,0,0,0], fun is (9), and
f=[xss,uss] is the optimized vector solution.
5. Construct the LQ-MPC inequality constraints (11), and
compute the deadbeat mode-2 terminal constraint using
K=-dlqr(A,B,Q,R).