TuningGoal.Margins class

Package: TuningGoal

Stability margin requirement for control system tuning

Description

Use TuningGoal.Margins to specify a tuning goal for the gain and phase margins of a SISO or MIMO feedback loop. You can use this tuning goal for validating a tuned control system with viewGoal. You can also use the tuning goal for control system tuning with tuning commands such as systune or looptune.

After you create a tuning goal, you can configure it further by setting Properties of the object.

After using the tuning goal to tune a control system, you can visualize the tuning goal and the tuned value using the viewGoal command. For information about interpreting the margins goal, see Stability Margins in Control System Tuning.

Construction

Req = TuningGoal.Margins(location,gainmargin,phasemargin) creates a tuning goal that specifies the minimum gain and phase margins at the specified location in the control system.

Input Arguments

location

Location in the control system at which the minimum gain and phase margins apply, specified as a character vector or cell array of character vectors that identify one or more locations in the control system to tune. What locations are available depends on what kind of system you are tuning:

  • If you are tuning a Simulink® model of a control system, you can use any linear analysis point marked in the model, or any linear analysis point in an slTuner interface associated with the Simulink model. Use addPoint to add analysis points to the slTuner interface. For example, if the slTuner interface contains an analysis point u, you can use 'u' to refer to that point when creating tuning goals. Use getPoints to get the list of analysis points available in an slTuner interface to your model.

  • If you are tuning a generalized state-space (genss) model of a control system, you can use any AnalysisPoint location in the control system model. For example, the following code creates a PI loop with an analysis point at the plant input 'u'.

    AP = AnalysisPoint('u');
    G = tf(1,[1 2]);
    C = tunablePID('C','pi');
    T = feedback(G*AP*C,1);
    

    When creating tuning goals, you can use 'u' to refer to the analysis point at the plant input. Use getPoints to get the list of analysis points available in a genss model.

The margin requirements apply to the point-to-point, open-loop transfer function at the specified loop-opening location. That transfer function is the open-loop response obtained by injecting signals at the specified location, and measuring the return signals at the same point.

If location is a cell array, then the margin requirement applies to the MIMO open-loop transfer function.

gainmargin

Required minimum gain margin for the feedback loop, specified as a scalar value in dB.

For MIMO feedback loops, the gain margin is based upon the notion of disk margins, which guarantee stability for concurrent gain and phase variations of ±gainmargin and ±phasemargin in all feedback channels. See Stability Analysis Using Disk Margins (Robust Control Toolbox) for more information about disk margins.

phasemargin

Required minimum phase margin for the feedback loop, specified as a scalar value in degrees.

For MIMO feedback loops, the phase margin is based upon the notion of disk margins, which guarantee stability for concurrent gain and phase variations of ±gainmargin and ±phasemargin in all feedback channels. See Stability Analysis Using Disk Margins (Robust Control Toolbox) for more information about disk margins.

Properties

GainMargin

Required minimum gain margin for the feedback loop, specified as a scalar value in decibels (dB).

The value of the GainMargin property is set by the gainmargin input argument when you create the tuning goal.

PhaseMargin

Required minimum phase margin for the feedback loop, specified as a scalar value in degrees.

The value of the PhaseMargin property is set by the phasemargin input argument when you create the tuning goal.

ScalingOrder

Controls the order (number of states) of the scalings involved in computing MIMO stability margins. Static scalings (ScalingOrder = 0) are used by default. Increasing the order may improve results at the expense of increased computations. Use viewGoal to assess the gap between optimized and actual margins. If this gap is too large, consider increasing the scaling order. See Stability Margins in Control System Tuning.

Default: 0 (static scaling)

Focus

Frequency band in which tuning goal is enforced, specified as a row vector of the form [min,max].

Set the Focus property to limit enforcement of the tuning goal to a particular frequency band. For best results with stability margin requirements, pick a frequency band extending about one decade on each side of the gain crossover frequencies. For example, suppose Req is a TuningGoal.Margins object that you are using to tune a system with approximately 10 rad/s bandwidth. To limit the enforcement of the tuning goal, use the following command:

Req.Focus = [1,100];

Default: [0,Inf] for continuous time; [0,pi/Ts] for discrete time, where Ts is the model sample time.

Location

Location at which the minimum gain and phase margins apply, specified as a cell array of character vectors that identify one or more analysis points in the control system to tune. For example, if Location = {'u'}, the tuning goal enforces the minimum gain and phase margins at an analysis point 'u'.

The value of the Location property is set by the location input argument when you create the tuning goal.

Models

Models to which the tuning goal applies, specified as a vector of indices.

Use the Models property when tuning an array of control system models with systune, to enforce a tuning goal for a subset of models in the array. For example, suppose you want to apply the tuning goal, Req, to the second, third, and fourth models in a model array passed to systune. To restrict enforcement of the tuning goal, use the following command:

Req.Models = 2:4;

When Models = NaN, the tuning goal applies to all models.

Default: NaN

Openings

Feedback loops to open when evaluating the tuning goal, specified as a cell array of character vectors that identify loop-opening locations. The tuning goal is evaluated against the open-loop configuration created by opening feedback loops at the locations you identify.

If you are using the tuning goal to tune a Simulink model of a control system, then Openings can include any linear analysis point marked in the model, or any linear analysis point in an slTuner interface associated with the Simulink model. Use addPoint to add analysis points and loop openings to the slTuner interface. Use getPoints to get the list of analysis points available in an slTuner interface to your model.

If you are using the tuning goal to tune a generalized state-space (genss) model of a control system, then Openings can include any AnalysisPoint location in the control system model. Use getPoints to get the list of analysis points available in the genss model.

For example, if Openings = {'u1','u2'}, then the tuning goal is evaluated with loops open at analysis points u1 and u2.

Default: {}

Name

Name of the tuning goal, specified as a character vector.

For example, if Req is a tuning goal:

Req.Name = 'LoopReq';

Default: []

Examples

collapse all

Create a margin requirement for the inner loop of the following control system. The requirement imposes a minimum gain margin of 5 dB and a minimum phase margin of 40 degrees.

Create a model of the system. To do so, specify and connect the numeric plant models G1 and G2, and the tunable controllers C1 and C2. Also specify and connect the AnalysisPoint blocks AP1 and AP2 that mark points of interest for analysis and tuning.

G1 = tf(10,[1 10]);
G2 = tf([1 2],[1 0.2 10]);
C1 = tunablePID('C','pi');
C2 = tunableGain('G',1);
AP1 = AnalysisPoint('AP1');
AP2 = AnalysisPoint('AP2');
T = feedback(G1*feedback(G2*C2,AP2)*C1,AP1);

Create a tuning requirement object.

Req = TuningGoal.Margins('AP2',5,40);

This requirement imposes the specified stability margins on the feedback loop identified by the AnalysisPoint channel 'AP2', which is the inner loop.

Specify that these margins are evaluated with the outer loop of the control system open.

Req.Openings = {'AP1'};

Adding 'AP1' to the Openings property of the tuning requirements object ensures that systune evaluates the requirement with the loop open at that location.

Use systune to tune the free parameters of T to meet the tuning requirement specified by Req. You can then use viewGoal to validate the tuned control system against the requirement.

Create a requirement that sets minimum gain and phase margins for the loop defined by three loop-opening locations in a control system to tune. Because this loop is defined by three loop-opening locations, it is a MIMO loop.

The requirement sets a minimum gain margin of 10 dB and a minimum phase margin of 40 degrees, within the band between 0.1 and 10 rad/s.

Req = TuningGoal.Margins({'r','theta','phi'},10,40);

The names 'r', 'theta', and 'phi' must specify valid loop-opening locations in the control system that you are tuning.

Limit the requirement to the frequency band between 0.1 and 10 rad/s.

 Req.Focus = [0.1 10];

Tips

  • This tuning goal imposes an implicit stability constraint on the closed-loop sensitivity function measured at Location, evaluated with loops opened at the points identified in Openings. The dynamics affected by this implicit constraint are the stabilized dynamics for this tuning goal. The MinDecay and MaxRadius options of systuneOptions control the bounds on these implicitly constrained dynamics. If the optimization fails to meet the default bounds, or if the default bounds conflict with other requirements, use systuneOptions to change these defaults.

Algorithms

When you tune a control system using a TuningGoal, the software converts the tuning goal into a normalized scalar value f(x), where x is the vector of free (tunable) parameters in the control system. The software then adjusts the parameter values to minimize f(x) or to drive f(x) below 1 if the tuning goal is a hard constraint.

For TuningGoal.Margins, f(x) is given by:

f(x)=2αSαI.

S = D–1[I – L(s,x)]–1D is the scaled sensitivity function.

L(s,x) is the open-loop response being shaped.

D is an automatically-computed loop scaling factor.

α is a scalar parameter computed from the specified gain and phase margin.

Compatibility Considerations

expand all

Behavior changed in R2016a

Introduced in R2016a