Loop Shaping Using the Glover-McFarlane Method
This example shows how to use ncfsyn
to shape the open-loop response while enforcing stability and maximizing robustness. ncfsyn
measures robustness in terms of the normalized coprime stability margin computed by ncfmargin
.
Plant Model
The plant model is a lightly damped, second-order system.
.
A Bode plot shows the resonant peak.
P = tf(16,[1 0.16 16]); bode(P)
Design Objectives and Initial Compensator Design
The design objectives for the closed-loop are the following.
Insensitivity to noise, including 60dB/decade attenuation beyond 20 rad/sec
Integral action and a bandwidth of at least 0.5 rad/s
Gain crossover frequencies no larger than 7 rad/s
In loop-shaping control design, you translate these requirements into a desired shape for the open-loop gain and seek a compensator that enforces this shape. For example, a compensator consisting of a PI term in series with a high-frequency lag component achieves the desired loop shape.
K_PI = pid(1,0.8); K_rolloff = tf(1,[1/20 1]); Kprop = K_PI*K_rolloff; bodemag(P*Kprop); grid
Unfortunately, the compensator Kprop
does not stabilize the closed-loop system. Examining the closed-loop dynamics shows poles in the right half-plane.
pole(feedback(P*Kprop,1))
ans = 4×1 complex
-20.6975 + 0.0000i
0.4702 + 5.5210i
0.4702 - 5.5210i
-0.4029 + 0.0000i
Enforcing Stability and Robustness with ncfsyn
You can use ncfsyn
to enforce stability and adequate stability margins without significantly altering the loop shape. Use the initial design Kprop
as loop-shaping pre-filter. ncfsyn
assumes a positive feedback control system (see ncfsyn
), so flip the sign of Kprop
and of the returned controller.
[K,~,gamma] = ncfsyn(P,-Kprop);
K = -K; % flip sign back
gamma
gamma = 1.9903
A value of the performance gamma
less than 3 indicates success (modest gain degradation along with acceptable robustness margins). The new compensator K
stabilizes the plant and has good stability margins.
allmargin(P*K)
ans = struct with fields:
GainMargin: [6.2984 10.9082]
GMFrequency: [1.6108 15.0285]
PhaseMargin: [79.9812 -99.6214 63.7590]
PMFrequency: [0.4467 3.1469 5.2304]
DelayMargin: [3.1253 1.4441 0.2128]
DMFrequency: [0.4467 3.1469 5.2304]
Stable: 1
With gamma
approximately 2, the expect at most 20*log10(gamma)
= 6dB gain reduction in the high-gain region and at most 6dB gain increase in the low-gain region. The Bode magnitude plot confirms this. Note that ncfsyn
modifies the loop shape mostly around the gain crossover to achieve stability and robustness.
subplot(1,2,1) bodemag(Kprop,'r',K,'g',{1e-2,1e4}); grid legend('Initial design','NCFSYN design')
ans = Legend (Initial design, NCFSYN design) with properties: String: {'Initial design' 'NCFSYN design'} Location: 'northeast' Orientation: 'vertical' FontSize: 7.6500 Position: [0.2564 0.8637 0.6869 0.0830] Units: 'normalized' Use GET to show all properties
title('Controller Gains') subplot(1,2,2) bodemag(P*Kprop,'r',P*K,'g',{1e-3,1e2}); grid legend('Initial design','NCFSYN design')
ans = Legend (Initial design, NCFSYN design) with properties: String: {'Initial design' 'NCFSYN design'} Location: 'northeast' Orientation: 'vertical' FontSize: 8.1000 Position: [0.2738 0.8583 0.6727 0.0884] Units: 'normalized' Use GET to show all properties
title('Open-Loop Gains')
Figure 1: Compensator and open-loop gains.
Impulse Response
With the ncfsyn
compensator, an impulse disturbance at the plant input is damped out in a few seconds. Compare this response to the uncompensated plant response.
subplot(1,2,1) impulse(feedback(P,K),'b',P,'r',5); legend('Closed loop','Open loop')
ans = Legend (Closed loop, Open loop) with properties: String: {'Closed loop' 'Open loop'} Location: 'northeast' Orientation: 'vertical' FontSize: 7.6500 Position: [0.3555 0.8060 0.5010 0.0698] Units: 'normalized' Use GET to show all properties
subplot(1,2,2); impulse(-feedback(K*P,1),'b',5) title('Control action')
Figure 2: Response to impulse at plant input.
Sensitivity Functions
The closed-loop sensitivity and complementary sensitivity functions show the desired sensitivity reduction and high-frequency noise attenuation expressed in the closed-loop performance objectives.
S = feedback(1,P*K); T = 1-S; clf bodemag(S,T,{1e-2,1e2}), grid legend('S','T')
ans = Legend (S, T) with properties: String: {'S' 'T'} Location: 'northeast' Orientation: 'vertical' FontSize: 9 Position: [0.8399 0.8528 0.1146 0.0938] Units: 'normalized' Use GET to show all properties
Conclusion
In this example, you used the function ncfsyn
to adjust a hand-shaped compensator to achieve closed-loop stability while approximately preserving the desired loop shape.