Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lead/lag compensation

In the previous section, we learned what desirable closed-loop performance looks like and how to change the loop gain L(s)=C(s)G(s)L(s) = C(s)G(s) to achieve it. We also looked at how the familiar PID family can serve this purpose. In this section, we look at a new type of compensator called lead/lag, which gives us additional flexibility compared to PID.

What is lead/lag compensation?

A “phase lead compensator” (or just “lead”) is a pole-zero pair where the zero occurs at a lower frequency than the pole. It is called a lead compensator because we will see that it adds a bump in phase lead. We can write this in many ways, for example:

τ1s+1τ2s+1with τ1>τ2ors+bs+awith b<a\frac{\tau_1 s + 1}{\tau_2 s + 1} \quad\textsf{with }\tau_1 > \tau_2 \qquad\textsf{or}\qquad \frac{s+b}{s+a} \quad\textsf{with }b<a

Different forms are used depending on our desired low-frequency (s0s\to 0) or high-frequency (ss\to\infty) gain. For example:

A “phase lag compensator” (or just “lag”) has the same form as Eq. (1), but with τ1<τ2\tau_1<\tau_2 and b>ab>a instead. So now the pole occurs at a lower frequency than the zero. It is called a lag compensator because we will see that it adds a bump in phase lag.

Lead/lag compensators are used in two main ways:

  1. As a replacement for PID control. They can achieve similar benefits but without some of the drawbacks discussed in the previous section.

  2. As a fine-tuning step; to improve stability margins of an existing design.

Lead/lag as a PID alternative

Lag vs. PI

We can view a lag compensator as replacing the integrator with a low-frequency pole while keeping the same DC gain. In other words:

CPI(s)=Ks+asvs.Clag(s)=Ks+as+b,where b<aC_\textsf{PI}(s) = K\cdot \frac{s+a}{s} \quad\textsf{vs.}\quad C_\textsf{lag}(s) = K\cdot \frac{s+a}{s+b}, \quad \textsf{where }b<a

Both forms above have a high-frequency gain of KK. Here is a Bode plot comparison:

Let’s compare the lag compensator to the PI compensator:

In the limit b0b\to 0, the lag compensator becomes a PI compensator. In practice, lags offer flexibility when we don’t want to add a pure integrator but still want some of the benefits of doing so.

Lead vs. PD

We can view a lead compensator as adding an extra high-frequency pole to a PD compensator while keeping the same low-frequency gain. In other words:

CPD(s)=Ks+bbvs.Clead(s)=Kabs+bs+a,where b<aC_\textsf{PD}(s) = K\cdot \frac{s+b}{b} \quad\textsf{vs.}\quad C_\textsf{lead}(s) = K\cdot \frac{a}{b}\cdot \frac{s+b}{s+a}, \quad \textsf{where }b<a

Both forms above have a low-frequency gain of KK. Here is a Bode plot comparison:

Let’s compare the lead compensator to the PD compensator:

In the limit aa\to\infty, the lead compensator becomes a PD compensator. In practice, leads are often used instead of PD control because they offer more flexibility. Moreover, it is impossible to implement a pure derivative anyway, so lead compensation is often the only choice!

Lead-lag vs. PID

A lead-lag compensator is just the product of a lead and a lag:

Clead-lag(s)=Ka1b1(s+b1)(s+a1)lead(s+a2)(s+b2)lagwhere b2<a2<b1<a1C_\textsf{lead-lag}(s) = K\cdot \underbrace{\frac{a_1}{b_1}\cdot \frac{(s+b_1)}{(s+a_1)}}_{\textsf{lead}} \cdot \underbrace{\frac{(s+a_2)}{(s+b_2)}}_{\textsf{lag}} \quad\textsf{where }b_2 < a_2 < b_1 < a_1

This combines lead and lag similar to how PID combined PI and PD. It is a very flexible form that can be used to achieve a wide variety of Bode plots. For example:

As b20b_2\to 0 and a1a_1\to\infty, the lead-lag compensator becomes a PID compensator.

Usually the gain crossover is designed to be near the lead pole/zero pair, so that the lead can improve phase margin. The lag pole/zero pair is designed to be at a much lower frequency, so that it can improve low-frequency gain without affecting phase margin. The lead and lag parts serve different purposes so they are often designed separately.

Lead/lag for fine-tuning

An other use for lead/lag compensation is to fine-tune an existing design. Suppose we have an open-loop plant G(s)G(s), which already includes compensation to achieve satisfactory low-frequency tracking performance and high-frequency noise rejection. However, the stability margins are not good enough. Two obvious solutions are:

Lead and lag compensation can be used to improve stability margins of a given design without changing its low-frequency gain or high-frequency roll-off. The following analysis will be more quantitative, since we will develop guidelines for how to pick the parameters of the lead and lag compensators to achieve a desired phase margin improvement.

Lead compensation

We will use a slightly different parameterization of the lead compensator than the one we used for PD control:

Clead(s)=τs+1ατs+1,where: 0<α<1C_\textsf{lead}(s) = \frac{\tau s + 1}{\alpha \tau s + 1},\qquad \textsf{where: }0<\alpha<1

This compensator has a zero at s=1τs= -\frac{1}{\tau} and a pole at s=1ατs= -\frac{1}{\alpha \tau}. Therefore, the zero is at a lower frequency than the pole, so the Bode plot has a “phase lead bump”:

Note that τ\tau controls the location of the zero and α\alpha controls the space between the pole and zero. The zero is at 1τ\frac{1}{\tau} and the smaller we pick α\alpha, the farther the pole. For example, α=0.1\alpha=0.1 makes the pole one decade larger than the zero.

The farther apart the pole and zero are (i.e., the smaller α\alpha is), the larger the phase lead bump, up to a maximum of 90°. There is a neat formula for calculating the phase lead bump as a function of α\alpha:

sinϕ=1α1+α    α=1sinϕ1+sinϕ\boxed{\begin{aligned} \sin \phi &= \frac{1-\alpha}{1+\alpha} \quad\iff\quad \alpha = \frac{1-\sin\phi}{1+\sin\phi} \end{aligned}}

We will see an example of lead compensation design at the end of this section.

Lag compensation

We will use a different parameterization of the lag compensator than the one we used for PI control. This time, we choose a DC gain of 1, so that it does not affect the low-frequency gain. This is in sharp contrast to using lag compensation as a replacement for PI control, where we used it to increase low-frequency gain.

Clag(s)=τs+1βτs+1,where: β>1C_\textsf{lag}(s) = \frac{\tau s + 1}{\beta \tau s + 1},\qquad \textsf{where: }\beta>1

The formula is the same as the lead compensator, but the parameter is larger than 1 instead of smaller than 1. This means that the pole is at a lower frequency than the zero, so the Bode plot has a “phase lag bump”:

The same formula from (6) applies, but with α\alpha replaced by β\beta. This will lead to a negative ϕ\phi, as expected for a lag compensator.

However, the lag compensator is not used for its phase lag, as this can’t help us improve phase margin. Instead, it is used for the dip in gain it provides. The total drop in decibels (as a positive number) incurred by the lag compensator at high frequencies is given by:

Mlag=20log10β dB\boxed{\begin{aligned} M_\textsf{lag} &= 20\log_{10} \beta \text{ dB} \end{aligned}}

We will see an example of lag compensation design at the end of this section.

Fine-tuning example

Consider the following open-loop plant[1]

G(s)=50s(0.2s+1)G(s) = \frac{50}{s(0.2s+1)}

This plant already includes a PI controller we designed to achieve desirable tracking performance for the closed-loop system. Unfortunately, introducing the integrator has made our stability margins quite bad. Here is the Bode plot of G(s)G(s):

Bode plot of G(s) in Eq. . The phase margin is too small!

Figure 7:Bode plot of G(s)G(s) in Eq. (18). The phase margin is too small!

The goal is to design a compensator that will give us a phase margin of at least 48° while preserving the frequency response at low-frequency (to maintain tracking performance) and keeping the same high-frequency roll-off (to maintain noise rejection).

We will solve this problem with both lead compensation and lag compensation and then compare the results.

Lead design

Our current phase margin is 18°. To increase our phase margin to 48°, we need to add 30° of phase lead. To be safe, we will use ϕdes=36°\phi_{\textsf{des}} = 36\degree to give ourselves a buffer. Using Eq. (6), we can calculate α\alpha:

α=1sin36°1+sin36°0.26\alpha = \frac{1-\sin 36\degree}{1+\sin 36\degree} \approx 0.26

The gain gain bump is 1α26 dB\frac{1}{\sqrt{\alpha}} \approx 2 \approx 6\text{ dB}. The uncompensated magnitude plot drops to -6 dB at roughly 22 rad/s, so we will set ωcg=22\omega_{cg}' = 22 rad/s.

Next, we pick τ\tau by putting the gain crossover frequency at ωcg\omega_{cg}'. Using Eq. (12), we obtain

τ=1ωcgα0.089\tau = \frac{1}{\omega_{cg}'\sqrt{\alpha}} \approx 0.089

Putting this together, our lead compensator is:

Clead(s)=τs+1ατs+1=0.089s+10.023s+1C_\textsf{lead}(s) = \frac{\tau s + 1}{\alpha \tau s + 1} = \frac{0.089 s + 1}{0.023 s + 1}

Here are Bode plots of our original loop G(s)G(s) and our compensated loop Clead(s)G(s)C_\textsf{lead}(s)G(s):

Bode plot of G(s) in Eq.  with the lead compensator from Eq. .

Figure 8:Bode plot of G(s)G(s) in Eq. (18) with the lead compensator from Eq. (21).

As we can see, we now have a nice phase margin of about 49° and the same low-frequency gain and high-frequency roll-off as before. The price we had to pay was a modest increase in bandwidth from 15 rad/s to about 19 rad/s, and a small high-frequency gain bump.

Different designs are possible by tweaking τ\tau and α\alpha, but this is a good starting point that achieves our design goals.

Lag design

If we want to achieve a phase margin of 48° by moving the gain crossover frequency to the left, we need to find the new gain crossover frequency ωcgdes\omega_{cg}^\textsf{des} that corresponds to a phase margin of 48°. This is about 4 rad/s. At this frequency, the magnitude plot of G(s)G(s) is about 20 dB. Therefore, we need to shift the high-frequency gain by -20 dB, or a gain of 0.1. Using Eq. (16), we can calculate β\beta:

β=10Mlag/20=10(20)/20=10\beta = 10^{-M_\textsf{lag}/20} = 10^{-(-20)/20} = 10

Next, we pick τ\tau so that the phase lag bump occurs at a frequency that is much lower than our gain crossover and does not affect our phase margin. Using Eq. (17):

1τ110ωcgdes=1104=0.4\frac{1}{\tau} \,\leq\, \frac{1}{10}\,\omega_{cg}^\textsf{des} = \frac{1}{10}\cdot 4 = 0.4

Therefore, τ2.5\tau \geq 2.5. Let’s pick τ=5\tau = 5 to be safe. Together with, β=10\beta = 10, our lag compensator is:

Clag(s)=τs+1βτs+1=5s+150s+1C_\textsf{lag}(s) = \frac{\tau s + 1}{\beta \tau s + 1} = \frac{5 s + 1}{50 s + 1}

Here are Bode plots of our original loop G(s)G(s) and our compensated loop Clag(s)G(s)C_\textsf{lag}(s)G(s):

Bode plot of G(s) in Eq.  with the lag compensator from Eq. .

Figure 9:Bode plot of G(s)G(s) in Eq. (18) with the lag compensator from Eq. (24).

Once again, we have achieved a phase margin of about 49° and the same low-frequency gain and high-frequency roll-off as before. The price we had to pay this time was a decrease in bandwidth from 15 rad/s to about 4 rad/s. As a bonus, we also reduced our high-frequency gain by 20 dB, resulting in improved noise rejection and robustness to unmodeled dynamics.

Different designs are possible by tweaking τ\tau and β\beta, but this is a good starting point that achieves our design goals.

Comparison of designs

Both designs achieved the target phase margin of 48°. The difference is that the lead design increased the gain crossover, while the lag design decreased it. So the lead design increases bandwidth, leading to a more aggressive/sensitive controller, while the lag design decreases bandwidth, leading to a slower but more robust controller.

Returning to our familiar time-domain analysis, we can compare the closed-loop transfer functions of our original system, lead-compensated system, and lag-compensated system. They are:

G1+G250s2+5s+250CleadG1+CleadG967(s+11.2)(s+16.6)(s2+31.9s+656)ClagG1+ClagG25(s+0.2)(s+0.208)(s2+4.81s+24.1)\begin{aligned} \frac{G}{1+G} &\approx \frac{250}{s^2+5s+250} \\ \frac{C_\textsf{lead}G}{1+C_\textsf{lead}G} &\approx \frac{967(s+11.2)}{(s+16.6)(s^2+31.9s+656)} \\ \frac{C_\textsf{lag}G}{1+C_\textsf{lag}G} &\approx \frac{25(s+0.2)}{(s+0.208)(s^2+4.81s+24.1)} \end{aligned}

This leads to the following pole and zero locations:

original:{zeros:nonepoles2.5±15.6j  (ζ=0.16)lead:{zeros:11.2poles16.6,16.0±20.0j  (ζ=0.48)lag:{zeros:0.2poles0.208,2.4±4.28j  (ζ=0.49)\begin{aligned} \textsf{original:} &\quad \begin{cases}\textsf{zeros:} & \textsf{none} \\ \textsf{poles} & -2.5 \pm 15.6j \;(\zeta=0.16)\end{cases} \\ \textsf{lead:} &\quad \begin{cases}\textsf{zeros:} & -11.2 \\ \textsf{poles} & -16.6, -16.0 \pm 20.0j \;(\zeta=0.48)\end{cases} \\ \textsf{lag:} &\quad \begin{cases}\textsf{zeros:} & -0.2 \\ \textsf{poles} & -0.208, -2.4 \pm 4.28j \;(\zeta=0.49)\end{cases} \end{aligned}

Note that the damping ratios of the dominant poles in our compensated systems satisfy the approximate relationship ζPM100\zeta \approx \frac{\PM}{100} that we derived in the previous section, since our compensated systems have PM49°\PM\approx 49\degree.

We can compare the step responses of each system as well:

Step response comparison of the original system, lead-compensated system, and lag-compensated system.

Figure 10:Step response comparison of the original system, lead-compensated system, and lag-compensated system.

As a final comparison, let’s add some high-frequency noise and see how the different designs perform. We will add sensor noise (nn in the block diagram of Figure 1) at frequencies above 100 rad/s, with an amplitude of roughly 1.[2] This is a lot of noise, given that our step input also has a height of 1; it is for illustrative purposes!

Step response comparison with a large amount of high-frequency noise added.

Figure 11:Step response comparison with a large amount of high-frequency noise added.

The lead design has a large amount of noise in the response, whereas the lag design has a much cleaner response. We can explain this using the Bode plots:

Summary


Test your knowledge

Solution to Exercise 1 #

The system is type zero. Achieving a zero steady-state error to a step input but finite error to a ramp input means that we need to add one integrator. Let’s start with

C1(s)=ksC_1(s) = \frac{k}{s}

The steady state error to a ramp is:

ess=lims0s11+C1(s)G(s)1s2=lims01s11+ksG(s)=lims01sss+kG(s)=1kG(0)=15120k\begin{aligned} e_{ss} &= \lim_{s\to 0} s \cdot \frac{1}{1 + C_1(s)G(s)} \cdot \frac{1}{s^2}\\ &= \lim_{s\to 0} \frac{1}{s} \cdot \frac{1}{1 + \frac{k}{s}G(s)} \\ &= \lim_{s\to 0} \frac{1}{s} \cdot \frac{s}{s + k G(s)} \\ &= \frac{1}{k G(0)} = \frac{15}{120 k} \end{aligned}

Since we want the error to be less than 0.05, we need k>151200.05=2.5k > \frac{15}{120 \cdot 0.05} = 2.5. Let’s pick k=3k = 3 to be safe. This gives us the following compensated system:

C1(s)G(s)=84s+360s(s2+7s+15)C_1(s)G(s) = \frac{84s + 360}{s(s^2 + 7s + 15)}

Let’s verify that we have achieved our first two design goals by looking at the step and ramp responses of the closed-loop system C1(s)G(s)1+C1(s)G(s)\frac{C_1(s)G(s)}{1 + C_1(s)G(s)}:

We satisfy the first two design goals, but our settling time and percent overshoot are too large. Let’s make the bode plot of C1(s)G(s)C_1(s)G(s):

Bode plot of C_1(s)G(s), where C_1(s) = \frac{3}{s}.

Figure 13:Bode plot of C1(s)G(s)C_1(s)G(s), where C1(s)=3sC_1(s) = \frac{3}{s}.

  • We desire a percent overshoot of at most 10%. Using the results in the section on phase margin and damping, this corresponds to ζ0.6\zeta \approx 0.6 and a phase margin of about 60°.

  • We desire a settling time of at most 0.6 seconds, which we can estimate using the results from the section on bandwidth and settling time. We have ωb4ζts40.60.611\omega_b \approx \frac{4}{\zeta t_s} \approx \frac{4}{0.6\cdot 0.6} \approx 11. So we need a bandwidth of at least 11 rad/s.

Therefore, our design goals are to achieve:

ωb11 rad/s,PM60°\boxed{\omega_b \geq 11 \text{ rad/s},\qquad \PM \geq 60\degree}

while maintaining the same steady-state tracking performance. This means leaving the low-frequency loop gain unchanged. The phase margin is about 18°, and the bandwidth is about 9 rad/s. Both need to increase, so a natural candidate is a lead compensator.

We should add 42° of phase lead to get to our target of 60°, and we should add a little extra to account for the gain bump. Let’s pick ϕdes=50°\phi_{\textsf{des}} = 50\degree. Using Eq. (6), we can calculate α\alpha:

α=1sin50°1+sin50°0.13\alpha = \frac{1-\sin 50\degree}{1+\sin 50\degree} \approx 0.13

This corresponds to a gain bump of 20log101α920\log_{10} \frac{1}{\sqrt{\alpha}} \approx 9 dB. The uncompensated magnitude plot drops to -9 dB at roughly 15 rad/s, so we will set ωcg=15\omega_{cg}' = 15 rad/s. This is convenient because it satisfies the bandwidth spec of at least 11 rad/s!

Next, we pick τ\tau to correspond to the gain crossover frequency of the uncompensated system, using Eq. (12). This leads us to:

τ=1ωcgα0.18\tau = \frac{1}{\omega_{cg}'\sqrt{\alpha}} \approx 0.18

So our lead compensator is:

C2(s)=τs+1ατs+1=0.18s+10.023s+1C_2(s) = \frac{\tau s + 1}{\alpha \tau s + 1} = \frac{0.18 s + 1}{0.023 s + 1}

Here is the new Bode plot with the lead compensator:

Bode plot of C_1(s)C_2(s)G(s), where C_1(s) = \frac{3}{s} and C_2(s) = \frac{0.18 s + 1}{0.023 s + 1}.

Figure 14:Bode plot of C1(s)C2(s)G(s)C_1(s)C_2(s)G(s), where C1(s)=3sC_1(s) = \frac{3}{s} and C2(s)=0.18s+10.023s+1C_2(s) = \frac{0.18 s + 1}{0.023 s + 1}.

The phase margin is now about 61° and the bandwidth is about 15 rad/s, so we have achieved our design goals! Let’s double check that our percent overshoot and settling times meet the specifications by looking at the compensated closed-loop step response:

Everything looks good! After including the lead compensation, the percent overshoot is now 10% and the settling time is 0.4 seconds. Our final compensator is the product of the lead compensator and the integrator we designed at the beginning:

C(s)=C1(s)C2(s)=3s0.18s+10.023s+1C(s) = C_1(s)C_2(s) = \frac{3}{s} \cdot \frac{0.18 s + 1}{0.023 s + 1}
Footnotes
  1. This example is adapted from the excellent lecture on lead/lag compensator design by Brian Douglas.

  2. I used an input that was a mixture of sinusoids of appropriate frequencies. The exact input I used was: u(t)=1+0.45sin(101t+0.3)+0.40sin(113t+2.1)+0.35sin(127t+4.0)+0.30sin(149t+1.2)+0.25sin(173t+5.0)u(t) = 1 + 0.45\sin(101t + 0.3) + 0.40\sin(113t + 2.1) + 0.35\sin(127t + 4.0) + 0.30\sin(149t + 1.2) + 0.25\sin(173t + 5.0)