## Barrier Certificate Enforcement for Control Design

In optimization-based control, a *barrier certificate* defines a
safety set of the desired states of a system. A *control barrier
function* is used to find a control law such that the states remain in the safety
set.

### Barrier Certificate Enforcement Block

The Barrier Certificate
Enforcement block, which requires Optimization Toolbox™ software, 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 $${\left|u-{u}_{0}\right|}^{2}$$ in real time. Here, *u*_{0} is the
unmodified control action from the controller.

The solver applies the following constraints to the optimization problem.

$$\begin{array}{l}{q}_{x}{f}_{x}+{q}_{x}{g}_{x}u+\gamma {h}_{x}^{\beta}\ge 0\\ {u}_{\mathrm{min}}\le u\le {u}_{\mathrm{max}}\end{array}$$

Here:

*f*and_{x}*g*are functions defined by the plant dynamics $$\dot{x}=f(x)+g(x)u$$._{x}*h*is the control barrier function._{x}*q*is the partial derivative of the control barrier function over states_{x}*x*.*γ*is the constraint factor.*β*is the constraint power.*u*_{min}is a lower bound for the control action.*u*_{max}is an upper bound for the control action.

Since the Barrier Certificate Enforcement block modifies the original control action, the final closed-loop system might not achieve the design objectives of the original controller, such as stability margins.

You must verify that the combined controller and Barrier Certificate Enforcement block meet your original control objectives. If the system does not meet your original objectives, consider updating your original controller design. For example, you can add additional gain and phase margins to compensate for any potential performance degradation.

### Control Barrier Function

Consider plant dynamics of the following form.

$$\dot{x}=f(x)+g(x)u$$

The control barrier function *h*(*x*) defines a safety
set $$\{x:h(x)\ge 0\}$$, that is, an invariant set where any trajectory starting inside the set
remains within the set.

For this invariant set, the constraint is described by:

$$\dot{h}(x,u)\ge -\alpha (h(x))$$

Therefore, you can define a constraint that depends on the control barrier function and the system dynamics as follows.

$$\frac{\partial h}{\partial x}f(x)+\frac{\partial h}{\partial x}g(x)u\ge -\alpha (h(x))$$

Here *α*(*h*(*x*)) is an extended class *Κ* function. Using the
Barrier Certificate Enforcement block, you can specify a function of the
following form.

$$\alpha (h(x))=\gamma {h}^{\beta}(x)$$

For an example that uses a simple control barrier function, see Enforce Barrier Certificate Constraints for PID Controllers.

For an example that defines a control barrier function to avoid collisions between three robots, see Enforce Barrier Certificate Constraints for Collision-Free Multi-Robot System. This example defines a barrier function such that the robots reach their target position while maintaining a distance greater than a threshold distance between any two robots.

## See Also

Barrier Certificate Enforcement