Chapter 13

# 13.5 Lag Controller Design – Solved Example 1

Consider a typical unit feedback closed loop control system, as shown, which is to operate under Lag Control.

The Lag Controller transfer function is as follows:

$G_c(s)=K_c\cdot\frac{\tau\alpha s +1}{\tau s+1}=\frac{a_1 s +a_0}{b_1 s+1}$

Where $\tau$ is the so-called Lag Time Constant and $\alpha = 1$. The process transfer function G(s) is:

$G(s)=\frac{30(s+2)}{{(s+0.1)}^2 {(s+20)}^2}$

Open loop frequency response plots of G(s) are shown in Figure 13‑20. The closed loop performance requirements are: the Steady State Error for the unit step input for the compensated closed loop system is one half of the Steady State Error for the uncompensated system; Percent Overshoot is approximately 10%.

Check what the current (uncompensated system) values of the Phase Margin, $\Phi_m$, and the Crossover Frequency, $\omega_{cp}$ are. Estimate the uncompensated closed loop step response specs: Percent Overshoot, PO, Steady State Error, $e_{ss(step\%)}$, and Settling Time, $T_{settle(\pm2\%)}$. Next, based on the specifications, calculate the required values of the Phase Margin for the compensated system, $\Phi_{mc}$, and the DC gain of the controller, $K_{dc}$.

Design the Lag Controller such that it meets the closed loop response requirements, and write the Lag Controller transfer function and its parameters. For your Controller, estimate the compensated closed loop step response specs: Percent Overshoot, PO, Steady State Error, $e_{ss(step\%)}$, Rise Time, $T_{rise(100\%)}$, and Settling Time, $T_{settle(\pm2\%)}$.

Let’s start by finding the open loop DC gain – note that reading the gains off the Bode plots is difficult due to decibel units – here the gain could be read off from Figure 13‑20 as anywhere between 20 and 25 dB. It is recommended to always use the transfer function (if available) to compute the accurate gain values. Here we can compute the Uncompensated Open Loop DC gain – there is no controller, i.e. $G_c(s) = 1$.

From the process transfer function:

$K_{dco}=\lim_{s\rightarrow0}\frac{30(s+2)}{{(s+0.1)}^2{(s+20)}^2}=\frac{60}{4}=15$

The uncompensated closed loop DC gain is then:

$K_{dc} = \frac{K_{dco}}{1+K_{dco}}=\frac{15}{16}=0.9375$

The Phase Margin and the crossover frequency can be read off from the Bode plot in Figure 13‑20 as: $\Phi_m = 38^{\circ}$ and $\omega_{cp} = 0.378$ rad/sec. The damping ratio $\zeta$ and the frequency of natural oscillations $\omega_n$ for the uncompensated closed loop system can now be estimated by either reading it off the Phase Margin graph in Figure 12‑9 or by using the formula: $\zeta = 0.3487$. Next, calculate the natural frequency:

$\omega_n = \frac{\tan{\Phi_m}\cdot\omega_{cp}}{2\zeta}=0.426$

The uncompensated closed loop model:

$G_m(s)=K_{dc}\frac{\omega_n^2}{s^2+2\zeta\omega_n s + \omega_n^2} \rightarrow G_{mu}(s)=\frac{0.1701}{s^2+0.2971 s + 0.1814}$

Model specs can be calculated as:

$PO = 100\cdot \left ( e^{\frac{-\zeta\pi}{\sqrt{1-{\zeta}^2}}} \right ) = 31\%$

$T_{settle(\pm2\%)}=\frac{4}{\zeta\omega_n}=26.9$

$T_{rise(100\%)}=\frac{\pi-\cos\zeta^{-1}}{\omega_n\sqrt{1-\zeta^2}}=4.82$

$e_{ss(step\%)}=\frac{1}{1+K_{pos}}\cdot100\%=\frac{1}{1+15}=6.25\%$

The actual closed loop uncompensated transfer function is:

$G_{cl}(s)=\frac{30s + 60}{s^4 + 40.2s^3 + 408s^2 + 110.4s +64}$

$G_{cl}(s)=\frac{30(s+2)}{(s+21.14)(s+18.8)(s^2 + 0.262s + 0.161)}$

As we can see, the closed loop transfer function has a dominant pair of complex poles, with the damping ratio $\zeta = 0.326$ and the natural frequency of oscillations  $\omega_n = 0.4$ rad/sec, which are very close to the model estimates of $\zeta = 0.349$ and $\omega_n = 0.426$ rad/sec. The actual transfer function also has a zero at -2, and two poles at – 21.14 and -18.8, all of which are negligible, compared to the dominant pair of closed loop poles located at $-0.13\pm j0.38$. Thus, the assumed model is quite accurate – see the actual step response comparison, shown in Figure 13‑21.

Below, we compare the expected specs, based on the model, with the actual system response specs, obtained by running the “stepeval” function. The actual specs, compared to the model specs, are:

 Actual Compensated System $G_{mc}(s)$ – Model for the Compensated System PO 54.8% 31% $e_{ss(step\%)}$ 6.25% 6.25% $T_{rise(0-100\%)}$ 4.68 sec 4.82 sec

The specs estimates from the model are very accurate, with all specs meeting the required values.

Now, the Lag Controller design – we can choose a simplified design or an analytical design. First, always calculate the required DC gain of the controller – this part is the same in both approaches. Based on the required error specification:

$e_{ss(step)c}=0.5\cdot e_{ss(step)u} \rightarrow \frac{1}{K_{posu}}=\frac{0.5}{1+K_{posu}}$

$\frac{1}{K_{posu}}=\frac{0.5}{1+K_{posu}} \rightarrow k_{posu}=31$

The compensated closed loop DC gain should be:

$K_{dc(comp)}=\frac{K_{posc}}{1+K_{posc}}=\frac{31}{32}=0.9688$

The controller DC gain is then:

$K_c = a_0 = \frac{K_{posc}}{K_{posu}}=\frac{31}{15}=2.067$

Next, “translate” the required PO spec into the equivalent closed loop damping ratio. Based on Figure 7‑4, for PO = 10%, the required damping ratio is approximately $\zeta =0.59$. The compensated Phase Margin, based on Figure 12‑9 should be close to $\Phi_{m(comp)} = 60^{\circ}$.

What do we do next? The two approaches differentiate on how we proceed.

### 13.5.1.1 Lag Controller Design Solved Example 1: The “Simplified” Lag Design

Recall that at the frequency of $\frac{10}{\alpha\tau}$ in the Lag Controller (see the graph below), we are still losing about  of $5^{\circ}$ phase, so look at the uncompensated open loop Bode plot and choose the frequency where the phase angle is ($\Phi_m + 5^{\circ}$) away from the $-180^{\circ}$ line. Here, if we want the compensated Phase Margin to be $\Phi_m = 60^{\circ}$, we should look for the frequency where the phase angle reaches $-115^{\circ}$:

$\angle G(j\omega) = -180^{\circ}+\Phi_m + 5^{\circ} = -180^{\circ}+60^{\circ} + 5^{\circ}$

That frequency is read off the plot as approximately 0.17 rad/sec: $\omega_{co(comp)} = 0.17$ rad/sec. Note that in the Lag Design, the compensated crossover frequency will always be to the left of the uncompensated frequency of the crossover. If it were to the right of the uncompensated frequency of the crossover, we would end up with a Lead Design. Here the uncompensated frequency is 0.38 rad/s. Next, find the gain of the uncompensated system at that point – recall that reading it off the graph is inaccurate so it is best to substitute $s = j0.17$ into G(s):

$\left | G(j0.17) \right | = 3.87\frac{V}{V}=11.75dB$

Remember that since we are using the DC gain of 2.0667, the total gain at the chosen crossover frequency is going to be 3.87 times 2.0667. This is the amount of the gain reduction that has to be delivered by the high frequency gain drop-off of the Lag Controller:

$\alpha = \frac{1}{2.0667\cdot3.87}=0.125$

$\omega_{cp(comp)}$ rad/sec becomes the right-side corner of the phase characteristic:

$\omega_{cp(comp)}=0.17=\frac{10}{\alpha\tau}$

$\tau = \frac{10}{\alpha\cdot\omega_{cp}}=\frac{10}{0.125\cdot0.17}=4704$

The controller transfer function is:

$G_c(s)=K_c\cdot\frac{\tau\alpha s + 1}{\tau s + 1}=2.0647\cdot\frac{470.4\cdot0.125s+1}{470.4s+1}=2.0647\cdot\frac{58.82s+1}{470.4s+1}$

$G_c(s)=\frac{a_1 s + a_0}{b_1 s +1 }= \frac{121.6s+2.067}{470.4s+1}$

The open loop Bode plots before and after compensation and the system Phase Margin are shown in Figure 13‑22 and the compensated Phase Margin is shown in Figure 13‑23 – it is $\Phi_m=60^{\circ}$ at the frequency of $\omega_{cp(comp)}=0.17$ rad/sec, as was chosen for this design.

The expected compensated closed loop response specs can be estimated using the dominant poles model again. Use the formula below, or read off the Phase Margin graph in Figure 12‑9:

$\zeta=\frac{\tan{\Phi_m}}{2\sqrt{{(\tan\Phi_m)}^2 + 1}} \rightarrow \zeta = 0.607$

$\omega_n = \frac{\tan{\Phi_m}\cdot\omega_{cp}}{2\zeta} = 0.24$

The compensated closed loop model:

$G_{mc}(s)=\frac{0.054}{s^2 + 0.291s + 0.054}$

Model specs can be calculated as:

$PO=100\cdot\left ( e^{\frac{-\zeta\pi}{\sqrt{1-\zeta^2}}} \right )=9\%$

$T_{settle(\pm2\%)}=\frac{4}{\zeta\omega_n}=27.4$

$T_{rise(100\%)}=\frac{pi-\cos\zeta^{-1}}{\omega_n\sqrt{1-\zeta^{2}}}=11.5$

$e_{ss(step\%)}=\frac{1}{1+K_{pos}}\cdot100\%=\frac{1}{1+31}\cdot100\%=3.125\%$

The actual closed loop transfer function is:

$G_{cl}(s)=\frac{7.753(s+2)(s+0.017)}{(s+20.59)(s+19.4)(s+0.01463)(s^2 + 0.203s + 0.047)}$

As we can see, the actual closed loop transfer function has a dominant pair of complex poles, with the damping ratio $\zeta=0.47$ and the natural frequency of oscillations $\omega_n = 0.22$ rad/sec, as well as a zero at -2, another zero at -0.017, and three real poles at – 20.59, -19.4 and at -0.01463.

The dominant poles model is not as accurate as before, because now an additional pole-zero combo shows up, and both are very close to the Imaginary axis. They do not cancel out, and their net effect on the closed loop response is that the very large time constant associated with the Lag Controller causes a very slow, very visible exponential component in the step response – see the actual step response comparison in Figure 13‑24 and the comparison of the specs below. That additional real pole has a very long decay time associated with it, which significantly affects the Settling Time.

Below, we compare the expected specs, based on the model, with the actual system response specs, obtained by running the “stepeval” function. The actual specs, compared to the model specs, are:

 Actual Compensated System $G_{mc}(s)$ – Model for the Compensated System PO 4.6% 9% $e_{ss(step\%)}$ 3.125% 3.125% $T_{rise(0-100\%)}$ 14.1 sec 11.5 sec $T_{settle(\pm2\%)}$ 130.4 sec 24.8 sec

Clearly, the biggest problem with the simplified approach is that it typically generates a long-time constant that causes the closed loop system to have the real pole close to the Imaginary axis that cannot be ignored – the closed loop model is not really based on a dominant pair of complex poles alone. Unfortunately, the simplified design does not allow us to avoid this. Let’s consider the analytical design next.

Plus of the simplified design – it will never lead to negative values of the controller parameters.

Minus of the simplified design – it almost always results in an additional significant closed loop pole that has a strong negative effect on the Settling Time. This can be somehow ameliorated by trial & error adjustments, but it would be tedious.

### 13.5.1.2 Lag Controller Design Solved Example 1: The “Analytical” Lag Design

The analytical design gives us more flexibility to shape the open loop response by choosing different locations for the crossover frequency. Remember to choose the required DC gain based on the error specs – the calculations are identical to the simplified method, so the Controller DC gain ($a_0$) will be the same:

$e_{ss(step)c}=0.5\cdot e_{ss(step)u} \rightarrow\frac{1}{1+K_posc}=\frac{0.5}{1+K_{posu}}$

$\frac{1}{1+K_{posc}}=\frac{0.5}{1+15}\rightarrow K_{posc}=31$

The compensated closed loop DC gain should be:

$K_{dc(comp)}=\frac{K_{posc}}{1+K_{posc}}=\frac{31}{32}=0.9688$

The controller DC gain is again:

$a_0=\frac{K_{posc}}{K_{posu}}=\frac{31}{15}=2.067$

Next, we pick the Phase Margin – in this example, we decided to have the Phase Margin of $60^{\circ}$, so let’s stick with this value. Next, we need to choose the crossover frequency – as long as it is less than 0.38 (the uncompensated value). First, let’s choose the same value as in the simplified design:

$\omega_{cp(comp)}=0.17 rad/sec$

To use the derived formulae for the controller constants $a_1$ and $b_1$, we need to calculate the uncompensated open loop Bode plot the phase and the gain at that frequency – as before, substitute $s=j0.17$ into the transfer function G(s):

$\angle G(j0.17)=-115^{\circ}$

$\left | G(j0.17) \right | = 3.87\frac{V}{V}=11.75dB$

Next, substitute these values into the formulae:

$\theta=-180^{\circ}+\Phi_m-\angle G(j0.17)= -180^{\circ}+60^{\circ}+115^{\circ} = -5^{\circ}$

Note since this is a LAG design, the “lift” angle is not really “lifting” anything; it is just an intermediate step in the calculation and could be even called a “drag” or “lag” angle. Also note this calculation confirms our assumption in the “simplified” design that at the chosen crossover frequency, we are losing approximately 5 degrees of phase to the lag controller.

$a_1 = \frac{1-a_0\cdot\left | G(j\omega_{cp})\right | \cdot \cos \theta}{\omega_{cp}\cdot\left | G(j\omega)\right |\cdot\sin\theta}=126.2$

$b_1 = \frac{\cos\theta-a_0\cdot\left | G(j\omega_{cp})\right | }{\omega_{cp}\cdot\sin\theta}=490.6$

These values are very close to the ones obtained using the simplified approach, as expected. The closed loop response will also be similar, with the large value of the closed loop time constant dominating the response and adversely affecting the Settling Time. The resulting design offers some improvement over the uncompensated response, but the Settling Time spec takes a huge beating – this is not a good design and we should be able to do better.

With the analytical design we are not stuck with the one choice of the crossover frequency, as is the case with the simplified design. We can easily choose a different frequency of the crossover (as long as it is less than the uncompensated crossover frequency) and see if the resulting closed loop step response simulations will improve. Let’s consider what would happen if we chose a different value for the crossover frequency. Let’s say, make $\omega_{cp(comp)}=0.2$ rad/sec. Again, we need to find the gain of the uncompensated system at that point – recall that reading it off the graph is inaccurate so it is best to substitute $s=j0.2$ into G(s):

$\angle G(j0.2) = -122^{\circ}$

$\left | G(j0.2) \right | = 3.01\frac{V}{V}=9.6dB$

Next, substitute these values into the formulae:

$\theta = -180^{\circ} + \Phi_m - \angle G(j0.2)= -180^{\circ}+60^{\circ}+122^{\circ}=2^{\circ}$

$a_1 = \frac{1-a_0\cdot\left | G(j\omega_{cp})\right | \cdot \cos \theta}{\omega_{cp}\cdot\left | G(j\omega)\right |\cdot\sin\theta}=-215.5$

$b_1 = \frac{\cos\theta-a_0\cdot\left | G(j\omega_{cp})\right | }{\omega_{cp}\cdot\sin\theta}=-650.3$

$G_c(s)=\frac{a_1 s + a_0}{b_1 s +1}=\frac{-215.5s + 2.067}{-650.3s +1}$

So here we have an unpleasant surprise! The controller coefficients are not acceptable, as they are negative! The controller pole in RHP is unacceptable because it means an unstable open loop transfer function – even if the resulting closed loop is stable, for safety reasons we do not want to implement that – in case if the closed loop incidentally opens (a malfunction), we would have an unstable system on our hands. The RHP location of the controller zero is also unacceptable. Even if the controller pole is in a stable location, the RHP zero will introduce an effective delay into the system, extending both the Rise Time and the Settling Time. Recall that we will never get that kind of surprise in the “simplified” lag design.

Let’s keep adjusting the value of the crossover frequency – we already have one “passable” value, at 0.17 rad/sec, but we want to improve on that design. By “trial & error” we find that values of crossover frequency that are between 0.19 and 0.38 all result in negative coefficients and are therefore unacceptable. Let’s try frequencies smaller than 0.17 – some of those choices will lead to acceptable controller values. Let’s see if we can get a set of controller values that would give us a better actual step response than the one seen above for $\omega_{cp(comp)} = 0.17 rad/sec$ – remember that one was quite different from expected because it had a large time constant associated with the Lag controller.

After some trial & error with the analytical formulae, we come across quite an agreeable response – note that the formulae can be easily programmed into Matlab so that the iterations are quite easy to perform. Let’s see the results for $\omega_{cp(comp)} = 0.1 rad/sec$ – good results can be had for some other, smaller values as well. Again, we need to find the gain and phase of the uncompensated system at that frequency – recall that reading it off the graph is inaccurate so it is best to substitute $s=j0.1$ into G(s):

$\angle G(j0.1)=-88^{\circ}$

$\left | G(j0.1) \right | = 7.5\frac{V}{V}=17.5dB$

Next, substitute these values into the formulae and first calculate our “lag” angle:

$\theta = -180^{\circ}+\Phi_m-\angle G(j0.1)=-180^{\circ}+60^{\circ}+88^{\circ}=-32^{\circ}$

Note that at this point the “lift” angle has become a “lag” angle (negative value).

$a_1 = \frac{1-a_0\cdot\left | G(j\omega_{cp})\right | \cdot \cos \theta}{\omega_{cp}\cdot\left | G(j\omega)\right |\cdot\sin\theta}=30.2$

$b_1 = \frac{\cos\theta-a_0\cdot\left | G(j\omega_{cp})\right | }{\omega_{cp}\cdot\sin\theta}=274.7$

Both controller parameters are positive, so this controller will be acceptable. The open loop Bode plots before and after compensation are shown in Figure 13‑25 and the system Phase Margin is shown in Figure 13‑26.

The controller transfer function is:

$G_c(s)=\frac{a_1 s + a_0}{b_1 s + 1}=\frac{30.2s+2.067}{274.7s+1}$

Note that with a much smaller value of $b_1$, this design may be actually better than the one with a higher crossover frequency, as the closed loop compensated response will be closer to the expected model – no slow exponential visible. Let’s check this theory out. The expected compensated closed loop response can be estimated using the dominant poles model again. Use the formula below, or read off the Phase Margin graph in Figure 12‑9:

$\zeta = \frac{\tan\Phi_m}{2\sqrt{\sqrt{{(\tan\Phi_m)}^2 + 1}}} \rightarrow \zeta = 0.612$

$\omega_n = \frac{\tan\Phi_m\cdot\omega_{cp}}{2\zeta}=0.1414$

The compensated closed loop model:

$G_{mc}(s)=\frac{0.0194}{s^2+0.173s+0.02}$

Model specs can be calculated as:

$PO = 100\cdot \left ( e^{\frac{-\zeta\pi}{\sqrt{1-{\zeta}^2}}} \right ) = 9\%$

$T_{settle(\pm2\%)}=\frac{4}{\zeta\omega_n}=46.2$

$T_{rise(100\%)}=\frac{\pi-\cos\zeta^{-1}}{\omega_n\sqrt{1-\zeta^2}}=20$

$e_{ss(step\%)}=\frac{1}{1+K_{pos}}\cdot100\%=\frac{1}{1+31}=3.125\%$

The actual closed loop transfer function:

$G_{cl}(s)=\frac{3.3(s+2)(s+0.068)}{(s+20.38)(s+19.6)(s+0.063)(s^2 + 0.1469s +0.0184)}$

Note that the closed loop model based on the dominant poles is now more accurate than in the case of the “simplified” design – while the additional pole-zero combo still shows up, both very close to the Imaginary axis, their net effect on the closed loop response is almost negligible because of a much better “near-cancellation”: we have a zero at -0.068, and a pole at -0.063. Before they were at -0.017 and -0.0146, respectively. The very large time constant associated with the Lag Controller is no longer visible in the step response, and the Settling Time is much as expected – see the actual step response comparison and the comparison of the specs below.

Below, we compare the expected specs, based on the model, with the actual system response specs, obtained by running the “stepeval” function. The actual specs, compared to the model specs, are:

 Actual Compensated System $G_{mc}(s)$ – Model for the Compensated System PO 10.6% 8.8% $e_{ss(step\%)}$ 3.125% 3.125% $T_{rise(0-100\%)}$ 19.7 sec 20.1 sec $T_{settle(\pm2\%)}$ 41.1 sec 42.1 sec

The estimates are very accurate. Finally, let’s see how much of an improvement we achieved by introducing the Lag Controller – see the comparison of the responses in Figure 13‑28.

Plus of the Analytical Lag Design – it can be quickly iterated to find a much better system performance, often without the long and visible slow time constant associated with the Simplified Lag Design.

Minus of the Analytical Lag Design – sometimes the design formulae will yield negative, i.e. unacceptable, values of controller parameters. This can be addressed by a slightly different choice of the crossover frequency and the phase margin.