Solution for Take Home Exam 1
-
Upload
steve-rogers -
Category
Documents
-
view
238 -
download
4
description
Transcript of Solution for Take Home Exam 1
Solution for Take Home Exam 1Problems 2.6, 2.7, 2.8, 2.12, 3.4, 3.5, 3.9, & 3.10.
2.6 For the open-loop system ,
a) Design feedback assuming you have access to all the state elements. Place the closed-loop system poles at s = [-1 +- 1j, -0.5 +- 5j].b) Design an estimator for the system so that it has poles at s = [-2 +- 2j, -2 +- 8j]. c) Find the transfer function of the complete controller consisting of the control from part a) and the estimator from part b).
Please note that some students achieved better results than this. This is not intended to show the ‘best’ result; it is to illustrate the main elements of a solution procedure and display of results.
The matlab code is:
function prob_2_6()%sysG = tf(1,[1 0 25 0 0]);sys = ss(sysG);[F,G,H,J] = ssdata(sysG);[F,G,H,J] = ssdata(sys);% part apc = [-1-i,-1+i,-.5+5i,-.5-5i];K = acker(F,G,pc)%part bpe = [-2-2*i,-2+2*i,-2+8*i,-2-8*i];L = acker(F',H',pe)'% part crsys = ss(F-L*H-G*K,L,-K,J);rsys = reg(sys,K,L);sysCL = -feedback(sys*rsys,1,+1);figure(1)step(sysCL)[num,den] = tfdata(rsys);tf(num,den)
The results are:
K =
6.0000 2.1250 26.2500 25.2500
L =
-565.5000 208.0000 134.0000 16.0000
Transfer function:-970.5 s^3 + 3763 s^2 - 4.391e004 s - 2.747e004----------------------------------------------------------- s^4 + 11 s^3 + 120.2 s^2 + 591.5 s + 1611
0 1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8Step Response
Time (sec)
Ampl
itude
poleplacetransfer function
Note the difference in the response between the desired response and the controlled response with the estimator. My only explanation is that it’s an artifact of the estimator placement poles.
2.7 Consider a pendulum with control torque Tc and disturbance torque Td whose differential equation is: . Assume there is a potentiometer at the pin that measures the output angle , that is, .
a) Design a lead compensation using a root locus that provides for an Mp < 10% and a rise time tr < 1 sec.b) Add an integral term to your controller so that there is no steady-state error in the presence of a constant disturbance, Td, and modify the compensation so that the specifications are still met. The code is:
function prob_2_7a()%sys = tf(1,[1 0 4]);a = 2;b = 150;sysd = tf([1 a],[1 b]);figure(1)margin(sys)figure(2)OL = sys*sysd;margin(OL)figure(3)k = 0:10:1500;rlocus(OL,k),axis([-10,0,0,3])w = 50;z = 1;k = rlocfind(OL,-z*w+w*sqrt(1-z*z)*i);figure(4)OL = k*OL;margin(OL)figure(5)sysCL = feedback(OL,1);y = step(sysCL,5);ymax = max(y);Mp = (ymax/y(end)-1)*100;step(sysCL,3),grid ontitle(['step with [Mp,k] = ',num2str([Mp,k])])
-100
0
100
200
300
400M
agni
tude
(dB)
10-1
100
101
102
103
104
-540
-495
-450
-405
-360
-315
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 73.8 deg (at 34.1 rad/sec)
Frequency (rad/sec)
0 0.5 1 1.5 2 2.5 30
0.2
0.4
0.6
0.8
1
1.2
1.4step w ith [Mp,k] = 9.9573885 5216.6667
Time (sec)
Ampl
itude
The matlab code is:
function prob_2_7b()%sys = tf(1,[1 0 4]);a = 3;a1 = 0.15;b = 150;sysd = tf([1 a],[1 b])*tf([1 a1],[1 0]);figure(1)OL = sys*sysd;margin(OL)figure(2)% subplot(211)k = 0:10:3000;rlocus(OL,k),axis([-10,0,0,4])w = 0.25;z = 0.6;k = rlocfind(OL,-z*w+w*sqrt(1-z*z)*i);figure(3)% k = 220;OL = k*OL;margin(OL)figure(4)sysCL = feedback(OL,1);y = step(sysCL);ymax = max(y);Mp = (ymax/y(end)-1)*100;step(sysCL)title(['step with [Mp,k] = ',num2str([Mp,k])])figure(5)sysDist = feedback(sys,sysd);step(sysDist)
-200
-100
0
100
200
300
400M
agni
tude
(dB)
10-3
10-2
10-1
100
101
102
103
104
-540
-495
-450
-405
-360
-315
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 45.3 deg (at 3.46 rad/sec)
Frequency (rad/sec)
0 10 20 30 40 50 60 700
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1step w ith [Mp,k] = 0 261.1323
Time (sec)
Ampl
itude
0 1000 2000 3000 4000 5000 6000 7000 80000
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5Step Response
Time (sec)
Ampl
itude
2.8 Consider a pendulum with control Tc and disturbance torque Td whose differential equation is . Assume there is a potentiometer at the pin that measures the output angle , that is, . a) Design a lead compensation using frequency response that provides for an PM > 50 degrees and a bandwidth > 1 rad/sec.b) Add an integral term to your controller so that there is no steady-state error in the presence of a constant disturbance, Td, and modify the compensation so that the specifications are still met.
The matlab code is:
function prob_2_8a()%w = 5;a = w/sqrt(10);b = w*sqrt(10);k = 100;sys1 = tf(1,[1 0 4]);D = k*tf([1 a],[1 b]);sys2 = D*sys1;figure(1)margin(sys1)figure(2)margin(sys2)
The original plant bode diagram is shown below.
-50
0
50
100
150M
agni
tude
(dB)
10-1
100
101
-360
-315
-270
-225
-180
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 0 deg (at 2.24 rad/sec)
Frequency (rad/sec)
The compensated system bode diagram is:
-100
0
100
200
300
400
Mag
nitu
de (d
B)
10-1
100
101
102
103
-540
-495
-450
-405
-360
-315
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 53.9 deg (at 6.61 rad/sec)
Frequency (rad/sec)
0 0.5 1 1.50
0.2
0.4
0.6
0.8
1
1.2
1.4Step Response
Time (sec)
Ampl
itude
The main issue guiding the design of the above is to avoid the resonant peak at 2 rad/sec. Consequently, the frequency crossover must be > 2 rad/sec. As shown in the bode plot above the bandwidth > 6.61 rad/sec, thus avoiding instability due to oscillation (see the step response above).
In part b) we are to add an integrator, which will increase the slope of the system. So, the controller has 2 objectives:
1) Avoid resonant peak at 2 rad/sec by crossing over > 2 rad/sec.2) Stabilize an increased slope.
Since we must get more ‘lift’ out of our lead the simplest approach is to provide 2 sections of the original lead as below.
Lead in part a):
Lead in part b):
The matlab code is:
function prob_2_8b()%w = 7;a = w/(10);
b = w*(10);k = 40000;sys1 = tf(1,[1 0 4]);D = k*tf([1 a],[1 b 0])*tf([1 a],[1 b]);sys2 = D*sys1;figure(1)margin(sys1)figure(2)margin(sys2)figure(3)sysdist = feedback(sys1,D);step(sysdist,20)
Note that the integrator is added in the 1st section of D above. Note also, that figure (3) displays the disturbance rejection capabilities of the new system.
-50
0
50
100
150
Mag
nitu
de (d
B)
10-1
100
101
-360
-315
-270
-225
-180
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 0 deg (at 2.24 rad/sec)
Frequency (rad/sec)
-200
-100
0
100
200
300
400M
agni
tude
(dB)
10-2
10-1
100
101
102
103
104
-630
-540
-450
-360
-270
Phas
e (d
eg)
Bode DiagramGm = 24.3 dB (at 68.6 rad/sec) , Pm = 66.7 deg (at 8.56 rad/sec)
Frequency (rad/sec)
0 2 4 6 8 10 12 14 16 18 200
0.5
1
1.5Step Response
Time (sec)
step
resp
onse
0 2 4 6 8 10 12 14 16 18 200
0.02
0.04
0.06Step Response
Time (sec)
dist
urba
nce
resp
onse
2.12 For the open-loop system , use a single lead compensation in
the feedback to achieve as fast a response as possible.
From the bode diagram of the plant model a single lead will only have stabilizing effect up to ~10 rad/sec. Note that it would take 3 or more leads to stabilize the phase margin at 10 rad/sec.
The matlab code is:function prob_2_12()%sysG = tf(1,[1 2 100 0 0]);figure(1)margin(sysG)Wn = 1;a = Wn/10;b = Wn*10;k = 1800;D = tf(k*[1 a],[1 b]);figure(2)margin(D*sysG)syscl = feedback(D*sysG,1);damp(syscl)figure(3)step(syscl)
-200
-150
-100
-50
0
50
Mag
nitu
de (d
B)
10-1
100
101
102
-360
-315
-270
-225
-180
Phas
e (d
eg)
Bode DiagramGm = Inf , Pm = -0.115 deg (at 0.1 rad/sec)
Frequency (rad/sec)
-200
-100
0
100
200M
agni
tude
(dB)
10-3
10-2
10-1
100
101
102
103
-360
-270
-180
-90
Phas
e (d
eg)
Bode DiagramGm = 4.64 dB (at 9.11 rad/sec) , Pm = 74.3 deg (at 1.83 rad/sec)
Frequency (rad/sec)
0 2 4 6 8 10 12 14 160
0.2
0.4
0.6
0.8
1
1.2
1.4Step Response
Time (sec)
Ampl
itude
The damping results are:
Eigenvalue Damping Freq. (rad/s) -1.06e-001 1.00e+000 1.06e-001 -2.19e+000 1.00e+000 2.19e+000 -8.71e+000 1.00e+000 8.71e+000 -4.96e-001 + 9.41e+000i 5.26e-002 9.43e+000 -4.96e-001 - 9.41e+000i 5.26e-002 9.43e+000 The damping coefficient is 0.0526, which is slightly over 0.05 (the lower limit). Therefore, this is very close to the fastest response while maintaining the damping coefficient limit.
3.4 For the compensator use Euler’s forward rectangular method to
determine the difference equations for a digital implementation with a sample rate of 80 Hz. Repeat the calculations using the backward rectangular method and compare the difference equation coefficients.
The matlab code is:function prob_3_4()%T = 1/80;a = 2;b = 20;k = 5;cforward = [1-b*T,k*(a*T-1),k]cbackward = [1/(1+b*T),-k/(1+b*T),k*(1+a*T)/(1+b*T)]
The results are:
cforward =
0.7500 -4.8750 5.0000
cbackward =
0.8000 -4.0000 4.1000
3.5 The read arm on a computer disk drive has the transfer function G(s) = 1000/s/s. Design a digital PID controller that has a bandwidth of 100 Hz, a PM of 50 degrees, and has no output error for a constant bias torque from the drive motor. Use a sample rate of 6 kHz.
The 1st step is to design a lead that satisfies the requirements in the continuous time
domain. Therefore, which may be rewritten as
. We may now use pole placement in the numerator to help
achieve the specs. Now we inspect the bode plot of the plant. The plot on the left is the uncompensated plant while the plot on the right is the compensated plant.
-20
-15
-10
-5
0
5
10
15
20
Mag
nitu
de (d
B)
101
102
-181
-180.5
-180
-179.5
-179
Phas
e (d
eg)
Bode DiagramGm = 0 dB (at 31.6 rad/sec) , Pm = 0 deg (at 31.6 rad/sec)
Frequency (rad/sec)
-50
0
50
100
150
200
Mag
nitu
de (d
B)
100
101
102
103
104
-270
-225
-180
-135
-90
Phas
e (d
eg)
Bode DiagramGm = -15 dB (at 146 rad/sec) , Pm = 54.3 deg (at 453 rad/sec)
Frequency (rad/sec)
We can then place the roots of the numerator significantly below the desired bandwidth using a damping coefficient of 1 for real response. The pole placement concept is
illustrated as where ς = 1 and w = 2π100/f, where f >=4 and
f is used for tuning. The sampling effect on PM is calculated by . The matlab
code follows:
function Prob_3_5()%
G = tf(1000,[1 0 0]);w = 2*pi*100/4.3;% require 2 zeroes to be a factor of ~4 below desired BW% to achieve desired PM. This factor becomes a tuning parameter. T = 1/6000;z = 1;% z = .707;Td = 1/w/w;Ti = Td*2*z*w;k = 120;% k = 70;kk = k*Td/Ti;D = tf(kk*[1 Ti/Td 1/Td],[1 0]);k*[(1+T/Ti+Td/T),-(1+2*Td/T),Td/T] % equation 3.17, page 66figure(1)subplot(2,2,[1 3])margin(G),grid onsubplot(2,2,[2 4])margin(G),grid on,hold onmargin(D*G),grid on,hold offfigure(2)[Gm,Pm,Wcg,Wcp] = margin(D*G);sysCL = feedback(D*G,1);% [mag,phase,w] = bode(sysCL);% loglog(w,mag(:)),grid onstep(sysCL),grid ontitle(['step response PM = ',num2str(Pm-Wcp*180/pi*T/2)])
The step response with final PM is:
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.040
0.2
0.4
0.6
0.8
1
1.2
1.4step response PM = 52.1016
Time (sec)
Ampl
itude
The remaining part is to compute the discrete PID implementation. We may use eqn 3.17, p. 66 of the text. The results are:
k*[(1+T/Ti+Td/T),-(1+2*Td/T),Td/T] = [155.1829 -187.4434 33.7217]
3.9 The antenna tracker has the transfer function . Design a continuous lead
compensation so that the closed-loop system has a rise time tr < 0.3 sec and overshoot Mp < 10%. Modify the matlab file fig32.m so that you can evaluate the digital version of your lead compensation using Euler’s forward rectangular method. Try different sample rates, and find the slowest one where the overshoot does not exceed 20%.
For the specs we 1st try to establish the bandwidth: wn = 1.8/tr = 1.8/0.3 = 6 rad/s. So, our bandwidth should be 6 rad/s or greater for a tr < 0.3 s. Mp = 10% is relatively low so try for a large PM. The bode plot of the plant shows that the PM must be raised and the bandwidth increased by the compensator.
-80
-60
-40
-20
0
20
40
Mag
nitu
de (d
B)
10-1
100
101
102
-180
-135
-90
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 34.9 deg (at 2.86 rad/sec)
Frequency (rad/sec)
The matlab code is shown below. function Prob_3_9()%close allG = tf(10,[1 2 0]);k = 77;w = 6;a = w/5;
b = w*5;D = tf(k*[1 a],[1 b]);figure(1)margin(G)figure(2)margin(D*G)figure(3)for Hz = 25:120 frHz(Hz) = Hz; bd(Hz) = b/Hz;endplot(frHz',bd'),grid onaxis([25 120 0 4])xlabel('Hz')ylabel('discrete pole')title('stability analyses for discrete b')figure(4)tfin = 10;t = [0:0.01:tfin];y = step(feedback(D*G,1),t);ymax = (max(y)/y(end)-1)*100;step(feedback(D*G,1),0.5),hold onHz = 34;Dd = tf(k*[1 -(1-a/Hz)],[1 -(1-b/Hz)],1/Hz);Dnum = k*[1 -(1-a/Hz)];Dden = [1 -(1-b/Hz)];[numGd,denGd] = c2dm(10,[1 2 0],1/Hz,'zoh');OL = tf(conv(Dnum,numGd),conv(Dden,denGd),1/Hz);y = step(feedback(OL,1),[0:1/Hz:tfin]);ymax = [ymax,(max(y)/y(end)-1)*100];step(feedback(OL,1),[0:1/Hz:0.5]),hold onHz = 32;Dd = tf(k*[1 -(1-a/Hz)],[1 -(1-b/Hz)],1/Hz);Dnum = k*[1 -(1-a/Hz)];Dden = [1 -(1-b/Hz)];[numGd,denGd] = c2dm(10,[1 2 0],1/Hz,'zoh');OL = tf(conv(Dnum,numGd),conv(Dden,denGd),1/Hz);y = step(feedback(OL,1),[0:1/Hz:tfin]);ymax = [ymax,(max(y)/y(end)-1)*100];step(feedback(OL,1),[0:1/Hz:0.5]),hold ontitle(['step, [k a b] = ',num2str([k a b]),... ', Mp cont, 34 & 32 Hz = ',num2str(ymax)])
The remaining results are:
-100
-50
0
50M
agni
tude
(dB)
10-1
100
101
102
103
-180
-135
-90
-45
Phas
e (d
eg)
Bode DiagramGm = Inf dB (at Inf rad/sec) , Pm = 57.2 deg (at 21 rad/sec)
Frequency (rad/sec)
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.50
0.2
0.4
0.6
0.8
1
1.2
1.4step, [k a b] = 77 1.2 30, Mp cont, 34 & 32 Hz = 9.63846 19.577 22.9054
Time (sec)
Ampl
itude
A useful guide or starting point for estimating sampling frequencies is shown in figure (3) in the code as shown below:
30 40 50 60 70 80 90 100 110 1200
0.5
1
1.5
Hz
disc
rete
pol
estability analyses for discrete b
By inspection we know to begin somewhere above 30 Hz sampling rate for estimating the sampling rate effects.
3.10 The antenna tracker has the transfer function . Design a continuous
lead compensation so that the closed-loop system has a rise time tr < 0.3 sec and overshoot Mp < 10%. Approximate the effect of a digital implementation to be
, and estimate Mp for a digital implementation with a sample rate of 10
Hz.
We basically repeat 3.9 with a different means of estimation of the sampling rate effects. The matlab code is shown below. function Prob_3_10()%close allG = tf(10,[1 2 0]);k = 5;w = 5;a = w/2;b = w*2;D = tf(k*[1 a],[1 b]);figure(1)
tfin = 10;Hz = 10;t = [0:0.01:tfin];t1 = [0:0.01:1];y = step(feedback(D*G,1),t);ymax = (max(y)/y(end)-1)*100;step(feedback(D*G,1),t),hold ony = step(feedback(D*G*tf(2*Hz,[1 2*Hz]),1),t);ymax = [ymax,(max(y)/y(end)-1)*100];step(feedback(D*G*tf(2*Hz,[1 2*Hz]),1),t1),hold on, grid ontitle(['step, [k a b] = ',num2str([k a b]),... ', Mp = ',num2str(ymax)])
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.2
0.4
0.6
0.8
1
1.2
1.4step, [k a b] = 5 2.5 10, Mp = 10.1018 22.0988
Time (sec)
Ampl
itude
continuousdiscrete appox