TuningGoal.Gain class

Package: TuningGoal

Gain constraint for control system tuning

Description

Use the `TuningGoal.Gain` object to specify a constraint that limits the gain from a specified input to a specified output. Use this tuning goal for control system tuning with tuning commands such as `systune` or `looptune`.

When you use `TuningGoal.Gain`, the software attempts to tune the system so that the gain from the specified input to the specified output does not exceed the specified value. By default, the constraint is applied with the loop closed. To apply the constraint to an open-loop response, use the `Openings` property of the `TuningGoal.Gain` object.

You can use a gain constraint to:

• Enforce a design requirement of disturbance rejection across a particular input/output pair, by constraining the gain to be less than 1

• Enforce a custom roll-off rate in a particular frequency band, by specifying a gain profile in that band

Construction

```Req = TuningGoal.Gain(inputname,outputname,gainvalue)``` creates a tuning goal that constrains the gain from `inputname` to `outputname` to remain below the value `gainvalue`.

You can specify the `inputname` or `outputname` as cell arrays (vector-valued signals). If you do so, then the tuning goal constrains the largest singular value of the transfer matrix from `inputname` to `outputname`. See `sigma` for more information about singular values.

`Req = TuningGoal.Gain(inputname,outputname,gainprofile)` specifies the maximum gain as a function of frequency. You can specify the target gain profile (maximum gain across the I/O pair) as a smooth transfer function. Alternatively, you can sketch a piecewise error profile using an `frd` model.

Input Arguments

 `inputname` Input signals for the tuning goal, specified as a character vector or, for multiple-input tuning goals, a cell array of character vectors. If you are using the tuning goal to tune a Simulink® model of a control system, then `inputname` can include:Any model input.Any linear analysis point marked in the model.Any linear analysis point in an `slTuner` (Simulink Control Design) interface associated with the Simulink model. Use `addPoint` (Simulink Control Design) to add analysis points to the `slTuner` interface. Use `getPoints` (Simulink Control Design) to get the list of analysis points available in an `slTuner` interface to your model. For example, suppose that the `slTuner` interface contains analysis points `u1` and `u2`. Use `'u1'` to designate that point as an input signal when creating tuning goals. Use `{'u1','u2'}` to designate a two-channel input. If you are using the tuning goal to tune a generalized state-space (`genss`) model of a control system, then `inputname` can include: Any input of the `genss` model Any `AnalysisPoint` location in the control system modelFor example, if you are tuning a control system model, `T`, then `inputname` can be any input name in `T.InputName`. Also, if `T` contains an `AnalysisPoint` block with a location named `AP_u`, then `inputname` can include `'AP_u'`. Use `getPoints` to get a list of analysis points available in a `genss` model.If `inputname` is an `AnalysisPoint` location of a generalized model, the input signal for the tuning goal is the implied input associated with the `AnalysisPoint` block: For more information about analysis points in control system models, see Mark Signals of Interest for Control System Analysis and Design. `outputname` Output signals for the tuning goal, specified as a character vector or, for multiple-output tuning goals, a cell array of character vectors. If you are using the tuning goal to tune a Simulink model of a control system, then `outputname` can include:Any model output.Any linear analysis point marked in the model.Any linear analysis point in an `slTuner` (Simulink Control Design) interface associated with the Simulink model. Use `addPoint` (Simulink Control Design) to add analysis points to the `slTuner` interface. Use `getPoints` (Simulink Control Design) to get the list of analysis points available in an `slTuner` interface to your model. For example, suppose that the `slTuner` interface contains analysis points `y1` and `y2`. Use `'y1'` to designate that point as an output signal when creating tuning goals. Use `{'y1','y2'}` to designate a two-channel output. If you are using the tuning goal to tune a generalized state-space (`genss`) model of a control system, then `outputname` can include: Any output of the `genss` model Any `AnalysisPoint` location in the control system modelFor example, if you are tuning a control system model, `T`, then `outputname` can be any output name in `T.OutputName`. Also, if `T` contains an `AnalysisPoint` block with a location named `AP_u`, then `outputname` can include `'AP_u'`. Use `getPoints` to get a list of analysis points available in a `genss` model.If `outputname` is an `AnalysisPoint` location of a generalized model, the output signal for the tuning goal is the implied output associated with the `AnalysisPoint` block: For more information about analysis points in control system models, see Mark Signals of Interest for Control System Analysis and Design. `gainvalue` Maximum gain (linear). The gain constraint `Req` specifies that the gain from `inputname` to `outputname` is less than `gainvalue`. `gainvalue` is a scalar value. If the signals `inputname` or `outputname` are vector-valued signals, then `gainvalue` constrains the largest singular value of the transfer matrix from `inputname` to `outputname`. See `sigma` for more information about singular values. `gainprofile` Gain profile as a function of frequency. The gain constraint `Req` specifies that the gain from `inputname` to `outputname` at a particular frequency is less than `gainprofile`. You can specify `gainprofile` as a smooth transfer function (`tf` , `zpk`, or `ss` model). Alternatively, you can sketch a piecewise gain profile using a `frd` model or the `makeweight` (Robust Control Toolbox) function. When you do so, the software automatically maps the gain profile onto a `zpk` model. The magnitude of this `zpk` model approximates the desired gain profile. Use `viewGoal(Req)` to plot the magnitude of the `zpk` model. `gainprofile` is a SISO transfer function. If `inputname` or `outputname` are cell arrays, `gainprofile` applies to all I/O pairs from `inputname` to `outputname` If you are tuning in discrete time (that is, using a `genss` model or `slTuner` interface with nonzero `Ts`), you can specify `gainfprofile` as a discrete-time model with the same `Ts`. If you specify `gainfprofile` in continuous time, the tuning software discretizes it. Specifying the gain profile in discrete time gives you more control over the gain profile near the Nyquist frequency.

Properties

 `MaxGain` Maximum gain as a function of frequency, expressed as a SISO `zpk` model. The software automatically maps the `gainvalue` or `gainprofile` input arguments to a `zpk` model. The magnitude of this `zpk` model approximates the desired gain profile. The tuning goal derives and is stored in the `MaxGain` property. Use `viewGoal(Req)` to plot the magnitude of `MaxGain`. `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. Express this value in the frequency units of the control system model you are tuning (rad/`TimeUnit`). For example, suppose `Req` is a tuning goal that you want to apply only between 1 and 100 rad/s. To restrict the tuning goal to this band, 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. `Stabilize` Stability requirement on closed-loop dynamics, specified as 1 (`true`) or 0 (`false`). By default, `TuningGoal.Gain` imposes a stability requirement on the closed-loop transfer function from the specified inputs to outputs, in addition to the gain requirement. If stability is not required or cannot be achieved, set `Stabilize` to `false` to remove the stability requirement. For example, if the gain constraint applies to an unstable open-loop transfer function, set `Stabilize` to `false`. Default: 1(`true`) `InputScaling` Input signal scaling, specified as a vector of positive real values. Use this property to specify the relative amplitude of each entry in vector-valued input signals when the choice of units results in a mix of small and large signals. This information is used to scale the closed-loop transfer function from `Input` to `Output` when the tuning goal is evaluated. Suppose T(s) is the closed-loop transfer function from `Input` to `Output`. The tuning goal is evaluated for the scaled transfer function Do–1T(s)Di. The diagonal matrices Do and Di have the `OutputScaling` and `InputScaling` values on the diagonal, respectively. The default value, `[]` , means no scaling. Default: `[]` `OutputScaling` Output signal scaling, specified as a vector of positive real values. Use this property to specify the relative amplitude of each entry in vector-valued output signals when the choice of units results in a mix of small and large signals. This information is used to scale the closed-loop transfer function from `Input` to `Output` when the tuning goal is evaluated. Suppose T(s) is the closed-loop transfer function from `Input` to `Output`. The tuning goal is evaluated for the scaled transfer function Do–1T(s)Di. The diagonal matrices Do and Di have the `OutputScaling` and `InputScaling` values on the diagonal, respectively. The default value, `[]` , means no scaling. Default: `[]` `Input` Input signal names, specified as a cell array of character vectors that identify the inputs of the transfer function that the tuning goal constrains. The initial value of the `Input` property is set by the `inputname` input argument when you construct the tuning goal. `Output` Output signal names, specified as a cell array of character vectors that identify the outputs of the transfer function that the tuning goal constrains. The initial value of the `Output` property is set by the `outputname` input argument when you construct 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` (Simulink Control Design) interface associated with the Simulink model. Use `addPoint` (Simulink Control Design) to add analysis points and loop openings to the `slTuner` interface. Use `getPoints` (Simulink Control Design) 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 gain constraint that enforces a disturbance rejection requirement from a signal `'du'` to a signal `'u'`.

`Req = TuningGoal.Gain('du','u',1);`

This requirement specifies that the maximum gain of the response from `'du'` to `'u'` not exceed 1 (0 dB).

Create a tuning goal that constrains the response from a signal `'du'` to a signal `'u'` to roll off at 20 dB/decade at frequencies greater than 1. The tuning goal also specifies disturbance rejection (maximum gain of 1) in the frequency range [0,1].

```gmax = frd([1 1 0.01],[0 1 100]); Req = TuningGoal.Gain('du','u',gmax);```

These commands use a `frd` model to specify the gain profile as a function of frequency. The maximum gain of 1 dB at the frequency 1 rad/s, together with the maximum gain of 0.01 dB at the frequency 100 rad/s, specifies the desired rolloff of 20 dB/decade.

The software converts `gmax` into a smooth function of frequency that approximates the piecewise specified requirement. Display the gain profile using viewGoal.

`viewGoal(Req)`

The dashed line shows the gain profile, and the region indicates where the requirement is violated.

Tips

• This tuning goal imposes an implicit stability constraint on the closed-loop transfer function from `Input` to `Output`, 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` object, 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.Gain`, f(x) is given by:

`$f\left(x\right)={‖{W}_{F}\left(s\right){D}_{o}^{-1}T\left(s,x\right){D}_{i}‖}_{\infty },$`

or its discrete-time equivalent, for discrete-time tuning. Here, T(s,x) is the closed-loop transfer function from `Input` to `Output`. Do and Di are diagonal matrices with the `OutputScaling` and `InputScaling` property values on the diagonal, respectively. ${‖\text{\hspace{0.17em}}\cdot \text{\hspace{0.17em}}‖}_{\infty }$ denotes the H norm (see `getPeakGain`).

The frequency weighting function WF is the regularized gain profile, derived from the maximum gain profile you specify. The gains of WF and `1/MaxGain` roughly match inside the frequency band `Focus`. WF is always stable and proper. Because poles of WF close to s = 0 or s = `Inf` might lead to poor numeric conditioning of the `systune` optimization problem, it is not recommended to specify maximum gain profiles with very low-frequency or very high-frequency dynamics.

To obtain WF, use:

`WF = getWeight(Req,Ts)`

where `Req` is the tuning goal, and `Ts` is the sample time at which you are tuning (`Ts = 0` for continuous time). For more information about regularization and its effects, see Visualize Tuning Goals.

Compatibility Considerations

expand all

Behavior changed in R2016a

Introduced in R2016a