Main Content

Design Workflow for Explicit MPC

To create an explicit MPC controller, you must first design a traditional (implicit) MPC controller. You then generate an explicit MPC controller based on the traditional controller design.

Traditional (Implicit) MPC Design

First design a traditional (implicit) MPC for your application and test it in simulations. Key considerations are as follows:

  • The explicit MPC control law generated by the Model Predictive Control Toolbox™ software is such that the manipulated variable vector is piecewise function of the following variables:

    • nxc controller state variables (plant, disturbance, and measurement noise model states).

    • ny (≥ 1) output reference values, where ny is the number of plant output variables.

    • nv (≥ 0) measured plant disturbance signals.

    Thus, you must fix all the other MPC design parameters to specific values before creating an explicit MPC controller. Fixed parameters include prediction models (plant, disturbance and measurement noise), scale factors, horizons, penalty weights, manipulated variable targets, and constraint bounds.

    For information about designing a traditional MPC controller, see Controller Creation.

    For information about tuning traditional MPC controllers, see Refinement.

  • Reference and measured disturbance previewing are not supported for explicit MPC. At each control interval, the current ny reference and nv measured disturbance signals apply for the entire prediction horizon.

  • To limit the number of regions needed by explicit MPC, include only essential constraints.

    • When including a constraint on a manipulated variable (MV), use a short control horizon or MV blocking. See Choose Sample Time and Horizons, and Manipulated Variable Blocking.

    • Avoid constraints on plant outputs. If such a constraint is essential, consider imposing it for selected prediction horizon steps rather than the entire prediction horizon.

  • Establish upper and lower bounds for each of the nx = nxc + ny + nv independent variables. You might know some of these bounds a priori. However, you must run simulations that record at least the nxc controller states as the system operates over the range of expected conditions. It is important that you do not underestimate this range, because the explicit MPC control function is not defined for independent variables outside the range.

    For information about specifying bounds, see generateExplicitRange.

    For information about simulating a traditional MPC controller, see Simulation.

Explicit MPC Generation

Given the constant MPC design parameters and the nx upper and lower bounds on the independent variables of the control law, that is,


the generateExplicitMPC command determines nr regions. Each of these regions is defined by an inequality constraint and the corresponding control law constants:

Hix(k)Ki, i=1tonru(k)=Fix(k)+Gi,  i=1tonr

The explicitMPC object contains the constants Hi, Ki, Fi, and Gi for each region. The Explicit MPC Controller object also holds the original (implicit) design and independent variable bounds. As long as x(k) stays within the specified bounds and you retain all nr regions, the explicit MPC object provides the same optimal MV adjustments, u(k), as the equivalent implicit MPC object.

For details about explicit MPC, see [1]. For details about how the explicit MPC controller is generated, see [2].

Explicit MPC Simplification

Even a relatively simple explicit MPC controller might require many regions (nr >> 100) to characterize the QP solution completely. If the number of regions is large, consider the following:

  • Visualize the solution using the plotSection command.

  • Use the simplify command to reduce the number of regions. Sometimes, this reduction can be done with no (or negligible) impact on control law optimality. For example, pairs of adjacent regions might employ essentially the same Fi and Ki constants. If so, and if the union of the two regions forms a convex set, they can be merged into a single region.

    Alternatively, you can eliminate relatively small regions or retain selected regions only. During operation, as long as x(k) stays within the specified bounds, if the current x(k) is not contained in any of the retained regions, the explicit MPC returns a suboptimal u(k), as follows:


    Here, j is the index of the region whose bounding constraint, Hjx(k) ≤ Kj, is least violated. See the following section for more details.


During operation, for a given x(k), the explicit MPC controller performs the following steps:

  1. Verifies that x(k) satisfies the specified bounds, xl ≤ x(k) ≤ xu. If not, the controller returns an error status and sets u(k) = u(k–1).

  2. Beginning with region i = 1, tests the regions one by one to determine whether x(k) belongs. If Hix(k) ≤ Ki, then x(k) belongs to region i. If x(k) belongs to region i, then the controller:

    • Obtains Fi and Gi from memory, and computes u(k) = Fix(k) + Gi.

    • Signals successful completion, by returning a status code and the index i.

    • Returns without testing the remaining regions.

    If x(k) does not belong to region i, the controller:

    • Computes the violation term vi, which is the largest (positive) component of the vector (Hix(k) – Ki).

    • If vi is the minimum violation for this x(k), the controller sets j = i, and sets vmin = vi.

    • The controller then increments i and tests the next region.

  3. If all regions have been tested and x(k) does not belong to any region (for example, due to a numerical precision issue), the controller:

    • Obtains Fj and Gj from memory, and computes u(k) = Fjx(k) + Gj.

    • Sets status to indicate a suboptimal solution and returns.

Thus, the maximum computational time per control interval is the time required to test each region, computing the violation term in each case and then calculating the suboptimal control adjustment.


You can perform command-line simulations using the sim or mpcmoveExplicit commands.

You can use the Explicit MPC Controller block to connect an explicit MPC to a plant modeled in Simulink®.


[1] A. Bemporad, M. Morari, V. Dua, and E.N. Pistikopoulos, "The explicit linear quadratic regulator for constrained systems," Automatica, vol. 38, no. 1, pp. 3–20, 2002.

[2] A. Bemporad, "A multi-parametric quadratic programming algorithm with polyhedral computations based on nonnegative least squares," 2014, Submitted for publication.

See Also

| |

Related Topics