Lecturer
Set up MATLAB
5.2. Frequency Response Design of a Lag Compensator¶
This MATLAB Live Script examines the design of phase-lag cascade compensators using Bode diagrams.
5.2.1. Analysis¶
The plant is a type 1 servomechanism with transfer function:
The system has unity gain feedback and the compensated closed-loop system is to have a static velocity error constant of 10 and a phase margin of 45∘.
Defining the system in Matlab
The first part of the analysis is the same as we went through for the Lead Compensation case but we repeat the commands so that the code in the MATLAB workspace will be consistent. You should refer to the otherdocument for the detail.
As before, I want to show the uncompensated frequency response diagrams plotted with the asymptotic bode curves and again we use the function |asymp| to achieve this.
We predefine the frequency values that we want:
Now we calculate the magnitude and phase
The result of |[m0,p0] = bode(Go,w)|
produces a data structure. We need to convert the magnitude to decibels and extract the data into column vectors for plotting.
For the asymptotic magnitude. We need the state space matrices:
and then the asymptotic response is computed using the function |asymp|:
The plots
clf
subplot(211)
semilogx(w,m0dB,w,am0dB),...
axis([0.01, 10, -40, 60]),...
title('Lag Compensation Example - Uncompensated Plant'),...
legend('Magnitude','Asymptote'),ylabel('Magnitude Go(jw) (dB)'),xlabel('Frequency (rad/s)'),...
grid
subplot(212)
semilogx(w,p0),...
title('Lag Compensation Example - Uncompensated Plant'),...
legend('Angle Go(jw)'),ylabel('Phase Go(jw) (degrees)'),xlabel('Frequency (rad/s)'),...
grid
The gain cut-off frequency ωm≈1 rad/s and the phase margin ϕm≈45∘. Thus the transient performance requirements are already satisfied.
5.2.2. Lag Compensation for Steady-State Performance¶
For this system:
We want Kv=10 so, lag compensation is needed to raise the low frequency gain to 10. The lag compensator has transfer function
D(s)=Kc(1+Ts1+αTs),α>1.
Examining the frequency response of this compensator we see that
D(jω)=Kc(1+Tjω1+αTjω).
The low frequency response is
and the high frequency response is
Since α>1, the low frequency gain is higher than the high frequency gain. The problem with a lag compensator is that the price we pay for this increase in the low frequency gain is a phase-lag. To illustrate this, let us take an example system:
There is a significant phase lag at the centre frequency. We must avoid adding any affects of this lag to the plant transfer[1] function at the gain cut-off frequency as this would reduce the phase margin and hence stability. So, we arrange the lag compensator as follows.
The compensator is designed to have unity high frequency gain.
This will avoid any change in the gain cut-off frequency ω1. The low frequency gain is thus given by
We also ensure that the lag effect is restricted to the low frequency region: so we make sure that the break-frequency of the zero (ωz=1/T) is located at least a decade lower than the gain cut-off frquency ω1[2].
Let us set up a lag compensator with these considerations in place.
We produce a new Bode diagram for the gain compensated system. The same commands are issued as before.
Asymptotic magnitude
Plots
Phase is unchanged
How have we done? The low frequency gain has certainly increased by 20 dB (10). What about the phase margin?
The phase margin is ϕm and ω1=0.79 rad/s.
5.2.3. Evaluation of the Design¶
We now put everything together to evaluate the design.
### Bode Plots
5.2.3.1. Nyquist Diagrams¶
5.2.3.2. Nichols Charts¶
5.2.3.3. Closed-Loop Frequency Response¶
Now we examine the closed-loop frequency responses. Notice the slight increase in peak magnification Mmax.
Gc0 = feedback(Go,1);
Gc1 = feedback(DGo,1);
[mc0,pc0]=bode(Gc0,w);
[mc1,pc1]=bode(Gc1,w);
mc0 = 20.*log10(reshape(mc0,length(w),1));
mc1 = 20.*log10(reshape(mc1,length(w),1));
semilogx(w,mc0,w,mc1),...
grid,...
title('Closed-loop Frequency Response for Lag Compensated System'),...
legend('|Go(jw)|','|DGo(jw)|'),...
xlabel('Frequency (rad/s)'),...
ylabel('Magnitude (dB)')
5.2.3.4. Closed-Loop Step Responses¶
First we examine the closed-loop step responses. Notice the increase in peak overshoot %OS and the slighly longer settling time.
To compute the ramp error response we need to add an integrator to the error reponse:
The velocity error is reduced to 10% from 100% showing that Kv is indeed 10. However, note the considerable time taken to reach the final value. This is quite typical of a ramp response response for a lag compensator.
5.2.4. Footnotes¶
[1] Or lead compensated plant in a lag-lead compensated system.
[2] The phase lag will then be close to zero at the gain cut-off frequency.
5.2.5. Resources¶
An executable version of this document is available to download as a MATLAB Live Script file freqlag.mlx [asymp.m].