Main Content

generateExplicitOptions

Optimization options for explicit MPC generation

Description

example

opt = generateExplicitOptions(mpcobj) creates a set of options to use when converting a traditional MPC controller, mpcobj, to explicit form using generateExplicitMPC. The options set is returned with all options set to default values. Use dot notation to modify the options.

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 controller object. Use the mpc command to create a traditional MPC controller.

Output Arguments

collapse all

Options for generating explicit MPC controller, returned as a structure. When you create the structure, all the options are set to default values. Use dot notation to modify any options you want to change. The fields and their default values are as follows.

Zero-detection tolerance used by the NNLS solver, specified as a positive scalar value.

Redundant-inequality-constraint detection tolerance, specified as a positive scalar value.

Flat region detection tolerance, specified as a positive scalar value.

Constraint normalization tolerance, specified as a positive scalar value.

Maximum number of NNLS solver iterations, specified as a positive integer.

Maximum number of QP solver iterations, specified as a positive integer.

Maximum number of bisection method iterations used to detect region flatness, specified as a positive integer.

Method used to remove redundant inequalities, specified as either 1 (robust) or 2 (fast).

Version History

Introduced in R2014b