Accelerating the pace of engineering and science

# TuningGoal.WeightedVariance class

Package: TuningGoal

Frequency-weighted H2 norm constraint for control system tuning

## Description

Use the TuningGoal.WeightedVariance object to specify a tuning requirement that limits the weighted H2 norm of the transfer function from specified inputs to outputs. The H2 norm measures:

• The total energy of the impulse response, for deterministic inputs to the transfer function.

• The square root of the output variance for a unit-variance white-noise input, for stochastic inputs to the transfer function. Equivalently, the H2 norm measures the root-mean-square of the output for such input.

You can use the TuningGoal.WeightedVariance requirement for control system tuning with tuning commands, such as systune or looptune. By specifying this requirement, you can tune the system response to stochastic inputs with a nonuniform spectrum such as colored noise or wind gusts. You can also use TuningGoal.WeightedVariance to specify LQG-like performance objectives.

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

## Construction

Req = TuningGoal.Variance(inputname,outputname,WL,WR) creates a tuning requirement Req. This tuning requirement specifies that the closed-loop transfer function H(s) from the specified input to output meets the requirement:

||WL(s)H(s)WR(s)||2 < 1.

The notation ||•||2 denotes the H2 norm.

When you are tuning a discrete-time system, Req imposes the following constraint:

$\frac{1}{\sqrt{{T}_{s}}}{‖{W}_{L}\left(z\right)T\left(z,x\right){W}_{R}\left(z\right)‖}_{2}<1.$

The H2 norm is scaled by the square root of the sampling time Ts to ensure consistent results with tuning in continuous time. To constrain the true discrete-time H2 norm, multiply either WL or WR by $\sqrt{{T}_{s}}$.

### Input Arguments

 inputname Input signals for the requirement, specified as a string or as a cell array of strings, for multiple-input requirements. If you are using the requirement 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 interface associated with the Simulink model. Use addPoint to add analysis points 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 requirement 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 model For example, if you are tuning a control system model, T, then inputname can be a string contained 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 requirement is the implied input associated with the AnalysisPoint block: For more information about analysis points in control system models, see Managing Signals in Control System Analysis and Design. outputname Output signals for the requirement, specified as a string or as a cell array of strings, for multiple-output requirements. If you are using the requirement 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 interface associated with the Simulink model. Use addPoint to add analysis points 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 requirement 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 model For example, if you are tuning a control system model, T, then inputname can be a string contained in T.OutputName. Also, if T contains an AnalysisPoint block with a location named AP_y, then inputname can include 'AP_y'. 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 requirement is the implied output associated with the AnalysisPoint block: For more information about analysis points in control system models, see Managing Signals in Control System Analysis and Design. WL,WR Frequency-weighting functions, specified as scalars or as SISO or MIMO numeric LTI models. The functions WL and WR provide the weights for the tuning requirement. The tuning requirement ensures that the gain H(s) from the specified input to output satisfies the inequality:||WL(s)H(s)WR(s)||2 < 1.WL provides the weighting for the output channels of H(s), and WR provides the weighting for the input channels. You can specify scalar weights or frequency-dependent weighting. To specify a frequency-dependent weighting, use a numeric LTI model. For example: WL = tf(1,[1 0.01]); WR = 10; If you specify MIMO weighting functions, then inputname and outputname must be vector signals. The dimensions of the vector signals must be such that the dimensions of H(s) are commensurate with the dimensions of WL and WR. For example, if you specify WR = diag([1 10]), then inputname must include two signals. Scalar values, however, automatically expand to any input or output dimension. When you are tuning a discrete-time system, WL and WR must be either scalars or discrete-time models having the same sampling time (Ts) as the model you are tuning. A value of WL = [] or WR = [] is interpreted as the identity.

## Properties

 WL Frequency-weighting function for the output channels of the transfer function H(s) to constrain, specified as a scalar, or as a SISO or MIMO numeric LTI model. The initial value of the WL property is set by the WL input argument when you construct the requirement object. WR Frequency-weighting function for the input channels of the transfer function to constrain, specified as a scalar or as a SISO or MIMO numeric LTI model. The initial value of the WR property is set by the WR input argument when you construct the requirement object. Input Input signal names, specified as a cell array of strings. These strings specify the names of the inputs of the transfer function that the tuning requirement constrains. The initial value of the Input property is set by the inputname input argument when you construct the requirement object. Output Output signal names, specified as a cell array of strings. These strings specify the names of the outputs of the transfer function that the tuning requirement constrains. The initial value of the Output property is set by the outputname input argument when you construct the requirement object. Models Models to which the tuning requirement 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 requirement for a subset of models in the array. For example, suppose you want to apply the tuning requirement, Req, to the second, third, and fourth models in a model array passed to systune. To restrict enforcement of the requirement, use the following command: Req.Models = 2:4; When Models = NaN, the tuning requirement applies to all models. Default: NaN Openings Feedback loops to open when evaluating the requirement, specified as a cell array of strings that identify loop-opening locations. The tuning requirement is evaluated against the open-loop configuration created by opening feedback loops at the locations you identify. If you are using the requirement 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 requirement 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. Default: {} Name Name of the requirement object, specified as a string. For example, if Req is a requirement: Req.Name = 'LoopReq'; Default: []

## Tips

When you use this requirement to tune a continuous-time control system, systune attempts to enforce zero feedthrough (D = 0) on the transfer that the requirement constrains. Zero feedthrough is imposed because the H2 norm, and therefore the value of the tuning goal (see Algorithms), is infinite for continuous-time systems with nonzero feedthrough.

systune enforces zero feedthrough by fixing to zero all tunable parameters that contribute to the feedthrough term. systune returns an error when fixing these tunable parameters is insufficient to enforce zero feedthrough. In such cases, you must modify the requirement or the control structure, or manually fix some tunable parameters of your system to values that eliminate the feedthrough term.

When the constrained transfer function has several tunable blocks in series, the software's approach of zeroing all parameters that contribute to the overall feedthrough might be conservative. In that case, it is sufficient to zero the feedthrough term of one of the blocks. If you want to control which block has feedthrough fixed to zero, you can manually fix the feedthrough of the tuned block of your choice.

To fix parameters of tunable blocks to specified values, use the Value and Free properties of the block parametrization. For example, consider a tuned state-space block:

C = ltiblock.ss('C',1,2,3);

To enforce zero feedthrough on this block, set its D matrix value to zero, and fix the parameter.

C.d.Value = 0;
C.d.Free = false;

For more information on fixing parameter values, see the Control Design Block reference pages, such as ltiblock.ss.

## Algorithms

When you tune a control system using a TuningGoal object to specify a tuning requirement, the software converts the requirement into a normalized scalar value f(x). 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 requirement is a hard constraint.

For the TuningGoal.WeightedVariance requirement, f(x) is given by:

$f\left(x\right)={‖{W}_{L}T\left(s,x\right){W}_{R}‖}_{2}.$

T(s,x) is the closed-loop transfer function from Input to Output. ${‖\text{\hspace{0.17em}}\cdot \text{\hspace{0.17em}}‖}_{2}$ denotes the H2 norm (see norm).

For tuning discrete-time control systems, f(x) is given by:

$f\left(x\right)=\frac{1}{\sqrt{{T}_{s}}}{‖{W}_{L}\left(z\right)T\left(z,x\right){W}_{R}\left(z\right)‖}_{2}.$

Ts is the sampling time of the discrete-time transfer function T(z,x).

## Examples

expand all

### Weighted Constraint on H2 Norm

Create a constraint for a transfer function with one input, r, and two outputs, e and y, that limits the norm as follows:

is the closed-loop transfer function from r to e, and is the closed-loop transfer function from r to y.

s = tf('s');
WL = blkdiag(1/(s+0.001),s/(0.001*s+1));
Req = TuningGoal.WeightedVariance('r',{'e','y'},WL,[]);