Main Content

musyn

Robust controller design using mu synthesis

Since R2019b

Description

musyn designs a robust controller for an uncertain plant using D-K iteration, which combines H synthesis (K step) with μ analysis (D step) to optimize closed-loop robust performance.

You can use musyn to:

  • Synthesize "black box" unstructured robust controllers.

  • Robustly tune a fixed-order or fixed-structure controller made up of tunable components such as PID controllers, state-space models, and static gains.

For additional information about performing μ synthesis and interpreting results, see Robust Controller Design Using Mu Synthesis.

Full-Order Centralized Controllers

example

[K,CLperf] = musyn(P,nmeas,ncont) returns a controller K that optimizes the robust performance of the uncertain closed-loop system CL = lft(P,K). The plant P is a continuous or discrete uncertain plant with the partitioned form

[zy]=[P11P12P21P22][wu],

where:

  • w represents the disturbance inputs.

  • u represents the control inputs.

  • z represents the error outputs to be kept small.

  • y represents the measurement outputs provided to the controller.

nmeas and ncont are the numbers of signals in y and u, respectively. y and u are the last outputs and inputs of P, respectively. The closed-loop system CL = lft(P,K) achieves the robust performance CLperf, which is the μ upper bound, the robust performance metric calculated by musynperf.

For this syntax, musyn uses hinfsyn for H synthesis (the K step).

[K,CLperf,info] = musyn(P,nmeas,ncont) returns additional information about each D-K iteration.

[K,CLperf,info] = musyn(P,nmeas,ncont,Kinit) initializes the D-K iteration process with the controller Kinit. To restart D-K iteration using the results of the jth iteration from a previous run, use Kinit = info(j).K.

[K,CLperf,info] = musyn(___,opts) uses additional options for the D-K iteration and underlying hinfsyn computations. Use musynOptions to create the option set. You can use this syntax with any of the previous input and output argument combinations.

Fixed-Structure Controllers

example

[CL,CLperf] = musyn(CL0) optimizes the robust performance by tuning the free parameters in the tunable, uncertain closed-loop model CL0. The genss model CL0 is an uncertain and tunable model of the closed-loop system whose robust performance you want to optimize. The model contains:

  • Uncertain control design blocks such as ureal and ultidyn to represent the uncertainty

  • Tunable control design blocks such as tunablePID, tunableSS, and tunableGain to represent the tunable components of the control structure

musyn returns the closed-loop model CL with the tunable control design blocks set to the tuned values. The best achieved robust performance is returned as CLperf.

For this syntax, musyn uses hinfstruct for H synthesis (K step).

[CL,CLperf,info] = musyn(CL0) also returns additional information about each D-K iteration.

[CL,CLperf,info] = musyn(CL0,blockvals) initializes the D-K iteration with the tunable block values in blockvals. You can specify the block values as a structure or by providing a closed-loop model whose blocks are tuned to the values you want to initialize. For instance, to use the tuned values obtained in a previous musyn run, set blockvalues = CL.

[CL,CLperf,info] = musyn(___,opts) uses additional options for the D-K iteration and underlying hinfstruct computations. Use musynOptions to create the option set. You can use this syntax with any of the previous input and output argument combinations.

[CL,CLperf,info,runs] = musyn(___,opts) also returns details about each independent tuning run when you use the 'RandomStart' option of musynOptions to perform additional randomized runs.

Examples

collapse all

Synthesize a stabilizing robust controller K for the system in the following illustration, where the plant G includes some dynamic uncertainty. The controller must also reject disturbances injected at the plant output.

The nominal plant model G0 is an unstable first-order system.

G0 = tf(1,[1 -1]);

The uncertainty in G0 is as follows:

  • At low frequency, below 2 rad/s, the plant can vary up to 25% from its nominal value.

  • Around 2 rad/s, the percentage variation starts to increase, reaching 400% at approximately 32 rad/s.

Represent the frequency-dependent model uncertainty with the weight Wu and the uncertain LTI dynamic uncertainty InputUnc, an ultidyn control design block.

Wu = 0.25*tf([1/2 1],[1/32 1]); 
InputUnc = ultidyn('InputUnc',[1 1]);
G = G0*(1+InputUnc*Wu);

musyn seeks a controller that optimizes robust performance from inputs to outputs. To set up this problem for musyn, then, insert a weighting function Wp that captures the disturbance rejection goal.

When you provide this augmented plant P to musyn, the function designs a controller that drives the transfer function from d to e below 1 at all frequencies. That transfer function is Wp/S, where S = 1 – GK is the sensitivity function. Thus, choose Wp to be the inverse of the desired sensitivity. For this example, choose Wp with:

  • Low-frequency gain of 100 (40 dB)

  • 0 dB crossover at 0.5 rad/s

  • High-frequency gain of 0.25 (12 dB)

Wp = makeweight(100,[1 0.5],0.25);
bodemag(Wp)

Figure contains an axes object. The axes object with ylabel Magnitude (dB) contains an object of type line. This object represents Wp.

You can now construct the plant as shown in the block diagram by naming the signals, defining a sum block, and using connect. Construct the plant so that the control input is the last input, and the measurement output is the last output.

G.InputName = 'u';
G.OutputName = 'y1';
Wp.InputName = 'y';
Wp.OutputName = 'e';
SumD = sumblk('y = y1 + d');

inputs = {'d','u'};
outputs = {'e','y'};
P = connect(G,Wp,SumD,inputs,outputs);

Use musyn to design a controller K for this uncertain system.

nmeas = 1;
ncont = 1;
[K,CLperf,info] = musyn(P,nmeas,ncont); 
D-K ITERATION SUMMARY:
-----------------------------------------------------------------
                       Robust performance               Fit order
-----------------------------------------------------------------
  Iter         K Step       Peak MU       D Fit             D
    1           1.345        1.344         1.36             8
    2          0.7923       0.7904       0.7961             4
    3          0.6789       0.6789       0.6857            10
    4          0.6572       0.6572       0.6598             8
    5          0.6538       0.6538       0.6542             8
    6          0.6532       0.6532       0.6533             8

Best achieved robust performance: 0.653

The display shows that the best achieved robust performance is about 0.65. This result means that the gain from d to e remains below 0.65 for up to 1/0.65 times the uncertainty specified in the plant. Thus, the controller achieves the robust performance objectives for the full range of modeled uncertainty. (For more information on interpreting musyn results, see Robust Controller Design Using Mu Synthesis.)

You can examine the robust performance using analysis commands such as robgain and wcgainplot. For instance, examine the worst-case gain of the closed-loop system.

CL = lft(P,K);
wcg = wcgain(CL)
wcg = struct with fields:
           LowerBound: 0.5283
           UpperBound: 0.5294
    CriticalFrequency: 0

This result confirms that the actual worst-case gain over the modeled uncertainty is about 0.53, which is within the robust performance of 0.65 guaranteed by musyn.

For this problem, the controller returned by musyn is fairly high order.

size(K)
State-space model with 1 outputs, 1 inputs, and 11 states.

You can try reducing the controller order with model-reduction commands such as balred or reduce to see whether you can maintain robust performance. (For an example, see the musynperf reference page.) Or, you can try specifying a lower order controller structure and use musyn to tune it. See Robust Tuning of Fixed-Structure Controller.

Tune a fixed-structure controller for the control system in Unstructured Robust Controller Synthesis, which shows how to use musyn to design an unstructured full-order centralized controller, and returns a controller of order 11. For this example, use the same control structure, as shown in the diagram, but restrict the structure of K to a fifth-order state-space model.

First, construct the same plant P as in Unstructured Robust Controller Synthesis. The plant is an uncertain plant G augmented by a sensitivity-weighting function Wp.

G0 = tf(1,[1 -1]);
Wu = 0.25*tf([1/2 1],[1/32 1]); 
InputUnc = ultidyn('InputUnc',[1 1]);
G = G0*(1+InputUnc*Wu);
G.InputName = 'u';
G.OutputName = 'y1';

Wp = makeweight(100,[1 0.5],0.25);
Wp.InputName = 'y';
Wp.OutputName = 'e';

SumD = sumblk('y = y1 + d');
inputs = {'d','u'};
outputs = {'e','y'};
P = connect(G,Wp,SumD,inputs,outputs);

Create a tunableSS control design block to represent the fixed controller structure, a fifth-order state-space model.

C0 = tunableSS('K',5,1,1);

Form the closed-loop system, which is a generalized state-space (genss) model that has both a tunable block and a uncertain block.

CL0 = lft(P,C0)
Generalized continuous-time state-space model with 1 outputs, 1 inputs, 8 states, and the following blocks:
  InputUnc: Uncertain 1x1 LTI, peak gain = 1, 1 occurrences
  K: Tunable 1x1 state-space model, 5 states, 1 occurrences.

Type "ss(CL0)" to see the current value and "CL0.Blocks" to interact with the blocks.

Use musyn to tune the free entries of the controller.

[CL,CLperf,info] = musyn(CL0);
D-K ITERATION SUMMARY:
-----------------------------------------------------------------
                       Robust performance               Fit order
-----------------------------------------------------------------
  Iter         K Step       Peak MU       D Fit             D
    1           1.342        1.342        1.357             8
    2          0.7951       0.7808       0.7858             6
    3          0.6816       0.6781       0.6818            10
    4          0.6621       0.6575       0.6634            10
    5          0.6597       0.6536       0.6594            10
    6          0.6587       0.6528       0.6601             6

Best achieved robust performance: 0.653

Even when you specify the structure of K as a fifth-order state-space model, musyn can find tuned parameter values that yield very similar robust performance to the 11th-order controller. You can try still lower controller orders to see whether the robust stability is preserved.

The robust controller returned by musyn optimizes robust performance of uncertain feedback systems. When the uncertain plant contains umargin blocks, this requirement of robust stability is equivalent to enforcing disk-based gain and phase margins equal to the umargin uncertainty. In this example, design a robust controller for an uncertain plant, enforcing closed-loop stability against gain and phase variations at the plant inputs and outputs.

Use the plant from the example "Loop Shaping with mixsyn" on the mixsyn reference page, introducing some uncertainty in the location of the system poles and zero.

a = ureal('a',1,'PlusMinus',[-0.1,0.1]);
s = zpk('s');
G = (s-a)/(s+a)^2;

The goal is to enforce closed-loop stability against gain and phase variation at the plant inputs and outputs, over the full range of parameter variation modeled in the plant G. To do so, use the target gain and phase margins to create umargin uncertain blocks and attach them to the plant. For this example, suppose that you want stability against gain variations of a factor of 1.5 in either direction, or phase variations of ±20°.

DGM = getDGM(1.5,20,'tight');
Fin = umargin('Fin',DGM);
Fout = umargin('Fout',DGM);
Gmarg = Fout*G*Fin
Uncertain continuous-time state-space model with 1 outputs, 1 inputs, 7 states.
The model uncertainty consists of the following blocks:
  Fin: Uncertain gain/phase, gain × [0.667,1.5], phase ± 22.6 deg, 1 occurrences
  Fout: Uncertain gain/phase, gain × [0.667,1.5], phase ± 22.6 deg, 1 occurrences
  a: Uncertain real, nominal = 1, variability = [-0.1,0.1], 3 occurrences

Type "Gmarg.NominalValue" to see the nominal value and "Gmarg.Uncertainty" to interact with the uncertain elements.

For tuning with musyn, you augment the plant with weighting functions that enforce your performance requirement such as reference tracking, disturbance rejection, and robustness. For this example, use the weighting functions described in the example on the on the mixsyn reference page.

W1 = makeweight(10,[1 0.1],0.01);
W2 = makeweight(0.1,[32 0.32],1);
W3 = makeweight(0.01,[1 0.1],10);

Gaug = augw(Gmarg,W1,W2,W3);

Use musyn to design a controller.

[K,gam] = musyn(Gaug,1,1);
D-K ITERATION SUMMARY:
-----------------------------------------------------------------
                       Robust performance               Fit order
-----------------------------------------------------------------
  Iter         K Step       Peak MU       D Fit             D
    1           7.753        1.527        1.539            24
    2           1.131        1.084        1.091            46
    3          0.9989       0.9956        1.004            36
    4           0.998       0.9961        1.002            38
    5          0.9984       0.9929       0.9994            40

Best achieved robust performance: 0.993

musyn achieves a robust performance of about 1, which tells you that the closed-loop gain remains below 1 for the full range of uncertainty specified in the plant. To confirm that the resulting controller achieves the target gain and phase margins, use wcdiskmargin to examine the worst-case gain and phase margins of the system against simultaneous variations at the plant inputs and outputs. Use the plant G that contains the parameter uncertainty but not the gain and phase uncertainty.

MMIO = wcdiskmargin(G,K)
MMIO = struct with fields:
           GainMargin: [0.6028 1.6590]
          PhaseMargin: [-27.8389 27.8389]
           DiskMargin: 0.4957
           LowerBound: 0.4957
           UpperBound: 0.4967
    CriticalFrequency: 0.9225
    WorstPerturbation: [1x1 struct]

The worst-case disk-based gain margin of [0.6 1.66] is slightly larger than the target margin of [0.66 1.5], and the worst-case phase margin of ±28° is likewise better than the required margin of ±20°. Thus, the controller K enforces the desired margins for the entire parameter-uncertainty range of the plant G.

For an example that uses umargin blocks with musyn to enforce gain and phase margins in a MIMO control loop, see Robust Controller for Spinning Satellite.

Input Arguments

collapse all

Uncertain plant, specified as an uncertain state-space (uss) model. P has inputs [w;u] and outputs [z;y], where:

  • w represents the disturbance inputs.

  • u represents the control inputs.

  • z represents the error outputs to be kept small.

  • y represents the measurement outputs provided to the controller.

Construct P such that measurement outputs y are the last outputs, and the control inputs u are the last inputs.

P can optionally contain weighting functions (loop-shaping filters) that represent control objectives that you want the controller to robustly satisfy. For a detailed example that constructs such an augmented plant for μ synthesis, see Robust Control of Active Suspension.

Number of measurement output signals in the plant, specified as a nonnegative integer. The function takes the last nmeas plant outputs as the measurements y. The returned controller K has nmeas inputs.

Number of control input signals in the plant, specified as a nonnegative integer. The function takes the last ncont plant inputs as the controls u. The returned controller K has ncont outputs.

Initial value of the controller, specified as a dynamic system model, such as a state-space (ss) model. By default, musyn begins by computing an H controller for the nominal system. Use Kinit to start with a different controller. Setting Kinit = info(j).K uses the controller computed in the jth D-K iteration of the musyn run that produced info.

One use of this input argument is to continue iterating after musyn reaches the maximum number of iterations specified by the 'MaxIter' option of musynOptions. If the display shows that musyn is still making progress when it stops iterating, you can run musyn again, starting with the last synthesized controller, to see how much more musyn can improve the robust performance.

Additional options for the computation, specified as an options object you create using musynOptions. Available options include the following:

  • Turn on a full display of algorithm progress that pauses after each D-K iteration so that you can examine intermediate results.

  • Use mixed μ synthesis to treat real uncertain parameters as real rather than as complex, for a less conservative and possibly more robust controller.

  • Set maximum orders for the functions used to fit the D and G scalings.

  • Use parallel computing for independent optimization runs when tuning a fixed-structure controller.

For information about all available options, see musynOptions.

Closed-loop system with tunable controller elements, specified as a generalized state-space (genss) model with both uncertain and tunable control design blocks. Construct CL0 by creating and interconnecting:

  • Numeric LTI models representing the fixed components of the control system

  • Uncertain control design blocks, such as ureal and ultidyn blocks, representing the uncertain components of the plant

  • Optional LTI weighting functions (loop-shaping filters) that represent control objectives

  • Tunable control design blocks such as tunablePID, tunableSS, and tunableGain to represent tunable components of the controller C0

For an example that shows how to build such a model, see Build Tunable Control System Model with Uncertain Parameters.

Initial values of the tunable parameters in CL0, specified as a structure or as a genss model. By default, musyn begins by tuning the controller parameters for the nominal system. Use blockvals to start with a different controller. Specify the initial parameter values as:

  • A structure whose fields are the names of the tunable blocks, and whose values are control design blocks having the desired current values. For instance, if you have a tuned system CL obtained in a previous musyn run, you can initialize with the tuned values of the controller blocks in CL by setting blockvals = CL.Blocks.

  • A genss model whose tunable blocks have the desired current value.

Setting blockvals = info(j).K uses the tuned values computed in the jth D-K iteration of the musyn run that produced info. For instance, if you have a tuned system CL, you can initialize with its tuned values by setting blockvals = CL. Such initialization can be useful for continuing iteration after musyn reaches the maximum number of iterations. If the display shows that musyn is still making progress when it stops iterating, you can run musyn again, starting with the last synthesized controller, to see how much more musyn can improve the robust performance.

Output Arguments

collapse all

Controller that yields the robust H performance CLperf, returned as a state-space (ss) model. The controller has nmeas inputs and ncont outputs.

The order of K depends on the order of the fitting functions for the D and G scalings and the number of uncertain blocks in your system. For information on how to reduce the order of the returned controller, see Improve Results of Mu Synthesis.

Best achieved robust performance, returned as a positive scalar. musyn attempts to optimize the controller K to minimize this value. The closed-loop gain from w to z remains below CLperf for uncertainty up 1/CLperf times the uncertainty specified in the plant. For instance, if CLperf is 1.125, then the closed-loop gain remains below 1.125 for up to 0.8 times the uncertainty specified in the plant. Use uscale to convert this normalized amount of uncertainty into the actual uncertainty ranges they represent.

For more information on the computation and interpretation of this quantity, see Robust Performance Measure for Mu Synthesis. For information on how to improve the best achieved robust performance, see Improve Results of Mu Synthesis.

Details of D-K iteration results, returned as a structure array. info(j) contains the results of the jth D-K iteration in the run. info has the following fields.

FieldDescription
K

Optimal controller found in the K step of this iteration, returned as a state-space (ss) model or as a structure containing tuned control design blocks.

  • For unstructured controller synthesis, info(j).K is a state-space model.

  • For fixed-structure controller tuning, info(j).K is a structure whose names are the names of the tunable blocks in CL0. The values are tunable control design blocks with current values set to the tuned value.

gammaOptimized scaled H performance, returned as a scalar. This scaled performance is achieved by optimal controller info(j).K. The default command-window display shows this value in the K Step column. For details about the computation and interpretation of this quantity, see Robust Performance Measure for Mu Synthesis.
KInfo

H synthesis data, returned as a structure.

  • For centralized, full-order controller synthesis, this structure is the same as the info output argument of hinfsyn.

  • For fixed-structure controller tuning, this structure is the same as the info output argument of hinfstruct.

PeakMuRobust performance μ¯ of the closed-loop system with controller info(j).K, returned as a positive scalar value. The default command-window display shows this value in the Peak MU column . For details about the computation and interpretation of this quantity, see Robust Performance Measure for Mu Synthesis.
DG

D and G scaling data from robust performance analysis in this iteration, returned as a structure with the following fields.

  • Frequency — Vector of frequencies for which μ analysis was performed

  • Dr, Dc, Gcr — Values of the scaling factors Dr(ω), Dc(ω), and Gcr(ω) at the corresponding frequencies.

For more information about D and G scaling, see Robust Performance Measure for Mu Synthesis.

dr,dc,PSIRational fit of the D and G scaling data, returned as ss models. For details about how musyn fits the scaling data, see Robust Performance Measure for Mu Synthesis.
FitOrderOrders of the functions used to fit the scaling data in this iteration, returned as a two-element vector. The two entries are the fit order for the D and G scalings, respectively. The default command-window display shows these values in the Fit Order column.
PeakMuFitScaled H performance achieved with info(j).K and the fitted D and G scalings, returned as a scalar. The default command-window display shows this value in the DG Fit column .

Tuned closed-loop system, returned as a generalized state-space genss model with the same uncertain and tunable control design blocks as CL0. The current values of the tunable blocks in CL.Blocks are set to the tuned values.

Information about each independent randomized run, returned as a structure array. Use this output with fixed-structure μ synthesis when you set the 'RandomStart' option of musynOptions to N > 0. That option causes musyn to perform multiple independent D-K iteration runs initialized from different values of controller parameters. runs(j) contains the results of the jth independent restart in the following fields.

FieldDescription
K

Optimal controller found in this run, returned as a structure containing the tuned values of the control design blocks.

muPerfBest achieved robust H∞ performance for this run, returned as a positive scalar. The controller that musyn returns when you use multiple runs is the one for which runs(j).muPerf is smallest.
Info

Details of D-K iteration results, returned as a structure array. runs(j).Info contains fields corresponding to those of the info output of musyn, for the jth run.

Limitations

  • For discrete-time plants, sample times that are very small compared to other dynamics in the problem can cause the synthesis to fail due to numeric issues. For best results, choose sample times such that significant dynamics (system dynamics and weighting functions) are not more than a decade or two below the Nyquist frequency. The issue arises because the dynamics of the D and G scalings tend to concentrate around the system dynamics. A too-small sample time results an accumulation of poles near z = 1 (relative to the Nyquist frequency), which causes numeric problems with the Riccati solvers. Alternatively, design in continuous time.

Tips

Algorithms

musyn uses an iterative process called D-K iteration. In this process, the function:

  1. Uses H synthesis to find a controller that minimizes the closed-loop gain of the nominal system.

  2. Performs a robustness analysis to estimate the robust H performance of the closed-loop system. This amount is expressed as a scaled H norm involving dynamic scalings called the D and G scalings (the D step).

  3. Finds a new controller to minimize the scaled H norm obtained in step 2 (the K step).

  4. Repeats steps 2 and 3 until the robust performance stops improving.

For more details about how this algorithm works, see D-K Iteration Process.

Extended Capabilities

Version History

Introduced in R2019b