Main Content

Barrier Certificate Enforcement

Modify control actions to satisfy barrier certificate constraints and action bounds

  • Library:
  • Simulink Control Design

  • Barrier Certificate Enforcement block

Description

The Barrier Certificate Enforcement block computes the modified control actions that are closest to specified control actions subject to barrier certificate constraints and action bounds.

The block uses a quadratic programming (QP) solver to find the control action u that minimizes the function |uu0|2. Here, u0 is the unmodified control action.

The solver applies the following constraints to the optimization problem.

qxfx+qxgxu+γhxβ0uminuumax

Here:

  • fx and gx are functions defined by the plant dynamics x˙=f(x)+g(x)u.

  • hx is the control barrier function.

  • qx is the partial derivative of the control barrier function over states x.

  • γ is the constraint factor.

  • β is the constraint power.

  • umin is a lower bound for the control action.

  • umax is an upper bound for the control action.

The Barrier Certificate Enforcement block requires Optimization Toolbox™ software.

For more information on barrier certificate enforcement, see Barrier Certificate 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.

State function f(x) in the following plant dynamics equation.

x˙=f(x)+g(x)u

Connect fx to an Nx-by-1 signal, where Nx is equal to the Number of states parameter.

Input function g(x) in the following plant dynamics equation.

x˙=f(x)+g(x)u

Connect gx to an Nx-by-Nu signal, where Nx is equal to the Number of states parameter and Nu is equal to the Number of actions parameter.

Control barrier function, defined as the following safety set for plant states.

{x:h(x)0}

Connect hx to an Nc-by-1 signal, where Nc is equal to the Number of barrier certificates parameter.

Partial derivative of the control barrier function over plant states.

q(x)=hx

Connect qx to an Nc-by-Nx signal, where Nc is equal to the Number of barrier certificates parameter and Nx is equal to the Number of states 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
1The solver converged to an optimal solution with all constraints and bounds active. In this case, u* outputs the optimal control actions.
0The solver reached the maximum number of iterations. The control actions output in u* might be suboptimal.
negative integer

The initial optimization problem was infeasible and one of the following scenarios applies.

  • Rerunning the optimization without action bounds did not produce a feasible solution.

  • Rerunning the optimization without constraint bounds did not produce a feasible solution.

In this case, the control actions output in u* are zero.

Dependencies

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

Parameters

expand all

Parameters Tab

Specify the number of states in your plant.

Programmatic Use

Block Parameter: nx
Type: character vector
Default: '1'

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

Programmatic Use

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

Specify the number of barrier certificate constraints to enforce.

Programmatic Use

Block Parameter: nc
Type: character vector
Default: '1'

Specify the constraint factor γ in the barrier certificate constraint.

If the Number of barrier certificates parameter is 1, specify Constraint factor as a finite positive scalar. Otherwise, you can specify Constraint factor as either a finite positive scalar value or a column vector of positive scalars with length equal to Number of barrier certificates.

Programmatic Use

Block Parameter: gamma
Type: character vector
Default: '10'

Specify the constraint power β in the barrier certificate constraint.

If the Number of barrier certificates parameter is 1, specify Constraint power as a positive odd integer. Otherwise, you can specify Constraint power as either a positive odd integer or a column vector of positive odd integers with length equal to Number of barrier certificates.

Programmatic Use

Block Parameter: beta
Type: character vector
Default: '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'

Extended Capabilities

Version History

Introduced in R2022a