You are on page 1of 6

EE571 -Solution to Prelab5

PLEASE USE MY NUMBERS OR CLOSE TO MY NUMBERS:

Lead Compensator: Kc=0.898, Zc=5.4, Pc=22.25


Lag Compensator: Klag=1.0063, Zlag=0.1148, Plag=0.01
PD Compensator: Kd=0.0758, Kp = 0.455
PID Compensator: Kd=0.0772, Kp=0.472, Ki=0.0526

Recall from Lab 1, we determined our closed-loop transfer function for the Motomatic to be
Vout (s) 210.86
= 2 1 where Vout is proportional to θout.
Vin (s) s + 5.27s + 210.86
+ y
w
G(s)
-

1 a) Find the equivalent open-loop transfer function, G(s), if we configure the Motomatic as a unity feedback
system (see Fig. 1).

Solution: G/(1+G)=210.86/(s2+5.27s+210.86) = Gclosed-loop(s). Thus, G=Gclosed-loop(s)/(1- Figure 1 - Unity


Gclosed-loop(s))= 210.86/(s2+5.27s) Feedback System

b) Sketch the uncompensated root-locus for the Motomatic. What are the current
closed-loop poles? What is ts and Mp?

σ
-5.27 -2.635

Solution: The current closed-loop poles are the roots of s2+5.27s+210.86 = 0. Or, s=-2.6350 + j14.2799 and s=-
2.6350 - j14.2799. Thus, the settling time is 4/2.635 = 1.51 seconds. ω n = 210.86 = 14.52 rad / sec and ζ =
2.635/14.52 = 0.1815. The overshoot is then given by M p = exp( −ζπ / 1 − ζ 2 ) × 100% = 56.01%

c) What type number is the system? What is ess|step? What is ess|ramp?

Solution: The system is a type 1 system. ess|step = 0 and ess|ramp = 5.27/210.86 = 0.025

d) Design a lead compensator to meet the following specs:


i) ts ≤ 0.4 sec
ii) Mp ≤ 2%
What is your angle of deficiency? Is it reasonable? Sketch the root locus of the lead compensated system.

Solution: From the settling time spec, we see that the real part of the dominant poles must be to the left of -10.
From the overshoot spec, we find that our damping ratio spec must be ζ ≥ 0.78 or θ ≤ 38.77° . The combination
of these two conditions is depicted in the red area below:

38.77 degrees

-10

For our initial try at the design, let’s pick the dominant poles to be s1=-11+j8. The angle of deficiency is then:
∠Gc ( s1 ) = 180 o × odd #−∠G ( s1 ) = 180 o × odd #−∠ s1 (210
s1 + 5.27 ) = 180 − 90.42 = 89.58 .
.86 o o o
Therefore, our lead
compensator must supply 89.58 degrees which is rather large (i.e., perhaps a PD compensator would be more
appropriate). If we assume that the form of Gc is Gc(s)=Kc(s+zc)/(s+pc) then let’s pick pc to be deep in the LHP,
say pc = 100. Then ∠Gc ( s1 ) = 89.58o = ∠( s1 + z c ) − ∠( s1 + 100) = ∠( s1 + z c ) − 5137 . o or ∠( s1 + z c ) = 94.71o .
Solving for zc: IM ( s1 ) / RE ( s1 + z c ) = tan(94.71o ) or z c = IM ( s1 ) / tan(94.71o ) − RE ( s1 ) = 10.34 . The last step is
to find Kc from the magnitude condition: K c = 1/| G( s1 )( s1 + z c ) / ( s1 + pc )| = 7.066 . Thus, the lead compensator
is Gc(s)=7.066(s+10.34)/(s+100). The closed-loop poles for the lead compensated system are -11+j8, -11-j8, -
83.27. Clearly, the desired poles at -11+j8 are very dominant and the step response should meet our specs, right?
No. Unfortunately the zero of our lead compensator at s=-10.34 tends to amplify the amount of overshoot as
shown in the following MATLAB closed-loop step response:
EE571 - Prelab5: First Attempt at Lead Design
1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1
time (sec)

Note that while the settling time is under the required 0.4 seconds, the overshoot is much greater than 2% (about
10%). Hence, we must redesign! This time, we will pick our compensator zero to be very close to the open-loop
pole at s=-5.27 in an attempt to cancel the negative effects of the zero. Let zx= 5.4 and then
∠Gc ( s1 ) = 89.58 o = ∠( s1 + 5.4) − ∠( s1 + pc ) = 124.99°−∠( s1 + pc ) or ∠( s1 + pc ) = 35.41o Solving for pc:
IM ( s1 ) / RE ( s1 + pc ) = tan(35.41 ) or pc = IM ( s1 ) / tan(35.41 ) − RE ( s1 ) = 22.25 . The last step is to find Kc from
o o

the magnitude condition: K c = 1/| G ( s1 )( s1 + z c ) / ( s1 + pc )| = 0.898 . Thus, the lead compensator is


Gc(s)=0.898(s+5.4)/(s+22.25). ). The closed-loop poles for the lead compensated system are -11+j8, -11-j8, -5.52.
Ordinarily, the pole at s=-5.52 would be dominant, but since we inserted a zero at s=-5.4, these should cancel each
other and the desired poles should be dominant again.
EE571 - Prelab5: 2nd Attempt at Lead Design
1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1
Notice that not only does our second design produce about 2% overshoot, but also has a much quicker settling
time of about 0.28 seconds!

e) Now design a lag compensator to put in series with your lead compensator to meet the additional spec that
ess|ramp = 1/100. Sketch the root locus of the lead-lag compensated system.

With our lead compensated system, K v = lim GcG ( s) = (Kc)(zc)(210.86)/[(5.27)(pc)] = 8.71. Thus, we need to
s→ 0

increase the steady-state gain by 100/8.71 = 11.48 times to meet the steady-state error specs! To meet the ess|ramp =
1/20 spec, we need to add a lag compensator of the form Glag = Klag(s+zlag)/(s+plag) where Klag is about 1 and plag <
zlag. To meet the spec, we must have ess|ramp = 1/100 = 1/Kv or Kv = 100. Or,
100 = K v = lim sGlag Gc G ( s ) = ( z lag )( K c )( z c )( 210.86) / (( plag )( 5.27)( pc )) = ( z lag )(8.71) / ( plag ) Thus, if we
s→ 0

choose plag = 0.01, then zlag = 100plag /(8.71) = 0.1148. Finally, we can find Klag from the magnitude condition:
K c = 1/| Gc G( s1 )( s1 + z lag ) / ( s1 + plag )| = 10063
. . Thus, the lag compensator is Glag(s)=1.0063(s+0.1148)/(s+0.01).
According to MATLAB, the closed-loop poles (i.e., the roots of 1+GlagGcG(s)) are {-10.95 + j8.0, -10.95 - j8.0, -
5.5274, -0.1162}. The pole at s=-0.1162 should be cancelled by the zero at s=-0.1148 and the pole at -5.5274
should be cancelled by the zero at s=-5.4 (we hope!). The root locus looks like:

s1=-11+j8

σ
-22.25 -5.4 -5.27
-0.114

f) Obtain MATLAB plots of the step and ramp responses for the uncompensated, lead, and lead-lag systems.
Measure the following performance parameters: ts, Mp, and ess|step for each system. If your designs do not
meet specs, redesign until they do!
EE571 - Prelab5: Lead-Lag Compensated Step Response EE571 - Prelab5: Lead-Lag Compensated Ramp Error
1.2 EE571 - Prelab5: Lead-Lag Compensated Ramp Response 0.12
1

1 0.1
0.8
0.8 0.08
0.6
0.6 0.06
0.4
0.4 0.04

0.2 0.2 0.02

0 0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50
time (sec) time (sec) time (sec)
For the lead-lag system, ts =0.3 sec, Mp = 2%, ess|step = 0, and ess|ramp = 1/100. Note that the steady-state ramp error
requires a long time to die out!

2 a) Design a PD compensator to meet the specifications given in problem 1d).

A PD compensator is of the form of GPD(s) = KDs+KP = KPD(s+zPD). Here, once we pick a pair of desired
dominant poles, then zPD is uniquely determined. If we again choose the dominant poles to be s1 =-11+j8, then
∠G PD ( s1 ) = 89.58 o = ∠( s1 + z PD ) . Solving for zPD we find that
IM ( s1 ) / RE ( s1 + z PD ) = tan(89.58 ) or z PD = IM ( s1 ) / tan(89.58 ) − RE ( s1 ) = 1158
o o
. . The last step is to find Kc
from the magnitude condition: K c = 1/| G( s1 )( s1 + z PD )| = 0.0793 . Thus, the PD compensator is
GPD(s)=0.0793(s+11.58). According to MATLAB, the closed-loop poles for the PD compensated system are -
11+j8, -11-j8. Clearly, since the PD compensator does not add an additional pole, the desired poles at -11+j8 are
dominant and the step response should meet our specs, right? No. Unfortunately once again the zero of our PD
compensator at s=-11.58 tends to amplify the amount of overshoot as shown in the following MATLAB closed-
loop step response:
EE571 - Prelab5: First Attempt at PD Compensator Design
1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1
time (sec)
The settling time is well within the 0.4 sec spec but the overshoot is close to 10%. Since the PD design is unique,
we are stuck, right? Wrong! The PD design is unique for a given pair of dominant poles but we do have the
design freedom to change the desired poles! Let’s look at the root locus of our current PD compensator:

s1=-11+j8 j8

σ
-11.58 -5.27

-j8

If we could pick a gain such that one of the two poles was near the zero at s=-11.58, then the effect of the zero
should be negated. Obviously, the root locus passes thru points just to the left of s=-11.58 so let’s choose s1=-12
and find KPD from the magnitude condition: K PD = 1/| G( s1 )( s1 + z PD )| = 0.4066 . Thus, the PD compensator is
GPD(s)=0.4066(s+11.58). According to MATLAB, the closed-loop poles for the PD compensated system are -12
and -79. We hope that the pole at s=-12 will cancel the effects of the zero at s=-11. The following MATLAB
closed-loop step response:
EE571 - Prelab5: 2nd Attempt at PD Compensator Design
1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1
time (sec)
This design nearly meets our specs, however the overshoot is slightly greater than 2%. As a final PD design,
consider the root locus when we move zPD closer to the pole at s=-5.27, say at zPD = 6:

-6 -5.27 σ

Here, the philosophy is to make the open-loop pole at s=-5.27 help in canceling the effects of the PD
compensator zero, now located at s=-6. Let’s choose one closed-loop pole to be close to this zero at say s1=-6.5
and find KPD from the magnitude condition: K PD = 1/| G( s1 )( s1 + z PD )| = 0.0758 . Thus, the PD compensator is
GPD(s)=0.0758(s+6) = 0.0758s+0.455. According to MATLAB, the closed-loop poles for the PD compensated
system are -6.5 and -14.76. The following is the MATLAB closed-loop step response:
EE571 - Prelab5: 3rd Attempt at PD Compensator Design EE571 - Prelab5: 3rd Attempt at PD Design Ramp Response EE571 - Prelab5: 3rd Attempt at PD Design Ramp Error
1.2 1 0.06

1 0.8 0.05

0.8 0.04
0.6
0.6 0.03
0.4
0.4 0.02

0.2
0.2 0.01

0 0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec) time (sec)

Note that the settling time is now about 0.2 seconds and the overshoot is less than 1%. The steady-state ramp error
is about 0.055 compared to the theoretical value of 5.27/(0.0758x6X210.86)=0.0552.

b) Design PID compensator to meet the following specifications:


i) ts ≤ 0.4 sec
ii) Mp ≤ 2%
iii) ess|ramp = 0 (hint: notice that any Ki will work for this spec, so try to pick Ki small)
Sketch the compensated root locus.

A PID compensator is of the form of GPID(s) = KDs+KP+KI/s. The PID design process is unique among our root
locus-based compensator designs. The first step, is to satisfy the steady-state error specs. Note that any KI will
make ess|ramp = 0. If a specification on the steady-state error due to a parabola were specified, then KI would be
unique. However, in this problem let’s pick KI to be small (say 0.1), then find KP and KD from:
K P + K D s1 = −1 / G( s1 ) − K I / ( s1 )
Here, once we pick a pair of desired dominant poles, then KP and KD are uniquely determined. If we again choose
the dominant poles to be s1 =-11+j8, then K P + K D s1 = K P − 11K D + j 8 K D = 0105
. + j 0.639 . By equating the
imaginary part of this equation we find that KD = 0.639/8 = 0.0799. By substituting this value and equating the
real part of our equation, we find that KP = 0.105+11(0.0799)=0.8893. Thus, GPID(s) = KDs+KP+KI/s =
0.0799s+0.8893+0.1/s. According to MATLAB, the closed-loop poles for the PID compensated system are -
11+j8, -11-j8, and -0.114. Fortunately, the zeroes of the PID compensator are at -0.1136 and -11.02. We hope
that the zero at -0.1136 will cancel the pole at -0.114 and that the zero at -11.02 will not amplify the overshoot of
the step response too much. The following is the MATLAB closed-loop PID step response:
EE571 - Prelab5: 1st Attempt at PID Design
1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1
time (sec)
As can be seen from the PID step response, the settling time is fine (about 0.39 seconds) but the overshoot is
nearly 10%! This can be attributed to the zero at s=-11.02 amplifying the overshoot as we feared. As a solution,
let’s consider the root locus of the PID compensator design:

s1=-11+j8

σ
-11.02 -5.27
-0.114

Here, just like in the PD design, we could increase the gain and force a closed-loop pole to move closer to the
offending zero. However, if we recall that strategy did not bring the overshoot below our goal of 2%. Instead,
let’s pick a new zero closer to the open-loop pole at -5.27 (say at s=-6) and keep the other zero at -0.114. The
new root locus would look like:

s1=-6.5
σ
-6 -5.27
-0.114

Just as in the PD design problem, let’s put a desired closed-loop pole at s1 =-6.5 and recalculate the gain
necessary to produce this pole from the magnitude condition: K D = 1/| G ( s1 )( s1 + 0114
. )( s1 + 6) / ( s1 )| = 0.0772 .
Thus, GPID(s) = KDs+KP+KI/s = 0.0772(s+6)(s+0.114)= GPID(s) = 0.0772s+0.472+0.0526/s. Matlab tells us that
the closed-loop poles are -14.9301, -6.5000, -0.1143.

c) Again, obtain MATLAB plots for the step and ramp responses for the PD and PID compensators. Use
Matlab to simulate your controller. Make any adjustments needed to meet specs. Measure the following
performance parameters: ts, Mp, and ess|ramp for each system.
. The step, ramp, and ramp error responses are:
EE571 - Prelab5: 2nd Attempt at PID Design EE571 - Prelab5: 2nd Attempt at PID Design Ramp Error
1.2 EE571 - Prelab5: 2nd Attempt at PID Design Ramp Response 0.06
1
1 0.05
0.8
0.8 0.04

0.6
0.6 0.03

0.4
0.4 0.02

0.2 0.2 0.01

0 0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 10 20 30 40 50
time (sec)
As can be seen, the settling time is about 0.2 seconds while Mp is about 1% and the ramp error goes to zero!

You might also like