December 19, 2024

Design Procedure for the Phase Lag Compensator with Example in MATLAB


In this tutorial, we introduce a phase lag compensator, and we explain a procedure for designing the parameters of the phase lag compensators. At the end of this tutorial, we give an example of designing the phase lag controller for a second-order system with a low phase margin. Before reading this tutorial, it is a good idea to get yourself familiar with phase lead controllers. You need to read this tutorial and this tutorial.

The effects of the Phase Lag Compensator

  • A phase lag compensator increases the phase margin and provides attenuation in the region near and above the gain crossover frequency (high-frequency range). Consequently, the relative stability of the system is improved.
  • The gain crossover frequency is decreased and this decreases the bandwidth of the closed-loop system. This usually decreases the rise time and the settling time of the closed-loop system.
  • The phase lag compensator approximates a Proportional Integral (PI) controller.

To illustrate the effect of the phase lead controller on the step response, consider the following system.

(1)   \begin{align*}W(s)=\frac{10}{s(s+1)}\end{align*}

The compensated system is

(2)   \begin{align*}W(s)=\underbrace{\frac{18.69s+1}{306.7s+1}}_{\text{phase lag compensator}} \cdot \frac{10}{s(s+1)}\end{align*}

The step responses of the compensated and uncompensated systems are shown in the figure below.

Figure 1: Closed-loop step responses of the compensated and uncompensated systems.

We can observe that the phase lag compensator reduces the damping of the step response and makes the system more stable. However, the price we have to pay is the slower step response.

The figure below graphically illustrates the main idea of the phase lag compensator.

Fig 2: The main idea and effects of the phase lag compensators.

Equations and Graphs Describing the Phase Lag Compensator

The phase lag compensator is described by the following equation:

(3)   \begin{align*}G_{c}(s)=\frac{1+aTs}{1+Ts},\;\; a<1\end{align*}

Obviously, it has a similar form to the form of the phase lead compensator, except for the crucial fact that a<1. We explained the phase lead compensators in our previous tutorial, which can be found here. As mentioned previously, the phase lag compensator approximates a PI controller. It is called a lag compensator because we introduce a phase lag as a side effect in the low frequency range much below the gain crossover frequency. The main purpose of the lag controller is to reduce the gain near gain cross-over frequency, without changing the phase of the original uncompensated system. In this way, we can reduce the gain crossover frequency, and since the phase is not significantly changed, we increase the phase margin (this will become completely clear later). The Bode diagram of the phase lag compensator is shown in the figure below.

Figure 3: Bode diagram of the phase lag compensator.

The most important observation from Fig. 3 is the asymptotic negative gain of 20\log_{10}(a). By tuning this gain, we can achieve the main goal of the lag compensator: to increase the phase margin.

Design Procedure for the Phase Lag Compensator

Design specification and goal: Achieve the Phase Margin (PM) of the compensated system that is larger or equal to the minimum desired value of the PM. Design the parameters a and T of the lag compensator

(4)   \begin{align*}G_{c}(s)=\frac{1+aTs}{1+Ts},\;\; a<1\end{align*}

STEP 1: Plot the Bode diagram of the uncompensated open-loop system. Identify the phase margin of the uncompensated system. Determine the phase margin of the uncompensated system. Under the assumption that the phase margin needs to be increased, identify the frequency on the phase plot, for which the phase margin of the compensated system is 5 to 10 degrees larger than the desired phase margin. Let this frequency be called \omega_{c}^{\text{new}}. This is the desired gain crossover frequency of the compensated system.

STEP 2: The goal of step 2 is to bring the magnitude curve to 0 at \omega_{c}^{\text{new}}. In this way, we can achieve the desired design goal. From the Bode magnitude plot, we read the magnitude of the uncompensated system at \omega_{c}^{\text{new}}. Let this magnitude be denoted by M(\omega_{c}^{\text{new}}). On the other hand, from Fig. 3 above we can observe that the lead compensator attenuates the magnitude plot for 20\log_{10}(a) (under the assumption that \omega_{c}^{\text{new}} is significantly larger than the corner frequency 1/(aT) of the lag compensator ). Consequently, we want this attenuation to be equal to M(\omega_{c}^{\text{new}}) at \omega_{c}^{\text{new}}. Accordingly, the design equation is

(5)   \begin{align*}|M(\omega_{c}^{\text{new}})|=-20\log_{10}(a)\end{align*}

where || is the absolute value. From this equation, we obtain the a parameter of the phase lag compensator.

(6)   \begin{align*}a=10^{-|M(\omega_{c}^{\text{new}})|/20 }\end{align*}

STEP 3: The next step is to select the parameter T. The main idea is to determine the parameter T, such that the corner frequency 1/(aT) of the lag compensator is significantly smaller than the gain crossover frequency \omega_{c}^{\text{new}} of the compensated system. This has to be done in order to ensure that the phase lag of the compensator will not significantly affect the phase of the compensated system near \omega_{c}^{\text{new}}. However, if we place 1/(aT) to be too low, we might decrease the bandwidth of the closed-loop system and consequently, decrease the speed of the response of the closed-loop system. A general rule of thumb is to place 1/(aT) one decade below \omega_{c}^{\text{new}} (however, you can also deviate from this rule if your system requires such a compensation). Consequently, we can select the parameter T such that it satisfies the following equation

(7)   \begin{align*}\frac{1}{aT}=\frac{\omega_{c}^{\text{new}}}{10}\end{align*}

Consequently, we have the following equation for the design of the parameter T

(8)   \begin{align*}T=\frac{10}{a\omega_{c}^{\text{new}}}\end{align*}

STEP 4: Plot the Bode diagram of the compensated system and see if the desired specifications are met. If not, repeat the step 2,3, 4 by increasing the phase margin, and changing the parameter T (you can also deviate from equation (7)).

Example of Designing Phase Lag Controller

PROBLEM: Consider the following open-loop system:

(9)   \begin{align*}W(s)=\frac{10}{s(s+1)}\end{align*}

Design the lag compensator such that the phase margin of the compensated system is at least 50 degrees.

SOLUTION: We follow the above-described procedure for designing the phase lag controller.

STEP 1: The Bode diagram of the uncompensated system is given below.

Fig 4: Bode plot of the uncompensated system.

The step response of the uncompensated closed-loop system is given in the figure below.

Figure 5: Step response of the uncompensated system.

By analyzing the results shown in these two figures, we can conclude that the phase margin does not satisfy the minimum requirement of 50 degrees. Also, from the step response, we can observe that the transient step response is undamped. Our goal is to increase the phase margin by using the phase lag controller. The two figures presented above are generated by using the following MATLAB code lines

clear
W=tf(10,[1 1 0])
figure(1)
bode(W)
grid

figure(2)
WclosedLoopUncompensated=feedback(W,1)
step(WclosedLoopUncompensated)
grid

From the Bode plot of the uncompensated system (see the figure above), we choose the gain cross-over frequency of the compensated system as

(10)   \begin{align*}\omega_{c}^{\text{new}}=0.535,\;\; rad/s\end{align*}

this gain frequency gives the estimated phase margin of the compensated system of 62 degrees, and that is 5 to 12 degrees larger than the desired minimum value of the phase margin.

STEP 2: From the Bode plot of the uncompensated system, we can observe that the necessary attenuation of the -24.3 [dB]. Consequently, we have

(11)   \begin{align*}a=10^{-|M(\omega_{c}^{\text{new}})|/20 }=10^{-24.3/20}=0.0610\end{align*}

STEP 3: We select T as

(12)   \begin{align*}T=\frac{10}{a\omega_{c}^{\text{new}}}=\frac{10}{0.0610\cdot 0.535} = 306.6523\end{align*}

The final compensator for the computed values of a and T is

(13)   \begin{align*}G_{c}(s)=\frac{18.69s+1}{306.7s+1}\end{align*}

The MATLAB code lines used in steps 2 and 3 are shown below.

wc=0.535
Mc=24.3
a=10^(-Mc/20)
T=10/(a*wc)
Gc=tf([a*T 1],[T 1])

STEP 4: The Bode plots of the compensated and uncompensated systems are shown in the figure below.

Figure 6: Bode plots of the compensated and uncompensated systems.

We can observe that the compensated system achieves the required phase margin, and the gain cross-over frequency is close to the estimated one. The figure below shows the step responses of the closed-loop compensated and uncompensated systems.

Figure 7: Step responses of the closed-loop compensated and uncompensated systems.

We can observe that the damping is attenuated, however, at the expense of the slower response. The system will eventually settle in the desired position of 1.

MATLAB code lines used to generate these two figures are shown below.

figure(3)
hold on
bode(W,'r')
bode(Gc*W,'b')
grid


figure(4)
WclosedLoopCompensated=feedback(Gc*W,1)
hold on 
step(WclosedLoopUncompensated,'r')
step(WclosedLoopCompensated,'b')