## Explicit MPC

A traditional model predictive controller solves a quadratic program (QP) at each control
interval to determine the optimal manipulated variable (MV)
adjustments.
These adjustments are the solution of the implicit nonlinear function
*u*=*f*(*x*).

The vector *x* contains the current controller state and other
independent variables affecting the QP solution, such as the current output reference values.
The Model Predictive Control Toolbox™ software imposes restrictions that force a unique QP
solution.

Finding the optimal MV adjustments can be time consuming, and the required time can vary significantly from one control interval to the next. In applications that require a solution within a certain consistent time, which could be on the order of microseconds, the implicit MPC approach can be unsuitable.

As shown in Optimization Problem, if no QP inequality constraints
are active for a given *x* vector, then the optimal MV adjustments become a
time invariant affine
function of
*x*:

$$u=Fx+G.$$

where, *F* and *G* are constants. Similarly, if
*x* remains in a region where a fixed subset of inequality constraints is
active, the QP solution is also an affine function of *x*, but with different
*F* and *G* constants.

Explicit MPC uses offline computations to determine all polyhedral regions where the
optimal MV adjustments are affine functions of *x*, and the corresponding
control-law constants. When the controller operates in real time, the explicit MPC controller
performs the following steps at each control instant,
*k*:

Estimate the controller state using available measurements, as in traditional MPC.

Form

*x*(*k*) using the estimated state and the current values of the other independent variables.Identify the region in which

*x*(*k*) resides.Looks up the predetermined

*F*and*G*constants for this region.Evaluate the linear function

*u*(*k*) =*Fx*(*k*) +*G*.

You can establish a tight upper bound for the time required in each step. If the number of
regions is not too large, the total computational time can be small. However, as the number of
regions increases, the time required in step 3 dominates, and the memory required to store all
the linear control laws and polyhedral regions becomes excessive. The number of regions
characterizing *u* = *f*(*x*) depends
primarily on the number of QP inequality constraints that could be active at the solution. If
an explicit MPC controller has many constraints, and thus requires significant computational
effort or memory, a traditional implicit implementation may be preferable.

## See Also

### Functions

`generateExplicitMPC`

|`generateExplicitRange`

|`generateExplicitOptions`

|`simplify`

|`generatePlotParameters`

|`plotSection`

|`mpcmoveExplicit`

|`sim`

### Objects

`mpc`

|`explicitMPC`

|`mpcstate`

### Blocks

## Related Examples

- Explicit MPC Control of a Single-Input-Single-Output Plant
- Explicit MPC Control of Aircraft with Unstable Poles
- Explicit MPC Control of DC Servomotor with Constraint on Unmeasured Output