Upload
arkan-king
View
25
Download
0
Embed Size (px)
Citation preview
DC servo motor• Let
• By plugging these values in the transfer function:
• The goal of this problem is to show you how each of contribute to obtain: fast rise time, minimum overshoot, no steady-state error.
dip KandKK ,
2.2011
222
SSkRLsBJs
ksVsw
Parameter ValueMoment of Inertia(J) 0.001 Nms2/radDamping Coefficient(B) 0.1 Nms/radTorque constant (Kt) 0.01 Nm/AElectromotive force constant (Ke) 0.01 Vs/radElectrical Resistance (R) 1 OhmsElectrical Inductance(L) 0.5 Henry
Feedback controller - How does i work • u-controller output is signal equal to :
Kp (proportional gain)times the magnitude of error + Ki (integral gain)times the magnitude of error + Ki (derivative gain)times the magnitude of error +
Controller's OutputController's Transfer Function
dtdekdtekeku dip
SKSKeKu di
p
Risetime Maximumovershoot
Settlingtime Steady-state error
P Decrease Increase Smallchange
Decrease
I Decrease Increase Increase Eliminate
D Smallchange
Decrease Decrease Smallchange
Characteristics of PID Controllers Proportional Controller Kp reduces the rise time reduces but never eliminates steady-state errorIntegral Controller Ki eliminates steady-state error worsens transient response Derivative Controller Kd increases the stability of the system reduces overshoot improves transient response
• Manual tuning This method for setting the parameters of a PID-mode controller
manually. First a PID Controlling loop for the targeted Process is constructed. Then the KI, and Kd values are set to zero. Then increasing the KP value until the output of the loop oscillates, Then the KP value is set to approximately half of this value . Then
increasing KI until the steady state error is eliminated in sufficient time(the time must be as small as possible).
Finally, increasing Kd until a small settling time(time from the start point until the error e is 0 in the loop) is observed
• The (open) loop transfer function is given by simulink model • The steady-state value for the output is:
0.10.09920.02
2F(s)X(s)sF(s)limsX(s)limx(t)limx
0s0stss
No controller
2/20.02=0.099 is the final value of the output to an unit step input.This corresponds to a steady-state error of 99%, quite large!The settling time is about 1.83sec.
Step Response open loop system without controller
Time (seconds)
Am
plitu
de
0 0.5 1 1.5 2 2.5 3 3.5 40
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
System: sysSettling time (seconds): 1.83System: sys
Rise time (seconds): 1.01
System: sysFinal value: 0.0999
matlab codesys=tf([2],[1 11 20.02]);step(sys);grid
)202.20(112
20112
1
02.20112
)()(
2
2
2
p
p
p
p
KssK
ssK
ssK
sFsX
The closed loop transfer function is given by:
Controlled system outputs with for various Kp
Let Kp= 10 50 100 1500
Proportional control Step Response closed loop DC servo motor w ith controller (KP)
Time (seconds)
Ampl
itude
0 0.2 0.4 0.6 0.8 1 1.20
0.2
0.4
0.6
0.8
1
1.2
1.4
kp=10kp=50kp=100kp=150
sys=tf([2],[1 11 20.02]);sys_cl = feedback(10*sys,1);hold on; step(sys_cl)sys_cl1 = feedback(50*sys,1);hold on;step(sys_cl1)sys_cl2 = feedback(100*sys,1);hold on;step(sys_cl2)sys_cl3 = feedback(150*sys,1);hold on ;step(sys_cl3)legend('kp=10','kp=50','kp=100','kp=150')
• The above plot shows that the proportional controller
reduced both the rise time and the steady-state error,
increased the overshoot, and decreased the settling
time by small amount.
PD Controller
)202.20()211(2
02.20112
1
02.20112
)()(
2
2
2
pd
dp
dp
dp
KsKssKK
sssKK
sssKK
sFsX
The closed loop transfer function is given by:
Step Response with PD controller
Time (seconds)
Am
plitu
de
0 0.2 0.4 0.6 0.8 1 1.20
0.2
0.4
0.6
0.8
1
1.2
1.4
System: sys_cl4Final value: 0.909
kd=1kd2=4kd3=8kd4=12
sys=tf([2],[1 11 20.02]);Kp=100; Kd=1;contr=tf([ Kd , Kp ],1 ) ; sys_cl = feedback(contr*sys,1);step(sys_cl);zpk(sys_cl)Kd2=4; contr=tf([ Kd2 , Kp ],1 ) ; sys_cl2 = feedback(contr*sys,1);hold on ; step(sys_cl2)Kd3=8; contr=tf([ Kd3 , Kp ],1 ) ; sys_cl3 = feedback(contr*sys,1);hold on ; step(sys_cl3)Kd4=12; contr=tf([ Kd4 , Kp ],1 ) ; sys_cl4 = feedback(contr*sys,1);hold on ; step(sys_cl4)legend('kd=1','kd2=4','kd3=8','kd4=12')grid
Let kp=100 , kd=10
This plot shows that the proportional derivative controller reduced both the overshoot and the settling time, and had small effect on the rise time and the steady-state error.
PI Controller
ip
ip
ip
ip
KsKssKsK
sssKK
sssKK
sFsX
2)220.20(112
02.2011/2
1
02.2011/2
)()(
23
2
2
The closed loop transfer function is given by:
• Let kp=30 and Ki=1,4,8,12• We have reduced the proportional gain because
the integral controller also reduces the rise time and increases the overshoot as the proportional controller does (double effect).
The above response shows that the integral controller eliminated the steady-state error.
Step Response with PI controller (Kd=30 Ki=1,4,8,12)
Time (seconds)
Am
plitu
de
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
kd=1ki2=4ki3=8ki4=12
sys=tf([2],[1 11 20.02]);Kp=30; Ki=1;contr=tf([Kp,Ki],[1,0]) ; sys_cl = feedback(contr*sys,1);step(sys_cl);Ki2=4; contr=tf([Kp,Ki2],[1,0]) ; sys_cl2 = feedback(contr*sys,1);hold on ; step(sys_cl2)Ki3=8; contr=tf([Kp,Ki3],[1,0]) ; sys_cl3 = feedback(contr*sys,1);hold on ; step(sys_cl3)Ki4=12;contr=tf([Kp,Ki4],[1,0]) ; sys_cl4 = feedback(contr*sys,1);hold on ; step(sys_cl4)legend('kd=1','ki2=4','ki3=8','ki4=12')grid
PID Controller
ipd
ipd
idp
idp
KsKsKsKsKsK
sssKsKK
sssKsKK
sFsX
2)220()210(2
2010/2
1
02.2011/2
)()(
23
2
2
2
The closed loop transfer function is given by:
Now, we have obtained the system with no overshoot, fast rise time, and no steady-state error.
Step Response w ith PID controller
Time (seconds)
Am
plitu
de
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.020
0.5
1
1.5
System: sys_clSettling time (seconds): 0.00755
System: sys_clTime (seconds): 0.00359Amplitude: 0.908
System: sys_clFinal value: 1
sys=tf([2],[1 11 20.02]);%adding PID controllerKp = 350;Ki = 300;Kd = 50;contr=tf([Kp Kd Ki ],[1 0]) ; sys_cl = feedback(contr*sys,1);step(sys_cl);grid
P-I-D controller for second order plant requires tuning. Using the automatic tuning option of MATLAB-Simulink one can get the following results:
. DISCRETISING WITH A SAMPLE AND HOLD
%Plant Transfer functionJ = 0.01;b = 0.1;K = 0.01;R = 1;L = 0.5;s = tf('s');P_motor = K/((J*s+b)*(L*s+R)+K^2);zpk(P_motor) % Zero/Pole/Gain%% Discretized Transfer FunctionTs =0.05; % Sampling Period dP_motor = c2d(P_motor,Ts, 'zoh'); % methodzpk(dP_motor)
sec 0.05Tat 1.1
0.251
0.251
0.251
0.25
11
003.22
11
997.92
003.2997.92
1997.91003.21
997.91003.21
997.91
003.21
zezez
zA
ezez
ezezssZ
TT
TT
TT
)E( of polesat
1-Z-11)E( of residues
Te
zE
6066.09047.0
1-z0.07458
1.6066.0
25.09047.0
25.0
zz
zz
zz
zz
Matlab Result
11.2
zz
Ts
s
Zero Order Hold(zoh) First Order Hold(foh) Impulse Inavriant Mapping(Impulse) Tunstin Approximation(Tunstin) Zero Pole Matching Equivalent(matched).
continuous - Discrete Conversion Methods
use the bilinear transformation This transformation maps the entire left half of the s-plane into the unit circle in the z-plane shown below
Zero Order Hold mpulse Inavriant Mapping
0.0020586 (z+0.8189) ----------------------------- (z-0.9047) (z-0.6066)
0.00095237 (z+1)^2 --------------------------------- (z-0.9046) (z-0.6001)
Tunstin Approximation Zero Pole Matching
0.0037288 z ---------------------------- (z-0.9047) (z-0.6066)
0.0018722 (z+1) ----------------------------- (z-0.9047) (z-0.6066)
Transfer function shown below
Ts = 0.05;J = 0.01;b = 0.1;K = 0.01;R = 1;L = 0.5;s = tf('s' );P_motor = K/((J*s+b)*(L*s+R)+K^2);zpk(P_motor);dP_motor = c2d(P_motor,Ts, 'tunstin' )zpk(dP_motor); syms s T zG = 2/(s+9.997)/(s+2.003);Gd = simplify(subs(G,s,2/T*(1-1/z)/(1+1/z))); pretty(Gd)
0.0009524 z^2 + 0.001905 z + 0.0009524 ----------------------------------------------------------
z^2 - 1.505 z + 0.5429
2 2 2000000 T (z + 1)
----------------------------------------------------------------------------------------- (2003 T + 2000 z + 2003 T z - 2000) (9997 T + 2000 z + 9997 T z - 2000)
0 0.5 1 1.5 2 2.5 30
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
compere step response of closed loop with Discrete Conversion Methods
Time (s) (seconds)
Velo
city
(rad
/s)
zohtunstinImpulsematched
Zero Order Hold mpulse Inavriant Mapping
0.0020586 (z+0.8189) ----------------------------- (z-0.8924) (z-0.6169)
0.00095147 (z+1)^2 ----------------------------- (z-0.893) (z-0.6084)
Tunstin Approximation Zero Pole Matching
0.0037288 z ------------------------- (z-0.8931) (z-0.6145)
0.0018722 (z+1) -------------------------- (z-0.8923) (z-0.6171)
we will again use the c2d command in MATLAB to convert the continuous time PID compensator to discrete-time PID compensator by specifying 'tustin' as the conversion method. Tustin's method uses the bilinear transformation to convert a continuous model to discrete time
The steady state error of the system is to 0.09 which was 0.1 in continuous time.
099.0
0.6066)-(z 0.9047)-(z1)+(z 0.0018722
0.6001)-(z 0.9046)-(z1)+(z 0.00095237
0.6066)-(z 0.9047)-(z0.8189)+(z 0.0020586
lim_
lim1
1lim1limgain-dc
2
1
111
z
zzz
gaindc
zGzzzGzzCz
DISCRETE ROOT LOCUS DIAGRAMS
stability is dependent on the denominator (characteristic equation)
01 zGzKH
-1.5 -1 -0.5 0 0.5 1 1.5-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Root Locus of Compensated System
Real Axis
Imag
inar
y A
xis
Gd_oldata2Gd_ol
s = tf('s' );P_motor = K/((J*s+b)*(L*s+R)+K^2);zpk(P_motor)% plant, Gp(s)Ts = 0.05;dP_motor = c2d(P_motor,Ts, 'zoh' );zpk(dP_motor);% plant, Gp(z)%adding PID controllerKp = 100;Ki = 200;Kd = 10;C = Kp + Ki/s + Kd*s;dC = c2d(C,Ts, 'tustin' )Gd_ol=dC*dP_motor ;zpk(Gd_ol) % open loop Q(z)Gp(z)sys_cl = feedback(Gd_ol,1);zpk(sys_cl)rlocus(Gd_ol);axis([-1.5 1.5 -1 1])title('Root Locus of Compensated System');figurerlocus(dP_motor) % plot root locus, see Fig. 2.18.axis([-1.5 1.5 -1 1])title('Root Locus without Compensated System');
Root Locus w ithout Compensated System
Real Axis
Imag
inar
y A
xis
-1.5 -1 -0.5 0 0.5 1 1.5-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
dP_motor
PID controller open loop plant without controller
505 z^2 - 790 z + 305 ---------------------------- z^2 - 1
0.0020586 (z+0.8189) --------------------- (z-0.9047) (z-0.6066)
open loop plant with controller
1.0396 (z+0.8189) (z-0.8707) (z-0.6936) ---------------------------------------
(z+1) (z-1) (z-0.9047) (z-0.6066)
From this root-locus plot, we see that the denominator of the PID controller has a pole at -1 in the z-plane. We know that if a pole of a system is outside the unit circle, the system will be unstable. This compensated system will always be unstable for any positive gain because there are an even number of poles and zeros to the right of the pole at -1. Therefore, a closed-loop pole will always move to the left and outside the unit circle as the loop gain is increasedThe pole at -1 comes from the compensator, hence we can change its location by changing the compensator design. In this case we choose to cancel the zero at -0.82, this will make the system stable for at least some gains. chosen gain=0.89
z = tf('z',Ts);dC = dC/(z+0.82);rlocus(dC*dP_motor);axis([-1.5 1.5 -1 1])title('Root Locus of Compensated System');
-1.5 -1 -0.5 0 0.5 1 1.5-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1Root Locus of Compensated System
Real Axis
Imag
inar
y A
xis
The new closed-loop system will have a pole near -0.82 instead of -1, which almost cancels the zero of the uncompensated plant. Click on the root locus curve in several places to see the gain that places a closed-loop pole at a particular location, along with the corresponding overshoot, damping, etc., as shown in the figure below. Of course, the damping and overshoot numbers correspond to the actual response only if the selected closed-loop pole is dominant
z = tf('z',Ts);dC = dC/(z+0.82);rlocus(dC*dP_motor);axis([-1.5 1.5 -1 1]) zeta = 0.6; Wn = 0.3; zgrid(zeta,Wn) [k poles]=rlocfind(dC*dP_motor)sys_cl = feedback(k*dC*dP_motor,1);[x3,t] = step(sys_cl,8);stairs(t,x3);gridxlabel('Time (seconds)')ylabel('Velocity (rad/s)')title('Stairstep Response: with Modified PID controller')
-1.5 -1 -0.5 0 0.5 1 1.5-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
0.3
0.3
0.6
Root Locus
Real Axis
Imag
inar
y A
xis
selected_point = -0.0746 + 0.2453ik = 0.9434poles = -0.8184 + 0.0000i 0.8390 + 0.0000i 0.7973 + 0.0000i -0.0633 + 0.2448i -0.0633 - 0.2448i
• shows that the settling time is less than 2 seconds and the percent overshoot is around 2%. Additionally, the steady-state error is zero. Therefore, this response satisfies all of the given design requirements.
Step Response
Time (seconds)
Ampl
itude
0 1 2 3 4 5 6 7 80
0.2
0.4
0.6
0.8
1
1.2
1.4