# TuningGoal.WeightedPassivity class

Package: TuningGoal

Frequency-weighted passivity constraint

## Description

A system is passive if all its I/O trajectories (u(t),y(t)) satisfy:

`${\int }_{0}^{T}y{\left(t\right)}^{T}u\left(t\right)dt>0,$`

for all T > 0. `TuningGoal.WeightedPassivity` enforces the passivity of the transfer function:

`$H\left(s\right)={W}_{L}\left(s\right)T\left(s\right){W}_{R}\left(s\right),$`

where Ts is a closed-loop response in the control system being tuned. WL and WR are weighting functions used to emphasize particular frequency bands. Use `TuningGoal.WeightedPassivity` with control system tuning commands such as `systune`.

## Construction

`Req = TuningGoal.WeightedPassivity(inputname,outputname,WL,WR)` creates a tuning goal for enforcing passivity of the transfer function:

`$H\left(s\right)={W}_{L}\left(s\right)T\left(s\right){W}_{R}\left(s\right),$`

where Ts is the closed-loop transfer function from the specified inputs to the specified outputs. The weights `WL` and `WR` can be matrices or LTI models.

By default, the tuning goal enforces passivity of the weighted transfer function H. You can also enforce input and output passivity indices, with a specified excess or shortage of passivity. (See `getPassiveIndex` for more information about passivity indices.) To do so, set the `IPX` and `OPX` properties of the tuning goal. See Weighted Passivity and Input Passivity.

### 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. `WL,WR` Input and output weighting functions, specified as scalars, matrices, or SISO or MIMO numeric LTI models. The functions `WL` and `WR` provide the weights for the tuning goal. The tuning goal ensures passivity of the weighted transfer function: `$H\left(s\right)={W}_{L}\left(s\right)T\left(s\right){W}_{R}\left(s\right),$` where T(s) is the transfer function from `inputname` to `outputname`. The function `WL` provides the weighting for the output channels of T(s), and `WR` provides the weighting for the input channels. You can specify: Scalar weighting — use a scalar or numeric matrix.Frequency-dependent weighting — use a SISO or MIMO numeric LTI model. For example:```WL = tf(1,[1 0.01]); WR = 10;``` If `WL` or `WR` is a matrix or a MIMO model, then `inputname` and `outputname` must be vector signals. The dimensions of the vector signals must be such that the dimensions of T(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 and SISO LTI models, however, automatically expand to any input or output dimension. If you are tuning in discrete time (that is, using a `genss` model or `slTuner` interface with nonzero `Ts`), you can specify the weighting functions as discrete-time models with the same `Ts`. If you specify the weighting functions in continuous time, the tuning software discretizes them. Specifying the weighting functions in discrete time gives you more control over the weighting functions near the Nyquist frequency. A value of `WL = []` or `WR = []` is interpreted as the identity. Default: `[]`

## Properties

 `WL` Frequency-weighting function for the output channels of the transfer function to constrain, specified as a scalar, a matrix, or a SISO or MIMO numeric LTI model. The initial value of this property is set by the `WL` input argument when you construct the tuning goal. `WR` Frequency-weighting function for the input channels of the transfer function to constrain, specified as a scalar, a matrix, or a SISO or MIMO numeric LTI model. The initial value of this property is set by the `WR` input argument when you construct the tuning goal. `IPX` Target passivity at the inputs listed in `inputname`, specified as a scalar value. The input passivity index is defined as the largest value of ν for which the trajectories {u(t),y(t)} of the weighted transfer function H satisfy: `${\int }_{0}^{T}y{\left(t\right)}^{T}u\left(t\right)dt>\nu {\int }_{0}^{T}u{\left(t\right)}^{T}u\left(t\right)dt,$` for all T > 0. By default, the tuning goal enforces strict passivity of the weighted transfer function. To enforce an input passivity index with a specified excess or shortage of passivity, set the `IPX` property of the tuning goal. When you do so, the tuning software: Ensures that the weighted response is input strictly passive when `IPX` > 0. The magnitude of `IPX` sets the required excess of passivity.Allows the weighted response to be not input strictly passive when `IPX` < 0. The magnitude of `IPX` sets the permitted shortage of passivity. See Weighted Passivity and Input Passivity for an example. See `getPassiveIndex` for more information about passivity indices. Default: 0 `OPX` Target passivity at the outputs listed in `outputname`, specified as a scalar value. The output passivity index is defined as the largest value of ρ for which the trajectories {u(t),y(t)} of the weighted transfer function H satisfy: `${\int }_{0}^{T}y{\left(t\right)}^{T}u\left(t\right)dt>\rho {\int }_{0}^{T}y{\left(t\right)}^{T}y\left(t\right)dt,$` for all T > 0. By default, the tuning goal enforces strict passivity of the weighted transfer function. To enforce an output passivity index with a specified excess or shortage of passivity, set the `OPX` property of the tuning goal. When you do so, the tuning software: Ensures that the weighted response is output strictly passive when `OPX` > 0. The magnitude of `IPX` sets the required excess of passivity.Allows the weighted response to be not output strictly passive when `OPX` < 0. The magnitude of `IPX` sets the permitted shortage of passivity. See Weighted Passivity and Input Passivity for an example. See `getPassiveIndex` for more information about passivity indices. Default: 0 `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. `Input` Input signal names, specified as a cell array of character vectors. The input signal names specify the input locations for determining passivity, initially populated by the `inputname` argument. `Output` Output signal names, specified as a cell array of character vectors. The output signal names specify the output locations for determining passivity, initially 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

collapse all

Create a tuning goal that enforces the passivity of the transfer function:

`$H\left(s\right)=\left[\begin{array}{cc}1& 0\\ 0& 10\end{array}\right]T\left(s\right)\left(\frac{1}{s}\right),$`

where $T\left(s\right)$ is the transfer function from an input `'d'` to outputs `['y';'z']` in a control system model.

```WL = tf(1,[1 0]); WR = diag([1 10]); TG = TuningGoal.WeightedPassivity('d',{'y','z'},WL,WR);```

Use `TG` with `systune` to enforce that weighted passivity requirement.

Suppose that instead of enforcing overall passivity of the weighted transfer function H, you want to ensure that H is input strictly passive with an input feedforward passivity index of at least 0.1. To do so, set the `IPX` property of `TG`.

`TG.IPX = 0.1;`

## Tips

• Use `viewGoal` to visualize this tuning goal. For enforcing passivity with ```IPX = 0``` and `OPX = 0`, `viewGoal` plots the relative passivity indices as a function of frequency (see `passiveplot`). These are the singular values of $\left(I-H\left(j\omega \right)\right){\left(I-H\left(j\omega \right)\right)}^{-1}$. The weighted transfer function H is passive when the largest singular value is less than 1 at all frequencies.

For nonzero `IPX` or `OPX`, `viewGoal` plots the relative index as described in Algorithms.

• This tuning goal imposes an implicit minimum-phase constraint on the transfer function H + I, where H is the weighted closed-loop transfer function from `Input` to `Output`, evaluated with loops opened at the points identified in `Openings`. The transmission zeros of H + I 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.WeightedPassivity`, for a closed-loop transfer function `T(s,x)` from `inputname` to `outputname`, and the weighted transfer function `H(s,x) = WL*T(s,x)*WR`, f(x) is given by:

`$f\left(x\right)=\frac{R}{1+R/{R}_{\mathrm{max}}},\text{ }{R}_{\mathrm{max}}={10}^{6}.$`

R is the relative sector index (see `getSectorIndex`) of `[H(s,x);I]`, for the sector represented by:

`$Q=\left(\begin{array}{cc}2\rho & -I\\ -I& 2\nu \end{array}\right),$`

using the values of the `OPX` and `IPX` properties for ρ and ν, respectively. Rmax is fixed at 106, included to avoid numerical errors for very large R.

## Version History

Introduced in R2016a