Lead/lag compensation
In the previous section, we learned what desirable closed-loop performance looks like and how to change the loop gain 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:
Different forms are used depending on our desired low-frequency () or high-frequency () gain. For example:
The first has a low-frequency gain (DC gain) of 1 and a high-frequency gain of .
The second has a low-frequency gain of and a high-frequency gain of 1.
A “phase lag compensator” (or just “lag”) has the same form as Eq. (1), but with and 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:
As a replacement for PID control. They can achieve similar benefits but without some of the drawbacks discussed in the previous section.
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:
Both forms above have a high-frequency gain of . Here is a Bode plot comparison:
Let’s compare the lag compensator to the PI compensator:
🟢 The phase lag is now more localized, so it only has an effect between and rather than for all frequencies below . A smaller means less localization.
🔴 The Bode magnitude plot flattens out at . So we do not have infinite gain at low frequencies and do not increase the system type (only an integrator can do that). However, the smaller we make , the larger the low-frequency gain, so we can still substantially reduce steady-state error, even if we can’t make it zero.
In the limit , 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:
Both forms above have a low-frequency gain of . Here is a Bode plot comparison:
Let’s compare the lead compensator to the PD compensator:
🟢 The Bode magnitude plot flattens out at . So we no longer reduce the high-frequency roll-off. However, we still increase the high-frequency gain, which will amplify noise at high frequencies. Larger means more amplification.
🔴 The phase lead is more localized, so it only has an effect between and rather than for all frequencies above . A larger means less localization.
In the limit , 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:
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 and , 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 , 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:
Reducing the proportional gain (to reduce the gain crossover frequency, thereby increasing phase margin). Unfortunately, this also reduces our low-frequency gain and compromises our tracking and disturbance rejection. It also reduces bandwidth, which may be undesirable.
Adding a zero, e.g. a PD controller (to add phase lead and thereby increase phase margin). Unfortunately, this also also reduces our high-frequency roll-off, which compromises noise rejection and robustness to unmodeled dynamics.
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:
This compensator has a zero at and a pole at . Therefore, the zero is at a lower frequency than the pole, so the Bode plot has a “phase lead bump”:
Note that controls the location of the zero and controls the space between the pole and zero. The zero is at and the smaller we pick , the farther the pole. For example, makes the pole one decade larger than the zero.
The farther apart the pole and zero are (i.e., the smaller 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 :
Derivation of the phase lead bump formula
The bump occurs midway between the pole and zero. The frequency response of the lead compensator at this midpoint is:
The magnitude of this complex number is:
Multiply by the conjugate to find the real and imaginary parts:
The phase of the frequency response therefore satisfies the following triangle, where we have put in the real part, imaginary part, and magnitude:
The sine of is the ratio of the imaginary part to the magnitude:
The alternative formula can be obtained by rearranging and solving for in terms of .
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.
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 replaced by . This will lead to a negative , 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:
Derivation of the gain attenuation formula
The gain attenuation is the limit of the magnitude of the frequency response as :
Converting to decibels, we obtain dB. Therefore, the total drop in decibels is dB.
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]
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 :
Figure 7:Bode plot of 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 to give ourselves a buffer. Using Eq. (6), we can calculate :
The gain gain bump is . The uncompensated magnitude plot drops to -6 dB at roughly 22 rad/s, so we will set rad/s.
Next, we pick by putting the gain crossover frequency at . Using Eq. (12), we obtain
Putting this together, our lead compensator is:
Here are Bode plots of our original loop and our compensated loop :
Figure 8:Bode plot of 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 and , 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 that corresponds to a phase margin of 48°. This is about 4 rad/s. At this frequency, the magnitude plot of 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 :
Next, we pick 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):
Therefore, . Let’s pick to be safe. Together with, , our lag compensator is:
Here are Bode plots of our original loop and our compensated loop :
Figure 9:Bode plot of 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 and , 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:
This leads to the following pole and zero locations:
Note that the damping ratios of the dominant poles in our compensated systems satisfy the approximate relationship that we derived in the previous section, since our compensated systems have .
We can compare the step responses of each system as well:
Figure 10:Step response comparison of the original system, lead-compensated system, and lag-compensated system.
All designs have zero steady-state error, since our plant was type-1 to begin with.
The lead design is faster and more damped than the original system, since we have increased the bandwidth and phase margin.
The lag design is slower and more damped than the original system, since we have decreased the bandwidth and increased the phase margin.
Both compensated systems have a similar overshoot, which is consistent with their similar damping ratios. However, the overshoot observed is slightly higher than what we would expect from , due to the presence of zeros influencing the dominant pole behavior (see Eq. (26)).
As a final comparison, let’s add some high-frequency noise and see how the different designs perform. We will add sensor noise ( 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!
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:
As we saw in the previous section, at high frequencies, we have . So the open-loop Bode plots give us a good indication of how much noise will be amplified at high frequencies.
The lead design (see Figure 8) has a magnitude of about -20 dB at 100 rad/s, which means that it attenuates noise by a factor of 10. Our noise had an amplitude of 1, so this is quite visible on the plot of the step response.
The lag design (see Figure 9) has a magnitude of about -50 dB at 100 rad/s, which means that it attenuates noise by a factor of about 300. This is why the noise is barely visible on the plot of the step response.
The original system (see Figure 7) had a magnitude of about -30 dB at 100 rad/s, which was in between the lead and lag designs.
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
The steady state error to a ramp is:
Since we want the error to be less than 0.05, we need . Let’s pick to be safe. This gives us the following compensated system:
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 :
We satisfy the first two design goals, but our settling time and percent overshoot are too large. Let’s make the bode plot of :
Figure 13:Bode plot of , where .
We desire a percent overshoot of at most 10%. Using the results in the section on phase margin and damping, this corresponds to 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 . So we need a bandwidth of at least 11 rad/s.
Therefore, our design goals are to achieve:
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 . Using Eq. (6), we can calculate :
This corresponds to a gain bump of dB. The uncompensated magnitude plot drops to -9 dB at roughly 15 rad/s, so we will set rad/s. This is convenient because it satisfies the bandwidth spec of at least 11 rad/s!
Next, we pick to correspond to the gain crossover frequency of the uncompensated system, using Eq. (12). This leads us to:
So our lead compensator is:
Here is the new Bode plot with the lead compensator:
Figure 14:Bode plot of , where and .
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:
This example is adapted from the excellent lecture on lead/lag compensator design by Brian Douglas.
I used an input that was a mixture of sinusoids of appropriate frequencies. The exact input I used was: