0% found this document useful (0 votes)
18 views6 pages

Liuweimin HW2

The document outlines a homework assignment focused on designing and tuning a PID controller for a specified plant transfer function. It includes tasks for deriving closed loop transfer functions, calculating poles and zeros before and after tuning, and explaining the tuning process with supporting figures and MATLAB code. Additionally, it presents a simplified attitude control model for an artificial satellite, emphasizing controllability and optimal control solutions.

Uploaded by

intervalallen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views6 pages

Liuweimin HW2

The document outlines a homework assignment focused on designing and tuning a PID controller for a specified plant transfer function. It includes tasks for deriving closed loop transfer functions, calculating poles and zeros before and after tuning, and explaining the tuning process with supporting figures and MATLAB code. Additionally, it presents a simplified attitude control model for an artificial satellite, emphasizing controllability and optimal control solutions.

Uploaded by

intervalallen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1

VCE Homework for Lecture 3


Weimin Liu (2020210323), School of Vehicle and Mobility, Tsinghua University

I. TASK 1
A PID controller is designed for the following plant
manually and then tune its control parameters to your desired
performance. The transfer function for the plant is
10
P(s) 
( s  1)( s  5)( s  10)
Please
(1) Derive the closed loop transfer function with the
parameterized PID controller defined as
1
G (s)  K P  K I  K D s
s
Closed Loop is shown as follows in Figure 1.1.

Figure 1.2 Poles and zeros distribution before tuning

The values of K P , K I and K D after tuning are as follows.


Figure 1.1 Closed Loop transfer function K P =30 , K I =15 , K D =3
Poles and zeros after tuning:
 1  10 
 K P  K I  K D s   p1  9.7873  0.000i p2  2.8623  4.8175i
Y ( s) G ( s) P( s)  s  ( s  1)( s  5)( s  10) 
  p3  2.8623-4.8175i p4  0.4881  0.0000i
X ( s ) 1  G ( s ) P( s )  1  10 
1   K P  K I  K D s  
 s  ( s  1)( s  5)( s  10)  z1  9.4721 z2  0.5279
Y (s) 10( K D s 2  K P s  K I ) The figure below shows how the poles and zeros of the
 4 transfer function distribute in the Re-Im diagram after tuning.
X ( s ) s  16s  (65  10 K D ) s 2  (50  10 K P ) s  10 K I
3

(2) Calculate the poles and zeros of the closed loop system
before tuning and after tuning (Please manually select the PID
parameters by your intuition before tuning.)

The initial values of K P , K I and K D are chosen as follows.


K P =15 , K I =15 , K D =1
In order to calculate the poles and zeros and the same time
show the distribution of poles and zeros, function pzmap() in
matlab is used and the code is given in [Appendix_1(task1_2)].
Poles and zeros before tuning:
p1  10.5661  0.000i p2  2.1617  2.8479i
p3  2.1617  2.8479i p4  1.1105  0.0000i
z1  13.9226 z2  1.0774
Figure 1.3 Poles and zeros distribution before tuning
The figure below shows how the poles and zeros of the
original transfer function distribute in the Re-Im diagram.
(3) Please explain how to tune the parameters of PID controller,
and draw the figures of unit step response to compare the
control performances before tuning and after tuning.

The parameters of PID are tuned by following steps.


2

1. Choose initial values of these parameters with possible Four values (15,20,25,30) of the K P is provided. Figure
prior experience. 1.6 shows the Bode diagram of open loop system under
2. Tune each parameter using frequency domain analysis
different value of K P .
with the other two parameters unchanged. The main
standards for judgement are Pm (Phase margin) which
indicates the stability of the system and bandwidth
which in some way reflects how quickly the system
could response to input signal. Steady state accuracy is
defined as the difference between the value of
convergence and the true value.
Note: Frequency domain analysis uses open loop system
transfer function to evaluate the characteristics of closed loop
system. In this section, I use Bode diagram to do frequency
domain analysis.

A. K P =15 , K I =15 , tuning K D [Appendix_1(task_kd)]


Four values (1,2,3,4) of the K D is provided. Figure 1.4
shows the Bode diagram of open loop system under different
value of K D .
Figure 1.6 Bode diagram under different K P

Figure 1.7 shows how Pm and bandwidth vary with


different K P .

Figure 1.7 Variation of Pm and bandwidth under different K P


Figure 1.4 Bode diagram under different K D
As figure above shows, both bandwidth and phase margin
Figure 1.5 shows how Pm and bandwidth vary with
of system gets larger with greater value of K P . In order to get
different K D .
better response speed and the stability of the system, K P is
tuned to be value of 30.

C. K D =3 , K P =30 , tuning K I [Appendix_1(task_ki)]


Four values (12,16,20,24) of the K I is provided. Figure
1.8 shows the Bode diagram of open loop system under
different value of K I .

Figure 1.5 Variation of Pm and bandwidth under different K D


As figure above shows, the bandwidth of system gets
smaller and the phase margin gets larger with greater value
of K D . In order to balance the response speed and the stability
of the system, K D is tuned to be value of 3, since greater value
of K D could significantly better the stability of the system, yet
exert subtle influence on response speed.
B. K D =3 , K I =15 , tuning K P [Appendix_1(task_kp)]
3

Figure 1.8 Bode diagram under different K I Figure 1.11 Bode diagram comparison
Figure 1.9 shows how Pm and bandwidth vary with
Table 1.1 below shows the characteristics of closes loop
different K I . system in time domain.

Table 1.1 Comparison in time and frequency domain


Steady State
Rise_time (s) Overshoot (%)
Error
Before 0.7882 10.5422 0
After 0.5092 6.5721 0

As for stable state accuracy, matlab function dcgain() can


calculate the value of convergence. By applying dcgain() on
Figure 1.9 Variation of Pm and bandwidth under different K I
both transfer function, it can be noticed that, both system can
converge to the correct value of 1.
As figure above shows, both bandwidth and phase margin
of system gets smaller with greater value of K I . In order to get
II. TASK 2
better response speed and the stability of the system, K I is
A simplified attitude control model of an artificial earth
tuned to be value of 12. satellite is
0 1  0
D. Comparison [Appendix_1(task1_3)] x    x   u
0 0 1 
Figure 1.10 shows step response comparison.
in which x is the state (for example, position and speed), and u
is the control input. The control objective to minimize the
following functional:
 0 1  
min J    x T   x  u 2 dt
 0 0
0

with the following initial and terminal state constraints:
 2 0
x(0)    , x( )   
2
  0
The duration of overall control process is  seconds, with the
initial time at 0 second, and the terminal time at  second.
(1) Please check the controllability of this plant model.
(2) Please give the analytical of numerical solutions of optimal
control input u * (t ) and optimal state x* (t ) by using the calculas
of variations.

Figure 1.10 Step response comparison


(1)
Figure 1.11 shows Bode diagram comparison. Given attitude control model of an artificial earth satellite,
4

0 1  0 u(t )  u (t )  0 (2.12)


x    x  1  u
 0 0    By solving the derivative equation (2.12), we can get,
Matrix A and Matrix B can be written as follows. u (t )  C1e t  C2e t (2.13)
0 1  0 Substituting equation (2.13) to equation (2.10) yields,
A
0 0  , B  1  2 (t )  2C1e t  2C2e t (2.14)
   
Using the criterion below, the controllability of plant Take the first derivative of equation (2.14) we can get,
model can be judged. 2 (t )  2C1e t +2C2e t (2.15)
0 1  Substituting equation (2.15) to equation (2.8) yields,
Qc   B , AB , A 2 B ,  A n 1B     (n  1)
1 0  1 (0)
x2 (t )  C1e t  C2e t  (2.15)
Rank(Qc )=2 2
Since x1 (t )  x2 (t ) , x1 (t ) can therefore be written as follows.
Since the rank of Qc is 2 (full rank), this plant model in
controllable.   (0) 
x1 (t )    C1e t  C2e t  1  dt
 2 
(2.16)
(2) t t  (0)
 C1e  C2e  1
tD
2
Step 1: Define a Hamiltonian Substituting equation (2.5) to equation (2.15) and (2.16)
0 1  0  x (t )  x2 (t ) yields,
x (t )    x(t )    u (t )   1 x1 (0)  C1 +C2  D  2
0 0 1   x2 (t )  u (t )
By introducing Lagrange Multipliers 1 (t ) and 2 (t ) , a 
x1 ( )=e C1 +e  C2  1 (0)  D  0
2
Hamiltonian is defined.
 (0)
 x (t )  x2 (0)  C1  C2  1 2 (2.15)
H ( x, u ,  )  x 22 (t )  u 2 (t )  1 (t ) 2 (t )   2  2
 u (t )  (2.1)  (0)
 x22 (t )  u 2 (t )  1 (t ) x2 (t )  2 (t )u (t ) x2 ( )  e C1  e  C2  1  0
2
Change equation (2.15) to linear matrix calculation.
Step 2: Use the Extrema equation 1 1 0 1
H ( x, u ,  )   
 2u (t )  2 (t )  0 (2.2)  e e   1  C1   2
u (t )  2   C   0
 1   2  =   (2.16)
1 1  0 1 (0)   2
Step 3: Use the Canonical equation and initial/terminal  2    
constraints   1   D   0
e e   0
 H ( x, u ,  )  2 
1 (t )   x (t )  0
 Using matlab code to calculate the outcome of each variable

1
(2.3)
 (t )   H ( x, u ,  )  2 x (t )   (t ) in equation (2.16). The outcome is shown as follows.

2
x2 (t )
2 1
C1  0.1178 , C2  4.8153
(2.17)
D  6.6975 , 1(0)  5.8660
 x1 (t )  x2 (t )
 (2.4) Therefore,
 x2 (t )  u (t )
x1 (t )  0.1178e t  4.8153e t  2.9330t  6.6975
x1 (0)  2, x2 (0)  2, x1 ( )  0, x2 ( )  0 (2.5)
x2 (t )  0.1178e t  4.8153e t  2.9330 (2.18)
Eqs.(2.2)~(2.5) are the first order necessary condition.
 (t )  t 0dt   (0) u (t )  0.1178e t  4.8153e t
 1 0 1
(2.6)
 t
2 (t )    2 x2 (t )  1 (t )  dt  2 (0) III. APPEDNDIX
 0
t [Appendix_1(task1_2)]
2 (t )  1 (0)t  2 (0)  2  x2 (t )dt (2.7) clc;
0

Take the first derivative of equation (2.7). clear;


kd=1;
2 (t )  1 (0)  2 x2 (t ) (2.8) kp=15;
Take the second derivative of equation (2.7). ki=15;
2 (t )  2 x2 (t )  2u (t ) (2.9) num=[10*kd,10*kp,10*ki];
den=[1 16 65+10*kd 50+10*kp 10*ki];
From formula (2.2) we can get, sys=tf(num,den);
2 (t )  2u (t ) (2.10) kdd=3;
Take the second derivative of formula (2.10), kpp=30;
kii=15;
2 (t )  2u(t ) (2.11) numm=[10*kdd,10*kpp,10*kii];
Substituting equation (2.11) to equation (2.9) yields, denn=[1 16 65+10*kdd 50+10*kpp 10*kii];
5

syss=tf(numm,denn); hold on;


figure(1); [Gm,Pm,Wcg,Wcp]=margin(tf1);
pzmap(sys); pm_ki=[pm_ki,Pm];
[p_before,z_before]=pzmap(sys);
title('Poles and zeros distribution before bandwidth_ki=[bandwidth_ki,bandwidth(tf1)/(2*p
tuning') i)];
figure(2); end
pzmap(syss); legend('ki=12','ki=16','ki=20','ki=24');
[p_after,z_after]=pzmap(syss); figure(2);
title('Poles and zeros distribution after subplot(1,2,2);
tuning') plot([12:4:24],pm_ki);
grid on;
[Appendix_1(task1_kp)] xlabel('k_i');
clc; ylabel('Pm/¡ã');
clear; title('Pm of closed loop system with changing
kd=3; k_i');
ki=15; subplot(1,2,1);
%frequency domain analysis with changing kd plot([12:4:24],bandwidth_ki);
figure(1); grid on;
pm_kp=[]; xlabel('k_i');
bandwidth_kp=[]; ylabel('bandwidth/Hz');
for kp=1:1:4 title('bandwidth of closed loop system with
num=[10*kd,10*kp,10*ki]; changing k_i');
den=[1 16 65 50 1];
tf1=tf(num,den); [Appendix_1(task1_kd)]
bode(tf1); clc;
grid on; clear;
hold on; kp=15;
[Gm,Pm,Wcg,Wcp]=margin(tf1); ki=15;
pm_kp=[pm_kp,Pm];
%frequency domain analysis with changing kd
bandwidth_kp=[bandwidth_kp,bandwidth(tf1)/(2*p figure(1);
i)]; pm_kd=[];
end bandwidth_kd=[];
legend('kp=15','kp=20','kp=25','kp=30'); for kd=1:1:4
figure(2); num=[10*kd,10*kp,10*ki];
subplot(1,2,2); den=[1 16 65 50 1];
plot([15:5:30],pm_kp); tf1=tf(num,den);
grid on; bode(tf1);
xlabel('k_p'); grid on;
ylabel('Pm/¡ã'); hold on;
title('Pm of closed loop system with changing [Gm,Pm,Wcg,Wcp]=margin(tf1);
k_p'); pm_kd=[pm_kd,Pm];
subplot(1,2,1);
plot([15:5:30],bandwidth_kp); bandwidth_kd=[bandwidth_kd,bandwidth(tf1)/(2*p
grid on; i)];
xlabel('k_p'); end
ylabel('bandwidth/Hz'); legend('kd=1','kd=2','kd=3','kd=4');
title('bandwidth of closed loop system with figure(2);
changing k_p'); subplot(1,2,2);
plot([1:1:4],pm_kd);
[Appendix_1(task1_ki)] grid on;
clc; xlabel('k_d');
clear; ylabel('Pm/¡ã');
kd=3; title('Pm of closed loop system with changing
kp=30; %ÈÎÒâÈ¡µÃ »¹Òª¿´kpÄǸömÎļþÄĸöÖµ×îÓÅ k_d');
subplot(1,2,1);
%frequency domain analysis with changing kd plot([1:1:4],bandwidth_kd);
figure(1); grid on;
pm_ki=[]; xlabel('k_d');
bandwidth_ki=[]; ylabel('bandwidth/Hz');
for ki=12:4:24 title('bandwidth of closed loop system with
num=[10*kd,10*kp,10*ki]; changing k_d');
den=[1 16 65 50 1];
tf1=tf(num,den); [Appendix_1(risetime)]
bode(tf1); function[risetime]=risetime(y,x)
grid on; r=1;
6

while y(r)<1.0001
r=r+1;
end
risetime=x(r);
end

[Appendix_1(overshoot)]
function[overshoot]=overshoot(y)
overshoot=(max(y)-1)*100;
end

[Appendix_1(task1_3)]
clc;
clear;
kd=1;
kp=15;
ki=15;
numc=[10*kd,10*kp,10*ki];
denc=[1 16 65+10*kd 50+10*kp 10*ki];
sysc=tf(numc,denc);
kdd=3;
kpp=30;
kii=12;
nummc=[10*kdd,10*kpp,10*kii];
dennc=[1 16 65+10*kdd 50+10*kpp 10*kii];
syssc=tf(nummc,dennc);
figure(1);
step(sysc);
[y,x]=step(sysc);
hold on
grid on;
step(syssc);
[yy,xx]=step(syssc);
grid on
title('Step response comparison');
legend('Before tuning','After tuning');
rt=risetime(y,x);
rtt=risetime(yy,xx);
os=overshoot(y);
oss=overshoot(yy);

numo=[10*kd,10*kp,10*ki];
deno=[1 16 65 50 1];
syso=tf(numo,deno);
nummo=[10*kdd,10*kpp,10*kii];
denno=[1 16 65 50 1];
sysso=tf(nummo,denno);
figure(2);
bode(syso);
grid on
hold on
bode(sysso)
title('Bode diagram comparison');
legend('Before tuning','After tuning');
grid on

[Appendix_1(task2)]
clc;
clear;
b=[2;0;2;0];
A=[1 1 0 1;exp(pi) exp(-pi) -pi/2 1;1 -1 -1/2
0;exp(pi) -exp(-pi) -1/2 0]
outcome=inv(A)*b

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy