Professional Documents
Culture Documents
The MPC problem to solve is given as,
/ /
1
2 2
/ /
F 0
1
. (10.( ) 5. )
2
min
t t t k t
t k t t k t
F k
J s r F
+
+ +
=
= +
`
)
Subject to,
| |
1
1
1 0 0.02
1 1 0.01
0 1
1.5 2.5
3 8
t t
t
t t
t
t
t
v v
F
s s
v
s
s
F
s
+
+
( ( ( (
= +
( ( ( (
(
=
(
s s
s s
We have to minimize it in the form of ,
1
J =
2
Subject to,
LU c
min
T T
U
U HU U f +
s
In our problem the vector U represents the variable that can be changed to minimize the cost
function and
/
/
t t
t k t
F
U
F
+
(
=
(
Calculating the prediction of our system, where N=1,
| |
| |
| |
/
/
/
1/ /
/
1/ /
/
/ 1/
/
0 1
1 0 0.02
0 1
1 1 0.01
0.02
1 1 0.
0.01
t t
t t
t t
t t t t
t t
t t t t
t t
t t t t
t t
v
s
s
v v
F
s s
v
F F
s
+
+
+
(
=
(
( ( ( (
= +
`
( ( ( (
)
( (
= + +
( (
The matrix form of the above equations is as follows,
/ / /
1/ / 1/
0 1 0 0
1 1 0.01 0
t t t t t t
t t t t t t
s v F
s s F
+ +
( ( ( ( (
= +
( ( ( ( (
Calculating the cost function in the form of matrices,
2 2
/ /
0 1/ 1/
1
. . .
2
N
t t t t
k t t t t
s F r
J q p
s r F
= + +
| | | | ( ( (
= +
| |
( ( (
\ . \ .
Making the above cost function into the form of ,
1
J =
2
T T
U QU U PU +
The matrices Q and P should be the order of (nxn)
The cost function then can be written as ,
/ / / /
1/ 1/ 1/ 1/
10 0 5 0
1
. . .
0 10 0 5 2
T
t t t t t t t t
t t t t t t t t
s s F F r r
J
s r s r F F
+ + + +
| | | | | | ( ( ( ( ( ( ( (
= +
| | | ` ( ( ( ( ( ( ( (
\ . \ . \ .
)
We solve the above cost function so that it depends on the input and the output values only,
Substituting the matrix
/ / /
1/ / 1/
0 1 0 0
1 1 0.01 0
t t t t t t
t t t t t t
s v F
s s F
+ +
( ( ( ( (
= +
( ( ( ( (
in the above cost function
we get,
/ / / /
/ 1/ / 1/
/
1/
0 1 0 0 10 0 0 1 0 0
1
. .
1 1 0.01 0 0 10 1 1 0.01 0 2
5 0
0 5
T
t t t t t t t t
t t t t t t t t
t t
t t
v F v F r r
J
s F r s F r
F
F
+ +
+
| | | | ( ( ( ( ( ( ( ( ( ( (
= + +
| | `
( ( ( ( ( ( ( ( ( ( (
\ . \ .
)
( (
+
( (
/
1/
.
t t
t t
F
F
+
| | (
|
(
\ .
This equation of the cost function we write as below for simplicity in calculations,
/ / / /
/ 1/ / 1/
/ /
1/ 1/
1
. .
2
. ....eq(X)
,
0 1 0 0
, B=
1 1 0.01 0
T
t t t t t t t t
t t t t t t t t
t t t t
t t t t
v F v F
J A B R Q A B R
s F s F
F F
P
F F
where
A
+ +
+ +
| | | | ( ( ( (
= + +
| | `
( ( ( (
\ . \ .
)
| | ( (
+
|
( (
\ .
( (
=
( (
10 0 5 0
R= , Q= , P=
0 10 0 5
r
r
( ( (
( ( (
To get the value of H we need to simplify the matrix function form into the following form,
/ / /
1/ 1/ 1/
1
min
2
or can be written as,
1
min . . .
2
T T
U
T T
t t t t t t
U
t t t t t t
J U HU U f
F F F
J H f
F F F
+ + +
| |
= +
|
\ .
| |
( ( (
| = +
( ( (
|
\ .
From the previous cost function equation, eq(X) taking the variables associated with
/
1/
T
t t
t t
F
F
+
(
(
and
/
1/
t t
t t
F
F
+
(
(
we get,
/ / / /
1/ 1/ 1/ 1/
1
2
T T
t t t t t t t t T
t t t t t t t t
F F F F
H B QB P
F F F F
+ + + +
( ( ( (
( +
( ( ( (
On comparison,
T
H B QB P ( = +
, now substituting the values of B,Q and P we get H as,
5.001 0
0 5
H
(
=
(
Now the other part of the remaining terms in equation eq(X), are taken for finding f,
/
1/
/
/
/
/
[ ]
subsituting the values of the matrices ,
0 0 10 0 0 1 0 0.1
f=
0.01 0 0 10 1 1 0 0
0.1 0.1 0 0.1
0 0 0 0
T
t t T T
t t
T
t t
t t
t t
t t
F
f B QA B QR
F
v r
s r
v r
f
s r
+
(
=
(
( ( ( ( ( (
( ( ( ( ( (
( ( ( (
=
( ( ( (
Numerical values of can be found by getting values of v and s, at the time instant t and some
reference value. The f depends on the v, s and the reference r.
Now coming to the point of solving the L and c for constrained values,
Given constraints are,
1.5 2.5
3 8
F
s
s s
s s
For the force and the s vector the maximum and the minimum values are the given for any time
t,
/
1/
1.5 2.5
1.5 2.5
t t
t t
F
F
+
s s
s s
Similarly for s,
/
1/
3 8
3 8
t t
t t
s
s
+
s s
s s
These constraints can eb expressed in the matrix form as,
/
1/
/
1/
1 0 2.5
1 0 1.5
0 1 2.5
0 1 1.5
1 0 8
1 0 3
0 1 8
0 1 3
t t
t t
t t
t t
F
F
s
s
+
+
( (
( (
(
( (
s
(
( (
( (
( (
( (
(
( (
s
(
( (
( (
In the above forms substituting the value of
/ / /
1/ / 1/
0 1 0 0
1 1 0.01 0
t t t t t t
t t t t t t
s v F
s s F
+ +
( ( ( ( (
= +
( ( ( ( (
,
/ /
/ 1/
/
1/
1 0 8
1 0 0 1 0 0 3
0 1 1 1 0.01 0 8
0 1 3
Changing it to the form of LU c
1 0 8
1 0 0 1 3
0 1 1 1 8
0 1 3
t t t t
t t t t
t t
t t
v F
s F
F
F
+
+
( (
( (
| | ( ( ( (
( (
+ s
|
( ( ( (
( (
\ .
( (
s
( (
( (
( (
( (
s
( (
( (
( (
/
/
/ /
1/ /
1 0
1 0
0 1
0 1
0 0 8 1 0
0 0 3 1 0
.....eq(Y)
0.01 0 8 0 1
0.01 0 3 0 1
t t
t t
t t t t
t t t t
v
s
F v
F s
+
(
(
(
(
(
(
(
( ( (
( ( (
( (
( ( (
s
( (
( ( (
( ( (
To get the values of
/ /
and s
t t t t
v we compare the RHS values of the above equation with the
given c given,
8-0(v)-s=3
S=5 (1)
-3-0(v)+s=2
S=-5
The constraint 3 8 s s s is satisfied at s=5
Now we consider the value of s=5 for finding v,
8-(v+s)=3.5
V=-0.5
Now using these values of s and v and substituting the same in eq(Y) we get,
/
1/
/
1/
0 0 8 1 0
0 0 3 1 0 0.5
0.01 0 8 0 1 5
0.01 0 3 0 1
0 0 3
0 0 2
0.01 0 3.5
0.01 0 1.5
t t
t t
t t
t t
F
F
F
F
+
+
( ( (
( ( (
( (
( ( (
s
( (
( ( (
( ( (
( (
( (
(
( (
s
(
( (
( (
Inserting both the constraints of F matrices and the matrix above for representation in the
standard form we get,
/
1/
1 0 2.5
1 0 1.5
0 1 2.5
0 1 1.5
0 0 3
0 0 2
0.01 0 3.5
0.01 0 1.5
t t
t t
F
F
+
( (
( (
( (
( (
( (
(
( (
s
(
( (
( (
( (
( (
( (
( (
This is the standard for of,
. LU c s
f) For different values of N, p or q we get a set of matrices which have more states depending on
N and the weighting factors i.e., Q and P.