Main Content

generateExplicitMPC

Convert implicit MPC controller to explicit MPC controller

Description

Given a traditional Model Predictive Controller design in the implicit form, convert it to the explicit form for real-time applications requiring fast sample time.

empcobj = generateExplicitMPC(mpcobj,range) converts a traditional (implicit) MPC controller to the equivalent explicit MPC controller, using the specified parameter bounds. This calculation usually requires significant computational effort because a multi-parametric quadratic programming problem is solved during the conversion.

example

empcobj = generateExplicitMPC(mpcobj,range,opt) converts the MPC controller using additional optimization options.

example

Examples

collapse all

Generate an explicit MPC controller based upon a traditional MPC controller for a double-integrator plant.

Define the double-integrator plant.

plant = tf(1,[1 0 0]);

Create a traditional (implicit) MPC controller for this plant, with sample time 0.1, a prediction horizon of 10, and a control horizon of 3.

Ts = 0.1;
p = 10;
m = 3;
mpcobj = mpc(plant,Ts,p,m);
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.

To generate an explicit MPC controller, you must specify the ranges of parameters such as state values and manipulated variables. To do so, generate a range structure. Then, modify values within the structure to the desired parameter ranges.

range = generateExplicitRange(mpcobj);
-->Converting the "Model.Plant" property to state-space.
-->Converting model to discrete time.
   Assuming no disturbance added to measured output #1.
-->"Model.Noise" is empty. Assuming white noise on each measured output.
range.State.Min(:) = [-10;-10];
range.State.Max(:) = [10;10];
range.Reference.Min = -2;
range.Reference.Max = 2;
range.ManipulatedVariable.Min = -1.1;
range.ManipulatedVariable.Max = 1.1;

Use the more robust reduction method for the computation. Use generateExplicitOptions to create a default options set, and then modify the polyreduction option.

opt = generateExplicitOptions(mpcobj);
opt.polyreduction = 1;

Generate the explicit MPC controller.

empcobj = generateExplicitMPC(mpcobj,range,opt)
 
Explicit MPC Controller
---------------------------------------------
Controller sample time:    0.1 (seconds)
Polyhedral regions:        1
Number of parameters:      4
Is solution simplified:    No
State Estimation:          Default Kalman gain
---------------------------------------------
Type 'empcobj.MPC' for the original implicit MPC design.
Type 'empcobj.Range' for the valid range of parameters.
Type 'empcobj.OptimizationOptions' for the options used in multi-parametric QP computation.
Type 'empcobj.PiecewiseAffineSolution' for regions and gain in each solution.

Input Arguments

collapse all

Traditional MPC controller, specified as an mpc object

Parameter bounds, specified as a structure that you create with the generateExplicitRange command. This structure specifies the bounds on the parameters upon which the explicit MPC control law depends, such as state values, measured disturbances, and manipulated variables. For detailed descriptions of the range parameters, see generateExplicitRange.

Optimization options for the conversion computation, specified as a structure that you create with the generateExplicitOptions function. For detailed descriptions of these options, see generateExplicitOptions.

Output Arguments

collapse all

Explicit MPC controller that is equivalent to the input traditional controller, returned as an explicitMPC object.

PropertyDescription
MPCTraditional (implicit) controller object used to generate the explicit MPC controller. You create this MPC controller using is the mpc command. It is the first argument to generateExplicitMPC when you create the explicit MPC controller.
range1-D structure containing the parameter bounds used to generate the explicit MPC controller. These determine the resulting controller’s valid operating range. This property is automatically populated by the range input argument to generateExplicitMPC when you create the explicit MPC controller. See generateExplicitRange for details about this structure.
OptimizationOptions1-D structure containing user-modifiable options used to generate the explicit MPC controller. This property is automatically populated by the opt argument to generateExplicitMPC when you create the explicit MPC controller. See generateExplicitOptions for details about this structure.
PiecewiseAffineSolutionnr-dimensional structure, where nr is the number of piecewise affine (PWA) regions required to represent the control law. The ith element contains the details needed to compute the optimal manipulated variables when the solution lies within the ith region. See Implementation.
IsSimplifiedLogical switch indicating whether the explicit control law has been modified using the simplify command such that the explicit control law approximates the base (implicit) MPC controller. If the control law has not been modified, the explicit controller should reproduce the base controller’s behavior exactly, provided both operate within the bounds described by the range property.

Tips

  • Using Explicit MPC, you will most likely achieve best performance in small control problems, which involve small numbers of plant inputs/outputs/states as well as the number of constraints.

  • Test the implicit controller thoroughly before attempting a conversion. This helps to determine the range of controller states and other parameters needed to generate the explicit controller.

  • Simulate the explicit controller’s performance using the sim or mpcmoveExplicit commands, or the Explicit MPC Controller block in Simulink®.

  • generateExplicitMPC displays progress messages in the command window. Use mpcverbosity to turn off the display.

Version History

Introduced in R2014b