Accelerating the pace of engineering and science

# TuningGoal.Sensitivity class

Package: TuningGoal

Sensitivity requirement for control system tuning

## Description

Use the TuningGoal.Sensitivity object to limit the sensitivity of a feedback loop to disturbances. Constrain the sensitivity to be smaller than one at frequencies where you need good disturbance rejection. Use this requirement for control system tuning with tuning commands such as systune or looptune.

## Construction

Req = TuningGoal.Sensitivity(location,maxsens) creates a tuning requirement for limiting the sensitivity to disturbances entering a feedback loop at the specified location. maxsens specifies the maximum sensitivity as a function of frequency. You can specify the maximum sensitivity profile as a smooth transfer function or sketch a piecewise error profile using an frd model or the makeweight command.

### Input Arguments

 location Location at which the sensitivity to disturbances is constrained, specified as a string or cell array of strings 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. 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 = ltiblock.pid('C','pi'); T = feedback(G*AP*C,1); ```You can use the string '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. If location is a cell array, then the sensitivity requirement applies to the MIMO loop. maxsens Maximum sensitivity to disturbances as a function of frequency. You can specify maxsens as a smooth SISO transfer function (tf, zpk, or ss model). Alternatively, you can sketch a piecewise gain profile using a frd model or the makeweight command. For example, the following frd model specifies a maximum sensitivity of 0.01 (–40 dB) at 1 rad/s, increasing to 1 (0 dB) past 50 rad/s. ```maxsens = frd([0.01 1 1],[1 50 100]); bodemag(maxsens) ylim([-45,5])``` When you use an frd model to specify maxsens, the software automatically maps your specified gain profile to a zpk model whose magnitude approximates the desired gain profile. Use viewSpec(Req) to plot the magnitude of that zpk model.

## Properties

 MaxSensitivity Maximum sensitivity as a function of frequency, specified as a SISO zpk model. The software automatically maps the input argument maxsens onto a zpk model. The magnitude of this zpk model approximates the desired gain profile. Use viewSpec(Req) to plot the magnitude of the zpk model MaxSensitivity. Focus Frequency band in which tuning requirement is enforced, specified as a row vector of the form [min,max]. Set the Focus property to limit enforcement of the requirement 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 requirement that you want to apply only between 1 and 100 rad/s. To restrict the requirement 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 sampling time. LoopScaling Toggle for automatically scaling loop signals, specified as 'on' or 'off'. In multi-loop or MIMO control systems, the feedback channels are automatically rescaled to equalize the off-diagonal terms in the open-loop transfer function (loop interaction terms). Set LoopScaling to 'off' to disable such scaling and shape the unscaled sensitivity function. Default: 'on' Location Location of disturbance, specified as a string or cell array of strings that identify analysis-point locations marked in the model. The initial value of the Location property is set by the location 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: []

## 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), 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 requirement is a hard constraint.

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

$f\left(x\right)={‖\frac{1}{\text{MaxSensitivity}}S\left(s,x\right)‖}_{\infty }.$

S(s,x) is the sensitivity function of the control system at location.

## Examples

### Disturbance Sensitivity at Plant Input

Create a requirement that limits the sensitivity to disturbance at the plant input of the following control system. The control system contains an AnalysisPoint block at the plant input named 'X'.

Specify a maximum sensitivity of 0.01 (–40 dB) at 1 rad/s, increasing to 1 (0 dB) past 10 rad/s. Use an frd model to sketch this target sensitivity.

```maxsens = frd([0.01 1 1],[1 10 100]);
Req = TuningGoal.Sensitivity('X',maxsens);
```

The software converts maxsens into a smooth function of frequency that approximates the piecewise-specified requirement. Display the requirement using viewSpec.

```viewSpec(Req)
```

The yellow region indicates where the requirement is violated.

You can use Req as an input to looptune or systune when tuning the control system.

### Requirement with Limited Frequency Range and Model Application

Create a requirement that specifies a maximum sensitivity of 0.1 (10%) at frequencies below 5 rad/s. Configure the requirement to apply only to the second and third plant models.

```Req = TuningGoal.Sensitivity('u',0.1);
Req.Focus = [0 5];
Req.Models = [2 3];```

You can use Req as an input to looptune or systune when tuning a control system that has an analysis point called 'u'. Setting the Focus property limits the application of the requirement to frequencies between 0 and 5 rad/s. Setting the Models property restricts application of the requirement to the second and third models in an array, when you use the requirement to tune an array of control system models.