You are on page 1of 10

Experiment 4

Lead-Lag Compensation
4.1 Introduction
Among the simplest dynamic structures used in compensator design is the lead-lag compensator. A lead-lag
compensator has a transfer function of the form
G

(:) =
(: +.
1
) (: +.
2
)
(: +j
1
) (: +j
2
)
. (4.1)
In this experiment, we will use the lead-lag structure to enhance the performance of an operational
amplier. An op amp is dierent from the other control systems with which we are working this semester
in that it is a purely electrical device, operating over a relatively high range of frequencies and at low power
level. Nevertheless, compensator design problems for an op amp are mathematically similar to compensator
design problems for more conventional control systems such as a servomotor.
4.2 Operational Amplier Model
In this experiment, you will be using the power amplier from the previous experiments as the plant. Besides
the power supply, heat sinks, and miscellaneous hardware, the amplier consists of an LM12 power op amp.
A close approximation to the actual response of the LM12 is given by the transfer function
G(:) =
: + 1.88 10
6
(: + 377)(: + 3.77 10
5
)(: + (2.83 +,4.81) 10
6
))(: + (2.83 ,4.81) 10
6
)
(4.2)
=
9.33 10
19
: + 1.76 10
26
:
4
+ 6.03 10
6
:
3
+ 3.32 10
13
:
2
+ 1.17 10
19
: + 4.42 10
21
.
G(:) has a DC gain of 92dB, a zero at 300KHz, and poles at 60Hz, 60KHz, and (450 ,765)KHz. Actual
values of these parameters vary somewhat from one chip to another, but the mathematical model is still
accurate enough to obtain good results.
For the sake of numerical stability when analyzing (4.2) with MATLAB (and for overall convenience),
we will perform a frequency scaling by a factor 10
6
. This means that we must substitute 10
6
s in place of
s wherever it appears. Doing so yields
G(:) =
93.3: + 176
:
4
+ 6.03:
3
+ 33.2:
2
+ 11.7: +.00442
. (4.3)
One result of this transformation is that all frequencies (e.g. those appearing on Bode plots) must be read
as Mrad/sec, rather than rad/sec, and MHz, rather than Hz. Another result is time scaling: Values
of time must now be read as jsec, rather than sec.
It is useful to refer to the Bode plots for G(:):
25
26 EXPERIMENT 4. LEAD-LAG COMPENSATION
Figure 4.1
4.3 Phase Margin and Gain Crossover Frequency
Dene the gain crossover frequency of G to be the frequency .

where |G(,.

)| = 1. On the magnitude plot


in Figure 4.1, .

corresponds to the location of the 0dB axis crossing, yielding a value .

= 3.7710
6
rad/sec
(600KHz).
Suppose we apply unity feedback to G:
Figure 4.2
The resulting closed-loop transfer function is
H =
G
1 +G
. (4.4)
Note that, since |G| 1 for all . .

,
|H| =

G
1 +G

|G|
1 +|G|

1
2
. (4.5)
Thus the closed-loop bandwidth .

(dened in Experiment 2) and .

are related by
.

. (4.6)
4.3. PHASE MARGIN AND GAIN CROSSOVER FREQUENCY 27
Another important parameter in controller design is the phase margin of G, dened by
c

= G(,.

) + 180

. (4.7)
Phase margin of G is related to stability of the closed-loop system according to the following argument:
Suppose c

= 0. This means that G(,.

) = 180

, so G(,.

) = 1. Evaluating (4.4) at .

shows that
applying unity feedback to a plant with c

= 0 results in a closed-loop system with a pole at : = ,.

.
Consequently, H is (marginally) unstable.
A fundamental fact of feedback theory (which we state here without proof) is that the closed-loop
transfer function H is BIBO stable if and only if c

0. Moreover, it can be shown that increasing


c

tends to move the poles of the closed-loop system further to the left in the complex plane, increasing
damping. For the LM12, the phase plot of G shows that c

= 15

. Thus the op amp alone in a unity


feedback conguration would be stable.
Phase margin and gain crossover frequency can also be (somewhat loosely) related to the other closed-
loop performance specications we encountered in Experiment 2. For example, (4.6) shows that, if .

is
large, so is .

; thus even signals with substantial high frequency components tend to pass through the system
unattenuated. Large .

also tends to give large .

. In terms of the step response, large .

implies that T

and T

are small. If c

is large, the closed-loop system is heavily damped, leading to values of '

and '

close to unity. Generally, a phase margin of 60

is considered good; smaller c

tends to result in oscillatory


and overshoot phenomena in the closed-loop system response. Settling time T

is more closely related to the


compensation scheme used, rather than to c

and .

, since it depends most heavily on the location of the


closed-loop pole with the smallest real part.
The remaining specication of interest in this experiment is the DC gain |G(0)| . The relationship between
DC gain and the steady-state error c
0
to a unit step input can be obtained by applying the Final Value
Theorem of Laplace transforms, yielding
c
0
=
1
1 +|G(0)|
. (4.8)
Since op amps invariably have very large DC gains, the approximation
c
0

1
|G(0)|
(4.9)
is extremely accurate. Excluding T

, the various design parameters fall into three groups:


|G(0)| ,
1
c
0
(4.10)
.

, .

, .

,
1
T

,
1
T

,
1
'

,
1
'

Ideally, we would like |G(0)|, .

, and c

to be large. Closing the unity feedback loop around G is equivalent


to building the following circuit:
28 EXPERIMENT 4. LEAD-LAG COMPENSATION
Figure 4.3
Although we cannot actually change the plant itself, open-loop characteristics can, in eect, be altered
by connecting a compensator G

in series with the plant. The series combination G

G then replaces G in
the unity feedback conguration as shown.
Figure 4.4
The magnitude and phase characteristics of G

G can be adjusted by choosing G

.
The series combination G

Gis called the loop gain and has magnitude |G

| |G| and phase G

+G. Since
the vertical axis of the magnitude Bode plot is logarithmic, the magnitude curves for G

and G are simply


added together. Our task is to choose G

so that the values |G

(0)| |G(0)|, c

, and .

(after compensation)
are as large as possible. Since the design algorithm for G

is couched in terms of the shape of the Bode plots


of G

G, this approach is referred to as loop shaping.


4.4 Gain Compensation
The problem of gain compensation that we encountered in Experiment 2 can be expressed in terms of Bode
plots, crossover frequency, and phase margin. Let G

= 1 0. Then the phase plot for G

G is the same as
that for G, and the magnitude plot for G

G is the same as for G, except lowered by 20|oq(1,1)dB. (In op


amp compensation, 1 is almost always less than 1.) This reduces the crossover frequency to a new value .
0

and increases the phase margin to a new value c


0

.
The design strategy for gain compensation is to nd a frequency .
0

such that c
0

given by
c
0

= G(,.
0

) + 180

(4.11)
is sucient phase margin. Since setting G

= 1 has no eect on phase, equation (4.11) expresses the


relationship between achievable values of phase margin and crossover frequency for a gain compensator.
4.4. GAIN COMPENSATION 29
Then 1 must be calculated to shift the crossover frequency down to the chosen .
0

. The new gain crossover


frequency satises 1|G(,.
0

)| = 1, so 1 is determined by
1 =
1
|G(,.
0

)|
. (4.12)
This yields steady-state error
c
0

1
|G

(0) G(0)|
=
1
1|G(0)|
.
Typically, gain compensation severely restricts the closed-loop bandwidth and increases steady-state error.
In the special case of op amp compensation, standard practice is to use a resistive network to achieve the
gain 1:
Figure 4.5
Thus
1 =
1
2
1
1
+1
2
, (4.13)
and we are restricted to values 0 1 1. Although an active compensator would allow more exibility,
such a controller would employ additional ampliers. This approach would greatly add to the complexity of
the design process, since the magnitude and phase characteristics of each amplier would have to be taken
into account. Placing G

in series with G and closing the loop is equivalent to building the following circuit:
Figure 4.6
For a given 1, resistance values may be obtained by solving (4.13) for 1
1
:
1
1
=

1
1
1

1
2
(4.14)
The freedom in choosing 1
2
may be exploited to avoid interactions between the compensator and the input
and output impedances of the amplier.
30 EXPERIMENT 4. LEAD-LAG COMPENSATION
4.5 Lead-lag Compensation
Lead-lag compensation is achieved by using the following network:
Figure 4.7
The network transfer function is
G

(:) =
(: +.
1
) (: +.
2
)
:
2
+ (.
1
+.
2
+.
3
) : +.
1
.
2
, (4.15)
where
.
1
=
1
1
1
C
1
, .
2
=
1
1
2
C
2
, .
3
=
1
1
2
C
1
. (4.16)
Comparing (4.1) with (4.15) yields
= 1, .
1
= .
1
, .
2
= .
2
, (4.17)
j
1
=
1
2

.
1
+.
2
+.
3

(.
1
+.
2
+.
3
)
2
4.
1
.
2
1
2

,
j
2
=
1
2

.
1
+.
2
+.
3
+

(.
1
+.
2
+.
3
)
2
4.
1
.
2
1
2

.
From (4.15),
G

(0) = G

() = 1. (4.18)
Evaluating (4.1) at : = 0 gives
j
1
j
2
= .
1
.
2
. (4.19)
Hence, only 3 of the 4 poles and zeros can be adjusted independently. These constraints are a consequence
of using a passive compensator.
The closed-loop circuit is depicted below:
4.5. LEAD-LAG COMPENSATION 31
Figure 4.8
The Bode plots for G

are
Figure 4.9
The phase plot of G

hints at the origin of the name lead-lag. The phase lags at lower frequencies
and leads at higher frequencies. The basic idea in lead-lag design is to choose the lead portion of the
compensator (j
2
and .
2
) to add phase in the vicinity of the desired value of .
0

. The lag portion (j


1
and .
1
)
then attenuates the magnitude so that .
0

is actually the crossover frequency. The phase lag is merely an


artifact of the compensator structure and plays no role in achieving the specications.
The new gain crossover frequency is determined by

(.
0

)
2
+.
2
1

(.
0

)
2
+.
2
2

(.
0

)
2
+j
2
1

(.
0

)
2
+j
2
2
|G(,.
0

)|
2
= 1. (4.20)
32 EXPERIMENT 4. LEAD-LAG COMPENSATION
To simplify the problem, set
.
1
= .
2
=
.
0

10
. (4.21)
This approach has the advantage of ensuring that the poles and zeros are not distributed over too wide a
range of frequencies and that the zeros degrade the phase at .
0

by only a small amount (less than 6

each).
Combining (4.19)-(4.21) and solving for j
1
and j
2
yields
j
2
.
0

|G(,.
0

)|
2
1
1
2
, (4.22)
j
1
=
(.
0

)
2
100j
2
. (4.23)
The relationship between c
0

and .
0

is given by
c
0

= arctan
.
0

.
1
+ arctan
.
0

.
2
arctan
.
0

j
1
arctan
.
0

j
2
+G(,.
0

) + 180

. (4.24)
From (4.21),
arctan
.
0

.
1
+ arctan
.
0

.
2
= 168.6

. (4.25)
From (4.23),
arctan
.
0

j
1
= arctan100
j
2
.
0

90

. (4.26)
Combining (4.22) with a trigonometric identity yields
arctan
.
0

j
2
= 90

arctan
j
2
.
0

90

arctan

|G(,.
0

)|
2
1
1
2

. (4.27)
Combining (4.24)-(4.27),
c
0

arctan

|G(,.
0

)|
2
1
1
2

+G(,.
0

) + 168

. (4.28)
Note that (4.28) is meaningful only for .
0

satisfying
|G(,.
0

)| 1. (4.29)
The design process consists of plotting (4.28), choosing a point on the graph corresponding to acceptable
values c
0

and .
0

, and calculating .
1
, .
2
, j
1
, and j
2
from (4.21)-(4.23). Resistor and capacitor values may
be obtained by solving 4.16 for 1
1
, C
1
, and C
2
:
C
2
=
1
.
2
1
1
2
, 1
1
=

1
j
1
+
1
j
2

1
.
1

1
.
2

1
C
2
, C
1
=
1
.
1
1
1
1
. (4.30)
The freedom in choosing 1
2
may again be exploited to avoid interactions between the compensator and the
input and output impedances of the amplier.
Note that, regardless of the choice of lead-lag compensator, the steady-state error is extremely small:
c
0

1
|G

(0) G(0)|
=
1
|G(0)|
. (4.31)
The lead-lag approach simultaneously achieves small steady-state error, large phase margin, and large gain
crossover frequency.
4.6. MATLAB COMMANDS 33
4.6 MATLAB Commands
For this experiment, several additional MATLAB commands are required. First we need to look at the basics
of polynomial and rational function manipulation.
MATLAB represents a polynomial as a row vector of coecients. For example, the polynomial :
1
(:) =
: + 2: + 3 is entered by typing
n1=[1 2 3]
Given two polynomials n1 and n2, the sum and product are formed with the commands
sum=p1+p2
prod=conv(p1,p2)
(The symbol conv comes from the fact that polynomial multiplication is identical to discrete-time convo-
lution.)
For two rational functions having numerators n1 and n2 and denominators d1 and d2, the
numerator and denominator of the sum is formed by
num=conv(n1,d2)+conv(n2,d1)
den=conv(d1,d2)
Similarly, the product of two rational functions is given by
num=conv(n1,n2)
den=conv(d1,d2)
Finally, if a unity feedback conguration is formed around a transfer function with numerator n1 and
denominator d1, the closed-loop transfer function is given by
num=n1
den=n1+d1
These basic commands can be combined to form more complicated feedback congurations.
The MATLAB functions atan and sqrt return values of arctan and square root; these routines may
be applied to vectors. The function atan gives values in radians and may be applied to an imaginary
argument, returning complex values. For this reason, it is important to bear in mind that a command of the
form plot(w,phi) plots only the real part of phi.
4.7 Preparation
1) Using MATLAB, construct the Bode plots for the uncompensated transfer function G. Use the frequency-
scaled version (4.3) of G.
2) Plot |H(,.)| and the closed-loop step response for the gain compensated system with 1 = 1.
3) From the graphs in 1) and 2), record the predicted values of c

, .

, T

, T

, T

, '

, .

, .

, and '

for
the unit gain feedback system.
4) From equation (4.11), plot the achievable values of c
0

versus .
0

for arbitrary gain compensation. (Use


the semilogx command.)
5) Based on your graph in 4), determine values of .
0

, c
0

, and 1 so that the gain compensated closed-loop


system meets the specications
c
0
.01,
.
0

2 10
5
rad/sec,
c
0

60

.
34 EXPERIMENT 4. LEAD-LAG COMPENSATION
6) Construct the Bode plots corresponding to 1G.
7) Plot |H(,.)| and the step response for the gain compensated closed-loop system.
8) From the graphs in 6) and 7), record the predicted values of T

, T

, T

, '

, .

, .

, and '

.
9) Let 1
2
= 510. (This minimizes interactions between the compensator and the input and output
impedances of the amplier.) Use equation (4.14) to nd the value of 1
1
so that the gain compensation
network achieves the gain 1 in 5). (The resistance 1
2
= 510 minimizes interactions of the compensation
network with the amplier input and output impedances and the signal generator output impedance.)
10) From equations (4.28), plot the achievable values of c
0

versus .
0

for a lead-lag compensator.


11) Based on your graph in 10) and equations (4.21)-(4.23), determine values of .
0

, c
0

, j
1
, j
2
, .
1
, and .
2
so
that the corresponding lead-lag compensator achieves the specications
c
0
.01,
.
0

2 10
6
rad/sec,
c
0

60

.
12) Construct the Bode plots corresponding to G

G.
13) Plot |H(,.)| and the step response for the closed-loop system.
14) From the graphs in 12) and 13), record the predicted values of T

, T

, T

, '

, .

, .

, and '

.
15) Assuming 1
2
= 510, use equation (4.30) to calculate the other resistor and capacitor values for the
lead-lag compensation network.
4.8 Experimental Procedure
Throughout this experiment you may be faced with a variety of nonideal behaviors, such as noise, DC oset,
and amplier distortion. These problems can be overcome by selecting your input signal level carefully.
Start by using the 0 2V range on the signal generator. Do not forget to scale by the input amplitude
when reading amplitude-related quantities like '

and '

. When DC oset is observed, it is acceptable to


compensate for the oset by adjusting the vertical position of the oscilloscope trace.
1) Connect the power amplier in the unity feedback conguration (Figure 4.3).
2) Apply a square wave input, and record the values of c
0
, T

, T

, T

, and '

.
3) Apply sinusoidal inputs at a variety of frequencies and record the values of .

, .

, and '

.
4) Repeat 2) and 3) for the gain compensation network (Figure 4.6).
5) Repeat 2) and 3) for the lead-lag compensation network (Figure 4.8).
4.9 Analysis
1) Construct a table that summarizes your data. The table should have eight columns corresponding to
T

, T

, T

, '

, c
0
, .

, .

, and '

and three rows corresponding to the three closed-loop structures you


examined.
2) Write a few paragraphs summarizing your ndings. In particular, compare the performance of each of
the three compensators relative to the various response parameters.

You might also like