# TuningGoal.Tracking class

Package: TuningGoal

Tracking requirement for control system tuning

## Description

Use `TuningGoal.Tracking` to specify a frequency-domain tracking requirement between specified inputs and outputs. This tuning goal specifies the maximum relative error (gain from reference input to tracking error) as a function of frequency. Use this tuning goal for control system tuning with tuning commands such as `systune` or `looptune`.

You can specify the maximum error profile directly by providing a transfer function. Alternatively, you can specify a target DC error, peak error, and response time. These parameters are converted to the following transfer function that describes the maximum frequency-domain tracking error:

`$\text{MaxError}=\frac{\left(\text{PeakError}\right)s+{\omega }_{c}\left(\text{DCError}\right)}{s+{\omega }_{c}}.$`

Here, ωc is 2/(response time). The following plot illustrates these relationships for an example set of values.

## Construction

```Req = TuningGoal.Tracking(inputname,outputname,responsetime,dcerror,peakerror)``` creates a tuning goal `Req` that constrains the tracking performance from `inputname` to `outputname` in the frequency domain. This tuning goal specifies a maximum error profile as a function of frequency given by:

`$\text{MaxError}=\frac{\left(\text{PeakError}\right)s+{\omega }_{c}\left(\text{DCError}\right)}{s+{\omega }_{c}}.$`

The tracking bandwidth ωc = 2/`responsetime`. The maximum relative steady-state error is given by `dcerror`, and `peakerror` gives the peak relative error across all frequencies.

You can specify a MIMO tracking requirement by specifying signal names or a cell array of multiple signal names for `inputname` or `outputname`. For MIMO tracking requirements, use the `InputScaling` property to help limit cross-coupling. See Properties.

`Req = TuningGoal.Tracking(inputname,outputname,maxerror)` specifies the maximum relative error as a function of frequency. You can specify the target error profile (maximum gain from reference signal to tracking error signal) 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. `responsetime` Target response time, specified as a positive scalar value. The tracking bandwidth is given by ωc = 2/`responsetime`.Express the target response time in the time units of the models to be tuned. For example, when tuning a model `T`, if `T.TimeUnit` is `'minutes'`, then express the target response time in minutes. `dcerror` Maximum steady-state fractional tracking error, specified as a positive scalar value. For example, `dcerror` = 0.01 sets a maximum steady-state error of 1%. If `inputname` or `outputname` are vector-valued, `dcerror` applies to all I/O pairs from `inputname` to `outputname`. Default: 0.001 `peakerror` Maximum fractional tracking error across all frequencies, specified as a positive scalar value greater than 1. Default: 1 `maxerror` Target tracking error profile as a function of frequency, specified as a SISO numeric LTI model. `maxerror` is the maximum gain from reference signal to tracking error signal. You can specify `maxerror` as a smooth transfer function (`tf`, `zpk`, or `ss` model). Alternatively, you can sketch a piecewise error profile using an `frd` model. When you do so, the software automatically maps the error profile to a `zpk` model. The magnitude of the `zpk` model approximates the desired error profile. Use `show(Req)` to plot the magnitude of the `zpk` model. `maxerror` must be a SISO LTI model. If `inputname` or `outputname` are cell arrays, `maxerror` 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 `maxerror` as a discrete-time model with the same `Ts`. If you specify `maxerror` in continuous time, the tuning software discretizes it. Specifying the error profile in discrete time gives you more control over the error profile near the Nyquist frequency.

## Properties

 `MaxError` Maximum error as a function of frequency, expressed as a SISO `zpk` model. This property stores the maximum tracking error as a function of frequency (maximum gain from reference signal to tracking error signal). If you use the syntax `Req = TuningGoal.Tracking(inputname,outputname,maxerror)`, then the `MaxError` property is the `zpk` equivalent or approximation of the LTI model you supplied as the `maxerror` input argument. If you use the syntax `Req = TuningGoal.Tracking(inputname,outputname,resptime,dcerror,peakerror)`, then the `MaxError` is a `zpk` transfer function given by: `$\text{MaxError}=\frac{\left(\text{PeakError}\right)s+{\omega }_{c}\left(\text{DCError}\right)}{s+{\omega }_{c}}.$` `MaxError` is a SISO LTI model. If `inputname` or `outputname` are cell arrays, `MaxError` applies to all I/O pairs from `inputname` to `outputname`. Use `show(Req)` to plot the magnitude of `MaxError`. `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. `InputScaling` Reference signal scaling, specified as a vector of positive real values. For a MIMO tracking requirement, when the choice of units results in a mix of small and large signals in different channels of the response, use this property to specify the relative amplitude of each entry in the vector-valued step input. This information is used to scale the off-diagonal terms in the transfer function from reference to tracking error. This scaling ensures that cross-couplings are measured relative to the amplitude of each reference signal. For example, suppose that `Req` is a tuning goal that signals `{'y1','y2'}` track reference signals `{'r1','r2'}`. Suppose further that you require the outputs to track the references with less than 10% cross-coupling. If `r1` and `r2` have comparable amplitudes, then it is sufficient to keep the gains from `r1` to `y2` and `r2` and `y1` below 0.1. However, if `r1` is 100 times larger than `r2`, the gain from `r1` to `y2` must be less than 0.001 to ensure that `r1` changes `y2` by less than 10% of the `r2` target. To ensure this result, set the `InputScaling` property as follows. `Req.InputScaling = [100,1];` This tells the software to take into account that the first reference signal is 100 times greater than the second reference signal. The default value, `[]` , means no scaling. Default: `[]` `Input` Reference signal names, specified as a character vector or cell array of character vectors specifying the names of the signals to be tracked, populated by the `inputname` argument. `Output` Output signal names, specified as a character vector or cell array of character vectors specifying the names of the signals that must track the reference signals, populated by the `outputname` argument. `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

### Tracking Goal With Response Time and Maximum Steady-State Tracking Error

Create a tracking goal specifying that a signal `'theta'` track a signal `'theta_ref'`. The required response time is 2, in the time units of the control system you are tuning. The maximum steady-state error is 0.1%.

` Req = TuningGoal.Tracking('theta_ref','theta',2,0.001);`

Since `peakerror` is unspecified, this tuning goal uses the default value, 1.

### Tracking Goal With Maximum Tracking Error as a Function of Frequency

Create a tracking goal specifying that a signal `'theta'` track a signal `'theta_ref'`. The maximum relative error is 0.01 (1%) in the frequency range [0,1]. The relative error increases to 1 (100%) at the frequency 100.

Use an `frd` model to specify the error profile as a function of frequency.

```err = frd([0.01 0.01 1],[0 1 100]); Req = TuningGoal.Tracking('theta_ref','theta',err);```

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

`viewGoal(Req)`

The dashed line is the target error profile stored in `MaxError`, and the shaded region indicates where the tuning goal 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`, 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.Tracking`, f(x) is given by:

`$f\left(x\right)={‖{W}_{F}\left(s\right)\left(T\left(s,x\right)-I\right)‖}_{\infty },$`

or its discrete-time equivalent. Here, T(s,x) is the closed-loop transfer function from `Input` to `Output`, and ${‖\text{\hspace{0.17em}}\cdot \text{\hspace{0.17em}}‖}_{\infty }$ denotes the H norm (see `getPeakGain`). WF is a frequency weighting function derived from the error profile you specify in the tuning goal. The gains of WF and `1/MaxError` roughly match for gain values between –20 dB and 60 dB. For numerical reasons, the weighting function levels off outside this range, unless you specify a reference model that changes slope outside this range. This adjustment is called regularization. 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 error 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.

## Version History

Introduced in R2016a

expand all

Behavior changed in R2016a