# CREATE CONSTRAINTS

Computes the matrices defining equality and inequality constraints for the pwas approximation of a control function.

## Contents

Function of MOBY-DIC TOOLBOX.

## Description

MPC control is generally required to satisfy constraints on system inputs and states. When a pwas approximation of a MPC control function is performed, such constraints must be enforced also on the approximated function. To do this the constraints must be enforced on the weights of the basis function expansion of the pwas object. This function, given state and input constraints as a constraints object, computes matrices A and B which impose the same constraints on the weights of the pwas function, with a dipendence of a possible slack variable sigma, in the form:

The procedure to perform this operation is described below.

For constraints involving only inputs, in the form:

u is written as weighted sum of basis functions:

or in vector form:

Since u is pwas it is sufficient to impose these constraints only on the vertices of the simplicial partition, to guarentee that they are satisfied everywhere. By substituting (3) computed in the vertices of the simplicial partition in (2), it is easy to obtain:

State constraints or mixed input-state constraints in the form:

are evaluated, as for constraints (2) in the vertices of the simplicial partition (only in the ones inside the feasibility domain of the pwag function). Since these constraints could not be imposed everywhere (also in the MPC formulation they can be softened), a slack variable is introduced to soften them. By substituting (3) computed on all vertices in (5), and by adding a slack variable it is easy to write (5) as:

For state constraints or mixed input-state constraints in the form:

u is the control function at the current instant (the only one we want to approximate) and u_next contains all the optimal predicted control moves at subsequent time instants. These constraints must be enforced on the vertices of the simplicial partition, of the irregular partition and of the mixed partition which are contained in the feasibility domain of the control function. Due to a different structure of the partition between pwag and pwas functions, these constraints must be softened by means of a slack variable sigma (see also function L2Approx). By substituting (3) computed on all vertices in (7), and by adding a slack variable it is easy to write (7) as:

By combining (4) with (6) and (8) it is possible to obtain constraints (1).

Matrices Aeq and Beq enforcing equality constraints in the form

can also be computed, if requested. These constraints can enforce either that pwas function is equal to optimal function in a region around the reference state, or that pwas function is zero in the reference state. These constraints can help achieving stability for regulation problems.

## Syntax

**[A,B,Aeq,Beq,d_w,d_sigma,VsTot,V,uV] = createConstraints(Upwas,U, linSys, constr, options)**

Upwas is a pwas object defining just the pwas function space (i.e. domain, partion) and type of basis function.

U is a pwag object defining the optimal control function.

linSys is a linearSystem object defining the system which is controlled by pwag controller U.

constr is a constraints object defining the constraints you want the pwas approximated controller to satisfy.

options is a structure with following fields:

- tau: weight for the slack variable sigma. The slack variables are necessary because some of the constraints (tipically the state constraints) could not be satisfied by the pwas approximated function, due to the different partition structure. If tau < 0 only one slack variable is used to soften all constraints else a variable for each vertex is used.

- equality: if equality is set to 1, local optimality constraints (8) are considered. If it is set to 2, the approximated control is constrained to be 0 in the origin. TO BE CHECKED!

- xref: reference state. The MPC control function is designed to bring the system state to xref

A and B are the matrices defining the inequality constraints (1).

Aeq and Beq are the matrices defining the equality constraints (9).

d_w is the number of weights w.

d_sigma is the number of slack variables.

VsTot is a matrix whose rows are all the vertices of the simplicial partition.

V is a matrix whose rows are the vertices of the simplicial, irregular and mixed partition inside the feasibility domain.

uV contains the value of the pwag function in vertices V.

## Acknowledgements

Contributors:

- Alberto Oliveri (alberto.oliveri@unige.it)
- Tomaso Poggi (tpoggi@essbilbao.org)

Copyright is with:

- Copyright (C) 2011 University of Genoa, Italy.