stability margins of a simulink model -凯发k8网页登录
this example illustrates how to compute classical and disk-based gain and phase margins of a control loop modeled in simulink®. to compute stability margins, linearize the model to extract the open-loop responses at one or more operating points of interest. then, use allmargin
or diskmargin
to compute the classical or disk-based stability margins, respectively.
mimo control loop
for this example, use the simulink model airframemarginex.slx
. this model is based on the example trim and linearize an airframe (simulink control design).
open_system('airframemarginex.slx')
the system is a two-channel feedback loop. the plant is the one-input, two-output subsystem airframe model
, and the controller is a two-input, one-output system whose inputs are the normal acceleration az
and pitch rate q
, and whose output is the fin deflection
signal.
loop transfer functions
to compute the gain margins and phase margins for this feedback system, linearize the model to get the open-loop transfer functions at the plant outputs and input. you can do so using linearization analysis points of the loop-transfer type. for more information about linearization analysis points, see (simulink control design).
create a loop-transfer analysis point for the plant input, which is the first output port of the q control
subsystem.
ioinput = linio('airframemarginex/q control',1,'looptransfer');
similarly, create analysis points for the plant outputs. because there are two outputs, specify these analysis points as a vector of linearization i/o objects.
iooutput(1) = linio('airframemarginex/airframe model',1,'looptransfer'); iooutput(2) = linio('airframemarginex/airframe model',2,'looptransfer');
linearize the model to obtain the open-loop transfer functions. for this example, use the operating point specified in the model. the loop transfer at the plant input is siso, while the loop transfer at the outputs is 2-by-2.
li = linearize('airframemarginex',ioinput); % siso lo = linearize('airframemarginex',iooutput); % mimo
classical gain and phase margins
to compute the classical gain margins and phase margins, use allmargin
. for an open-loop transfer function, allmargin
assumes a negative-feedback loop.
the open-loop transfer function returned by the linearize
command is the actual linearized open-loop response of the model at the analysis point. thus, for an open-loop response l
, the closed-loop response of the entire model is a positive feedback loop.
therefore, use -l
to make allmargin
compute the stability margins with positive feedback. compute the classical gain and phase margins at the plant input.
si = allmargin(-li)
si = struct with fields: gainmargin: [0.1633 17.6557] gmfrequency: [1.5750 47.5259] phasemargin: 44.4553 pmfrequency: 5.3930 delaymargin: 14.3870 dmfrequency: 5.3930 stable: 1
the structure si
contains information about classical stability margins. for instance, li.gmfrequency
gives the two frequencies at which the phase of the open-loop response crosses –180°. li.gainmargin
gives the gain margin at each of those frequencies. the gain margin is the amount by which the loop gain can vary at that frequency while preserving closed-loop stability.
compute the stability margins at the plant output.
so = allmargin(-lo);
because there are two output channels, allmargin
returns an array containing one structure for each channel. each entry contains the margins computed for that channel with the other feedback channel closed. index into the structure so
to obtain the stability margins for each channel. for instance, examine the margins with respect to gain variations or phase variations at the q
output of the plant, which is the second output.
so(2)
ans = struct with fields: gainmargin: [0.3456 17.4299] gmfrequency: [3.4362 49.8480] phasemargin: [-78.2449 52.6053] pmfrequency: [1.5685 6.5433] delaymargin: [313.5216 14.0316] dmfrequency: [1.5685 6.5433] stable: 1
disk-based gain and phase margins
disk margins provide a stronger guarantee of stability than the classical gain and phase margins. disk-based margin analysis models gain and phase variations as a complex uncertainty on the open-loop system response. the disk margin is the smallest such uncertainty that is compatible with closed-loop stability. (for general information about disk margins, see .)
to compute disk-based margins, use diskmargin
. like allmargin
, the diskmargin
command assumes a negative-feedback system. thus, use -li
to compute the disk-based margins at the plant input.
dmi = diskmargin(-li)
dmi = struct with fields: gainmargin: [0.4419 2.2628] phasemargin: [-42.3153 42.3153] diskmargin: 0.7740 lowerbound: 0.7740 upperbound: 0.7740 frequency: 4.2515 worstperturbation: [1x1 ss]
the field dmi.gainmargin
tells you that the open-loop gain at the plant input can vary by any factor between about 0.44 and about 2.26 without loss of closed-loop stability. disk-based margins take into account variations at all frequencies.
for a mimo loop transfer function such as the response lo
at the plant outputs, there are two types of disk-based stability margins. the loop-at-a-time margins are the stability margins in each channel with the other loop closed. the multiloop margins are the margins for independent variations in gain (or phase) in both channels simultaneously. diskmargin
computes both.
[dmo,mmo] = diskmargin(-lo);
the loop-at-a-time margins are returned as a structure array dmo
with one entry for each channel. for instance, examine the margins for gain variations or phase variations at the q
output of the plant with the az
loop closed, and compare with the classical margins given by so(2)
above.
dmo(2)
ans = struct with fields: gainmargin: [0.3771 2.6521] phasemargin: [-48.6811 48.6811] diskmargin: 0.9047 lowerbound: 0.9047 upperbound: 0.9047 frequency: 4.4982 worstperturbation: [2x2 ss]
the multiloop margin, mmo
, takes into account loop interaction by considering simultaneous variations in gain (or phase) across all feedback channels. this typically gives the most realistic stability margin estimate for multiloop control systems.
mmo
mmo = struct with fields: gainmargin: [0.6238 1.6030] phasemargin: [-26.0867 26.0867] diskmargin: 0.4633 lowerbound: 0.4633 upperbound: 0.4643 frequency: 3.6830 worstperturbation: [2x2 ss]
mmo.gainmargin
shows that the gains in both output channels can vary independently by factors between about 0.62 and 1.60 without compromising closed-loop stability. mmo.phasemargin
shows that stability is preserved for independent phase variations in each channel of up to ±26°. use diskmarginplot
to examine the multiloop margins graphically.
diskmarginplot(-lo)
this shows the disk-based gain and phase margins as a function of frequency. the mmo
values returned by diskmargin
correspond to the weakest disk margin across frequency.
margins at multiple operating points
when you use linearize
, you can provide multiple operating points to generate an array of linearizations of the system. allmargin
and diskmargin
can operate on linear model arrays to return the margins at multiple operating points. for example, linearize the airframe system at three simulation snapshot times.
snap = [0; 2; 5]; lisnap = linearize('airframemarginex',ioinput,snap); losnap = linearize('airframemarginex',iooutput,snap);
lisnap
is a 3-by-1 array of siso linear models, one for the loop transfer at the plant input obtained at each snapshot time. similarly, losnap
is a 3-by-1 array of 2-input, 2-output linear models representing the loop transfers at the plant outputs at each snapshot time. compute the classical gain and phase margins at the plant inputs at the three snapshot times.
sisnap = allmargin(-lisnap);
each entry in the structure array sisnap
contains the classical margin information for the corresponding snapshot time. for instance, examine the classical margins for the second entry, t
= 2 s.
sisnap(2)
ans = struct with fields: gainmargin: [0.0171 18.2473] gmfrequency: [0.0502 51.4401] phasemargin: 93.1041 pmfrequency: 2.8474 delaymargin: 57.0690 dmfrequency: 2.8474 stable: 1
compute the disk margins at the plant outputs.
[dmosnap,mmosnap] = diskmargin(-losnap);
because there are two feedback channels and three snapshot times, the structure array containing the loop-at-a-time disk margins has dimensions 2-by-3. the first dimension is for the feedback channels, and the second is for the snapshot times. in other words, dmosnap(j,k)
contains the margins for the channel j
at the snapshot time k
. for instance, examine the disk margins in the second feedback channel at the third snapshot time, t
= 5 s.
dmosnap(2,3)
ans = struct with fields: gainmargin: [0.1345 7.4338] phasemargin: [-74.6771 74.6771] diskmargin: 1.5257 lowerbound: 1.5257 upperbound: 1.5257 frequency: 24.1993 worstperturbation: [2x2 ss]
there is only one set of multiloop margins for each snapshot time, so mmosnap
is a 3-by-1 structure array.
as before, you can also plot the multiloop margins. there are now three curves, one for each snapshot time. click on a curve to identify which snapshot time it corresponds to.
diskmarginplot(-losnap)
see also
| | | (simulink control design)