Optimization options for explicit MPC generation
creates
a set of options to use when converting a traditional MPC controller, opt
= generateExplicitOptions(MPCobj
)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.
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);
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property of "mpc" object 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 of "mpc" object to state-space. -->Converting model to discrete time. Assuming no disturbance added to measured output channel #1. -->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.
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.
MPCobj
— Traditional MPC controllerTraditional MPC controller, specified as an MPC controller object.
Use the mpc
command to create
a traditional MPC controller.
opt
— Options for generating explicit MPC controllerOptions 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.
zerotol
— Zero-detection tolerance1e-8
(default) | positive scalar valueZero-detection tolerance used by the NNLS solver, specified as a positive scalar value.
removetol
— Redundant-inequality-constraint detection tolerance1e-4
(default) | positive scalar valueRedundant-inequality-constraint detection tolerance, specified as a positive scalar value.
flattol
— Flat region detection tolerance1e-5
(default) | positive scalar valueFlat region detection tolerance, specified as a positive scalar value.
normalizetol
— Constraint normalization toleranceConstraint normalization tolerance, specified as a positive scalar value.
maxiterNNLS
— Maximum number of NNLS solver iterationsMaximum number of NNLS solver iterations, specified as a positive integer.
maxiterQP
— Maximum number of QP solver iterationsMaximum number of QP solver iterations, specified as a positive integer.
maxiterBS
— Maximum number of bisection method iterationsMaximum number of bisection method iterations used to detect region flatness, specified as a positive integer.
polyreduction
— Method for removing redundant inequalitiesMethod used to remove redundant inequalities, specified as either 1 (robust) or 2 (fast).
You have a modified version of this example. Do you want to open this example with your edits?