Liuweimin HW2
Liuweimin HW2
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.
(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.)
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.
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.
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