# Passivity Enforcement

Modify control actions to satisfy passivity constraints and action bounds

Since R2023a

Libraries:
Simulink Control Design / Constraint Control

## Description

The Passivity Enforcement block computes the modified control actions that are closest to specified control actions subject to passivity constraints and action bounds.

The block uses a quadratic programming (QP) solver to find the control action u that minimizes the function ${|u-{u}_{0}|}^{2}$ in real time. Here, u0 is the unmodified control action from the controller.

The solver applies the following constraints to the optimization problem.

`$\begin{array}{l}\rho {y}_{p}{}^{T}{y}_{p}+{y}_{p}{}^{T}{f}_{p}+{y}_{p}{}^{T}{g}_{p}u\le 0\\ {u}_{\mathrm{min}}\le u\le {u}_{\mathrm{max}}\end{array}$`

Here:

• ρ is the passivity index.

• yp is the passivity output function, defined as ${y}_{p}={h}_{p}\left(x\right)$.

• fp and gp are the functions defined by the passivity input function ${u}_{p}={f}_{p}\left(x\right)+{g}_{p}\left(x\right)u$.

• umin is a lower bound for the control action.

• umax is an upper bound for the control action.

For more information on passivity enforcement, see Passivity Enforcement for Control Design.

## Ports

### Input

expand all

Unmodified control actions, specified as a scalar or a vector.

If the Number of actions parameter is `1`, connect u0 to a scalar signal. Otherwise, connect u0 to a vector signal with length equal to Number of actions.

Offset coefficient fp in the following constraint equation.

`${u}_{p}={f}_{p}\left(x\right)+{g}_{p}\left(x\right)u$`

Connect fp to an Nu-by-1 signal, where Nu is equal to the Number of actions parameter.

Linear coefficient gp in the following constraint equation.

`${u}_{p}={f}_{p}\left(x\right)+{g}_{p}\left(x\right)u$`

Connect gp to an Nu-by-Nu signal, where Nu is equal to the Number of actions parameter.

Passivity output function, defined as the following function of plant states.

`${y}_{p}={h}_{p}\left(x\right)$`

Connect yp to an Nu-by-1 signal, where Nu is equal to the Number of actions parameter.

To specify run-time upper bounds to the action signals, enable this input port. If this port is disabled, the block does not apply any upper bounds to the control actions.

If the Number of actions parameter is `1`, connect umax to a scalar signal. Otherwise, connect umax to a vector signal with length equal to Number of actions.

#### Dependencies

To enable this input port, select the Use external source for upper bound parameter.

To specify run-time lower bounds to the action signals, enable this input port. If this port is disabled, the block does not apply any lower bounds to the control actions.

If the Number of actions parameter is `1`, connect umin to a scalar signal. Otherwise, connect umin to a vector signal with length equal to Number of actions.

#### Dependencies

To enable this input port, select the Use external source for lower bound parameter.

### Output

expand all

Modified control action returned by the QP solver.

If the solver finds a solution before reaching the maximum number of iterations, u* outputs this optimal solution.

If the solver reaches the maximum number of iterations, optimization stops and u* outputs a suboptimal solution.

If the initial optimization problem is infeasible, the returned control action depends on the whether the block is configured to ignore constraint or action bounds. For more information, see the exitflag parameter.

If the Number of actions parameter is `1`, u* outputs a scalar signal. Otherwise, u* outputs a vector signal with length equal to Number of actions.

Optimization status of the QP solver. The following table shows the possible status values.

Exit FlagDescription
`1`The solver converged to an optimal solution with all constraints and bounds active. In this case, u* outputs the optimal control actions.
`0`The solver reached the maximum number of iterations. The control actions output in u* might be suboptimal.
negative integer

The initial optimization problem was infeasible.

#### Dependencies

To enable this output port, select the Optimization status parameter.

## Parameters

expand all

Parameters Tab

Specify the number of actions to apply bounds to and optimize.

#### Programmatic Use

 Block Parameter: `nu` Type: character vector Default: `'1'`

Specify passivity index to enforce. Specify Passivity index as a nonnegative scalar or as a vector of nonnegative values with dimensions equal to Nu-by-1, where Nu is equal to the Number of actions parameter.

#### Programmatic Use

 Block Parameter: `rho` Type: character vector Default: `'0.1'`

Select this parameter to add the umax input port for external upper action bounds.

#### Programmatic Use

 Block Parameter: `external_umax` Type: character vector Values: `'off'`|`'on'` Default: `'off'`

Select this parameter to add the umin input port for external lower action bounds.

#### Programmatic Use

 Block Parameter: `external_umin` Type: character vector Values: `'off'`|`'on'` Default: `'off'`
Block Tab

Specify the sample time for running the optimization.

#### Programmatic Use

 Block Parameter: `Ts` Type: character vector Default: `'0.1'`

Specify the maximum number of optimization iterations.

#### Programmatic Use

 Block Parameter: `maxiter` Type: character vector Default: `'200'`

Specify a tolerance value for constraint violations.

#### Programmatic Use

 Block Parameter: `tol` Type: character vector Default: `'1e-6'`

Select this parameter to add the exitflag output port for the optimization status of the QP solver.

#### Programmatic Use

 Block Parameter: `exitflag` Type: character vector Values: `'off'`|`'on'` Default: `'off'`

## Version History

Introduced in R2023a

expand all