Adama Science and Technology
University
PCE6101 Linear and
Nonlinear Systems
Theory
(Tracking Controller)
ASTU
School of EEC
12.1 P-Type Tracking Con-
troller
(Problem) Consider a LTI system
x Ax Bu , x (0)
y Cx Du
Given closed-loop poles 1 , 2 , , n , find K and
F of the tracking controller
u = Fr - Kx
At this time, the output should follow the setpoint
without the steady-state error.
12.1 P-Type Tracking Con-
troller
d
r + u y
F Plant
-
x
K
• Disturbance d is assumed to be 0 or constant.
• Setpoint or reference input r is considered as a step
signal.
12.1 P-Type Tracking Con-
troller
Plant
x Ax Bu , x (0)
y Cx Du
Tracking controller
u= Fr-Kx
Closed-loop system
x ( A BK ) x BFr
y (C DK )x DFr
12.1 P-Type Tracking Con-
troller
The design procedure of the tracking controller is
summarized into two steps:
Step 1: obtain the feedback gain matrix K from the
given poles:
1 , 2 , , n
Step 2: find the feedforward gain F so that the output
follows the setpoint without steady-state error.
12.1 P-Type Tracking Con-
troller
Calculation of K u= Fr-Kx
Use one of the following methods with the closed-
loop poles 1 , 2 , , n
- Brute force method
- Similarity transformation method
- Ackermann formula
Calculation of F
x ( A BK ) x BFr
y (C DK )x DFr
12.1 P-Type Tracking Con-
troller
The transfer function is given by
Y(s)/R(s)= G(s)
= (C-DK)(sI-A+BK)-1BF+DF
For the unit step input r= 1, R(s)= 1/s
lim y (t ) lim sY ( s ) lim sG ( s) R( s)
t s 0 s 0
lim[(C DK )( sI A BK ) 1 BF DF ] 1
s 0
(C DK )( A BK ) 1 BF DF 1
Find F from the above equation.
12.1 P-Type Tracking Con-
troller
For example, consider a system
2 0 1
x x u , x (0)= 0
0 3 1
y 1 1 x
Design a tracking controller u= Fr - Kx so that the
feedback system has poles -2j2 and there is no
steady-state error at the unit step input and obtain a
response for 5 seconds.
12.1 P-Type Tracking Con-
troller
Using the Ackermann formula
1 2 1 3 2
U [ B AB ] , U
1 3 1 1
From the given poles
( ) ( 2 j 2)( 2 j 2)
2 4 8
( A) A2 a1 A a2 I
2
2 0 2 0 1 0 4 0
4 8
0 3 0 3 0 1 0 5
12.1 P-Type Tracking Con-
troller
Thus
K 0 1 U 1 ( A)
3 2 4 0
0 1 4 5
1 1 0 5
Taking the transfer function to get F gives
G(s)= Y(s)/R(s)= C(sI-A+BK)-1BF
F (2 s 5)
2
s 4s 8
12.1 P-Type Tracking Con-
troller
lim y (t ) lim sY ( s )
t s 0
F (2 s 5) 1 5 F
lim s 2 1
s 0 s 4s 8 s 8
F= 1.6
u= Fr-Kx
= 1.6r - [4 -5]x
12.1 P-Type Tracking Con-
troller
Main program
t= 0; x= [0;0]; h= 0.01; loop= 500;
K= [4 -5]; F= 1.6; r= 1;
y= [1 1]*x; buf= [t y 0];
for i= 1:loop
u= F*r-K*x;
x= RK4(@fun,t,x,u,h);
t= t+h;
y= [1 1]*x;
buf= [buf;t y u];
end
12.1 P-Type Tracking Con-
troller
t= buf(:,1); y= buf(:,2); u= buf(:,3);
subplot 211
plot(t,y,'b'), axis([0 5 0 1.5])
subplot 212
plot(t,u,'b'), axis([0 5 0 3])
Plant
function xdot= fun(t,x,u)
xdot= zeros(2,1);
xdot(1)= -2*x(1)+u;
xdot(2)= -3*x(2)+u;
12.1 P-Type Tracking Con-
troller
Step responses
1.5
y(t) 1
0.5
0
0 1 2 3 4 5
t
3
2
u(t)
1
0
0 1 2 3 4 5
t
12.2 PI-Type Tracking Con-
troller
(Problem) Consider a LTI system with disturbance d.
x Ax Bu+Wd , x (0)
y Cx Du
Given the closed-loop poles of (n+1)
1 , 2 , , n , n 1 , find = [K1 k2] of the PI-type
tracking controller
u= -K1x + k2(r-y)dt
The output should follow the setpoint without the
steady-state error.
12.2 PI-Type Tracking Con-
troller
d
r + + u y
k2 Plant
- -
x
K1
• Disturbance d is considered constant
• Setpoint(or reference) input r is considered a step
signal
12.2 PI-Type Tracking Con-
troller
In order to design the PI-type tracking controller
without steady-state error for a constant disturbance
or the type-0 plant, the new state variable is defined
as follows:
z ( y r )dt
Differentiating both sides once gives
z = y r
From the dynamic equation,
x Ax Bu Wd
z y r Cx Du r
12.2 PI-Type Tracking Con-
troller
x
By defining the augmented vector as x and
rewriting the equations gives z
Bu Wd 0 r , x (0)
x Ax
1
y Cx Du
where
A 0 B W
A , B , W , C C 0 , D D
C 0 D 0
12.2 PI-Type Tracking Con-
troller
If the open-loop system is controllable, the augmented
system is also controllable and a PI-type controller can
be written as
x
u Kx K1 k2 K1 x k2 (r y )dt
z
d
r + + u y
k2 Plant
- -
K1 x
PI-type tracking controller
12.2 PI-Type Tracking Con-
troller
into
Substituting u Kx
Bu Wd 0 r
x Ax
1
the feedback system becomes
) x Wd 0 r
x( A BK
1
(Theorem) If K is chosen so that all eigenvalues of ( A BK
)
have negative real parts, the feedback system becomes
asymptotically stable without steady-state error for the step
input and constant disturbances.
12.2 PI-Type Tracking Con-
troller
Design procedure
Step 1: Write the augmented system from the system.
(Original) x Ax Bu +Wd , x (0)
y Cx Du
(Augmented)
Bu Wd 0 r , x (0)
x Ax
1
y Cx Du
where
A 0 B W
A , B , W , C C 0 , D D
C 0 D 0
12.2 PI-Type Tracking Con-
troller
Step 2: Obtain K = [K1 k2] from the given poles of
1 , 2 , , n , n 1 , B
A
(n+1) and :
- Brute force method
- Similarity transformation method
- Ackermann formula
Step 3: Implement the PI-type tracking controller
u= -K1x+k2(r-y)dt
12.2 PI-Type Tracking Con-
troller
Consider a scalar system:
x x 2u d , x(0) 0
y x
Obtain a PI-type controller and draw a block diagram
so that the feedback system has two poles -2j2.
Since a= -1, b= 2 , c= 1and w=1, the augmented sys-
tem gives
x 1 0 x 2 u 1 d 0 r , x (0)
1 0 0 0 1
From the given poles
2
( ) ( 2 j 2)( 2 j 2) 4 8
12.2 PI-Type Tracking Con-
troller
Letting =[k1 k2] yields
( ) I A BK
0 1 0 2
det( k1 k2 )
0 1 0 0
1 2k1 2k2 2
det( ) (1 2k1 ) 2k2
1
Comparing and becomes
2k2= 8 k2= 4
1+2k1= 4 k1=1.5
12.2 PI-Type Tracking Con-
troller
Thus, the PI-type tracking controller is given by
x
u Kx 1.5 4 1.5 x 4 (r y )dt
z
Feedback system
d
r + + u + + x x y
4 2 1
- - +
-1
PI-type
controller 1.5
12.2 PI-Type Tracking Con-
troller
Main program
clf
1 0 2 1 0
A= [-1 0;1 0]; x x u d r
B= [2;0]; 1 0 0 0 1
P= [-2+j*2, -2-j*2];
K= acker(A,B,P)
t= 0; h= 0.01; r= 1; x= 0; ee= r-x;
z= 0; loop= 500;
buf= [t x z 0]; x x 2u d , x(0) 0
y x
12.2 PI-Type Tracking Con-
troller
for i= 1:loop
e= r-x;
u 1.5 x 4 (r y )dt
z= z+0.5*h*(e+ee); ee= e;
u= -K(1)*x+K(2)*z;
x= RK4(@fun, t, x, u, h);
t= t+h;
buf= [buf; t x z u];
end
subplot 211
plot(buf(:,1),buf(:,2),buf(:,1),buf(:,3),'linewidth',2)
axis([0 5 -0.1 1.2]), xlabel('t'), ylabel('x(t) & z(t)')
12.2 PI-Type Tracking Con-
troller
subplot 212
plot(buf(:,1),buf(:,4),'linewidth',2)
xlabel('t'), ylabel('u(t)')
axis([0 5 -0.1 2])
function xdot= fun(t,x,u)
d= 1; x x 2u d
xdot= -x+2*u+d;
12.2 PI-Type Tracking Con-
troller
Step response
1
x(t)
x(t) & z(t)
0.5 z(t)
0
0 1 2 3 4 5
t t
2
1.5
1
u(t)
u(t)
0.5
0
0 1 2 3 4 5
t t
12.2 PI-Type Tracking Con-
troller
Example 1: Consider a system.
0 1 0 0 0
x x u d , x (0)
2 2 1 0.2 0
y 1 0 x
Obtain a PI-type tracking controller such that the
augmented feedback system has poles -2, -2j2
where disturbance d= 1.
Solution:
Since the order of the augmented feedback system is
3, is found using the MATLAB command.
12.2 PI-Type Tracking Con-
troller
0 1 0 0
A 0 B
A 2 2 0 , B 1
C 0 D
1 0 0 0
The result from MATLAB is
= [14 4 16]
and
u= -[14 4]x+16(r-y)dt
12.2 PI-Type Tracking Con-
troller
MATLAB Program
A= [0 1;-2 -2]; 0 1 0 0
A 0 B
B= [0;1];
A 2 2
0 , B 1
C 0 D
C= [1 0]; 1 0 0 0
AA= A; AA(3,1:2)= C;
AA(1:2,3)= zeros(2,1); AA(3,3)= 0;
BB= B; BB(3)= 0;
P= [-2, -2+j*2, -2-j*2];
K= acker(AA,BB,P)
12.2 PI-Type Tracking Con-
troller
t= 0; h= 0.02; r= 1; x=[0; 0]; ee= r-x(1);
z= 0; loop= 300; buf= [t x' 0];
for i= 1:loop
e= r-x(1); u= -[14 4]x+16(r-y)dt
z= z+0.5*h*(e+ee);
ee= e;
u= -K(1:2)*x+K(3)*z;
x= RK4(@fun, t, x, u, h);
t= t+h;
buf= [buf; t x' u];
end
12.2 PI-Type Tracking Con-
troller
subplot 211
plot(buf(:,1),buf(:,2),buf(:,1),buf(:,3),'linewidth',2)
axis([0 6 -0.1 1.2])
xlabel('t'), ylabel('x_1(t) & x_2(t)')
subplot 212
plot(buf(:,1),buf(:,4),'linewidth',2)
xlabel('t'), ylabel('u(t)')
axis([0 6 0 4])
12.2 PI-Type Tracking Con-
troller
function xdot= fun(t,x,u)
d= 1;
A= [0 1;-2 -2]; B= [0;1]; W= [0;0.2];
xdot= A*x+B*u+W*d;
0 1 0 0
x x u d
2 2 1 0.2
12.2 PI-Type Tracking Con-
troller
Unit step response
1
x (t) & x(t)
2
0.5
1
0
0 1 2 3 4 5 6
t
3
u(t)
0
0 1 2 3 4 5 6
t
12.2 PI-Type Tracking Con-
troller
Example 2: Consider an inverted pendulum system.
0 1 0 0 0
x1 (t ) mg x1 (t ) 1 0
0 0 - 0 0
x
2 (t ) M x (t )
2 M d (t )
u (t )
x 3 (t ) 0 0 0 1 x3 (t ) 0 0
x 4 (t ) ( M m) g x4 (t ) 1 0.2
0 0
M
0
-
M
x1 (t )
x (t )
y (t ) 1 0 0
2
0
x3 (t )
x4 (t )
M= 2[kg], m= 0.1[kg], ℓ= 1[m], g= 9.8[m/sec2]
12.2 PI-Type Tracking Con-
troller
x1 (t ) y (t )
y (t )
x (t )
x (t )
2
x3 (t ) (t )
x4 (t ) (t )
Obtain a PI-type tracking controller such that the
augmented feedback system has poles -2j2,-3j3, -
4 and the unit step response where disturbance d(t)=
1 and x(0)= [0 0 0 0]T.
12.2 PI-Type Tracking Con-
troller
Augmented Matrices
0 1 0 0 0 0
0 0 0.49 0 0 0.5
A 0 B
A 0 0 0 1 0 , B 0
C 0 D
0 0 10.29 0 0 0.5
1 0 0 0 0 0
Applying the MATLAB command gives .
= [-127.3469 -77.3011 -327.9269 -105.3011
-117.5510] and
u= -[-127.3469 -77.3011 -327.9269
-105.3011]x-117.551(r-y)dt
12.2 PI-Type Tracking Con-
troller
MATLAB program
M= 2; m= 0.1; L=1; g=9.8;
A=[0 1 0 0;0 0 -m*g/M 0;0 0 0 1;0 0 (M+m)*g/(M*L)
0];
B=[0 1/M 0 -1/(M*L)]';
C=[1 0 0 0];
AA= A; AA(5,1:4)= C;
AA(1:4,5)= zeros(4,1); AA(5,5)= 0;
BB= B; BB(5)= 0;
P= [-2+j*2, -2-j*2, -3+j*3, -3-j*3, -4];
K= place(AA,BB,P);
12.2 PI-Type Tracking Con-
troller
t= 0; h= 0.02; r= 1; x=[0; 0;0;0]; ee= r-x(1);
z= 0; loop= 250; buf= [t x' 0];
for i= 1:loop
e= r-x(1);
z= z+0.5*h*(e+ee);
ee= e;
u= -K(1:4)*x+K(5)*z;
x= RK4(@fun, t, x, u, h);
t= t+h;
buf= [buf; t x' u];
end
12.2 PI-Type Tracking Con-
troller
subplot 211
plot(buf(:,1),buf(:,2:5),'linewidth',2)
axis([0 5 -0.5 1.5])
xlabel('t'), ylabel('x_1(t) ... x_4(t)')
subplot 212
plot(buf(:,1),buf(:,6),'linewidth',2)
xlabel('t'), ylabel('u(t)')
axis([0 5 -5 10])
12.2 PI-Type Tracking Con-
troller
function xdot= fun(t,x,u)
d= 1;
M= 2; m= 0.1; L=1; g=9.8;
A=[0 1 0 0;0 0 -m*g/M 0;0 0 0 1;0 0 (M+m)*g/(M*L)
0];
B=[0 1/M 0 -1/(M*L)]';
W= [0;0;0;0.2];
xdot= A*x+B*u+W*d;
12.2 PI-Type Tracking Con-
troller
Unit step response
1.5
1
x1 (t ) y (t )
y (t )
x1(t) ... 4x(t)
0.5
x (t
2 )
0
x3 (t ) (t )
-0.5
0 1 2 3 4 5
x4 (t ) (t )
t
10
5
u(t)
-5
0 1 2 3 4 5
t
12.2 PI-Type Tracking Con-
troller
12.2 PI-Type Tracking Con-
troller
Example 3: Consider a submarine depth control sys-
tem.
(1) Design a PI-type tracking controller so that the
augmented feedback system has poles at -4 and -3j2.
(2) It is now cruising at a depth of 200 meters. Find
the response for 20 seconds when descending to 500m
depth after 1 second where d = 0.1.
d
u + +q 41.67 y
s 2+ 16.7 s+ 83.3
12.2 PI-Type Tracking Con-
troller
Submarine
( s 2 16.7 s 83.3)Y ( s ) 41.67Q( s )
a1= 16.7, a2= 83.3, b0= b1= 0, b2= 41.67
State space form
a1 1 b1 a1b0
x x q
a2 0 b2 a2b0
16.7 1 0
x q
83.3 0 41.67
y 1 0 x b0 q 1 0 x
12.2 PI-Type Tracking Con-
troller
Since q= u+d,
16.7 1 0 0
x x u d
83.3 0 41.67 41.67
y 1 0 x
With the augmented matrices, applying the MATLAB
command to obtain gives
16.7 1 0 0
A 0 B
A 83.3 0 0 , B 41.67
C 0 D
1 0 0 0
12.2 PI-Type Tracking Con-
troller
>> AT= [-16.7 1 0;-83.3 0 0;1 0 0];
>> BT= [0;41.67;0];
>> P= [-3+2j -3-2j -4];
>> KT= place(AT,BT,P)
KT= [1.574 -0.1608 1.2479]
u= -K1x - k2z
= -[1.574 -0.1608]x + 1.2479(r - y)dt
12.2 PI-Type Tracking Con-
troller
d
r + + u+ + q y
k2 Plant
- -
x
K1
u= -[1.574 -0.1608]x + 1.2479(r - y)dt
12.2 PI-Type Tracking Con-
troller
Initial conditions
x1 0 16.7 1 x1 0 0
x x u d
2 83.3 0 2 41.67 41.67
200 x
y 1 0 1
x2
If it keeps on going 200 meters deep with d= 0.1,
r= y= x1= 200 x1(0)= 200
-16.7x1+x2= 0 x2(0)= 3,340
-83.3x2+41.67u+41.67d= 0 u(0)= 399.708
12.2 PI-Type Tracking Con-
troller
u= 399.708
d= 0.1
r= 200
+ z + u + + y= 200
k2 Plant
- -
x
K1
z= (u+K1x)/k2= 418.3332 x= [200 3340]T
u= -K1x+k2z
where K1= [1.574 -0.1608], k2= 1.2479, z= (r-y)dt
12.2 PI-Type Tracking Con-
troller
Main program
clf
AT= [-16.7 1 0;-83.3 0 0;1 0 0];
BT= [0;41.67;0];
P= [-3+2j -3-2j -4];
K= place(AT,BT,P);
t= 0; r= 200; x= [r; 16.7*r];
ee= r-x(1); loop= 250; d= 0.1;h= 0.02;
u= (83.3*r-41.67*d)/41.67;
z= (u+K(1:2)*x)/K(3);
buf= [];
12.2 PI-Type Tracking Con-
troller
for i= 1:loop
buf= [buf; t r x(1) u];
if t >= 1
r= 500;
end
e= r-x(1);
z= z+0.5*h*(e+ee);
ee= e;
u= -K(1)*x(1)-K(2)*x(2)+K(3)*z;
x= RK4(@submarine, t, x, u, h);
t= t+h;
end
12.2 PI-Type Tracking Con-
troller
subplot 311
plot(buf(:,1),buf(:,2),'linewidth',2)
xlabel('t'), ylabel('r(t)')
subplot 312
plot(buf(:,1),buf(:,3:4),'linewidth',2)
xlabel('t'), ylabel('y(t)')
subplot 313
plot(buf(:,1),buf(:,5),'linewidth',2)
xlabel('t'), ylabel('u(t)')
12.2 PI-Type Tracking Con-
troller
function xdot= submarine(t,x,u)
d= 0.1;
xdot= zeros(2,1);
xdot(1)= -16.7*x(1)+x(2);
xdot(2)= -83.3*x(1)+41.67*u+41.67*d;
x1 16.7 1 x1 0 0
x x u d
2 83.3 0 2 41.67 41.67
12.2 PI-Type Tracking Con-
troller 600
r(t)
400
200
0 5 10 15 20
t
600
y(t)
400
200
0 5 10 15 20
t
1500
1000
u(t)
500
0
0 5 10 15 20
t