Bounds on explicit MPC control law parameters
creates a structure of parameter bounds based upon a traditional (implicit) MPC controller
object. The range structure is intended for use as an input argument to Range
= generateExplicitRange(MPCobj
)generateExplicitMPC
. Usually, the initial range values returned by
generateExplicitRange
are not suitable for generating an explicit MPC
controller. Therefore, use dot notation to set the values of the range structure before calling
generateExplicitMPC
.
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.
Range
— Parameter boundsParameter bounds for generating an explicit MPC controller from MPCobj
,
returned as a structure.
Initially, each parameter’s minimum and maximum bounds are identical. All such parameters are considered fixed. When you generate an explicit controller, any fixed parameters must be constant when the controller operates. This is unlikely to happen in general. Thus, you must specify valid bounds for all parameters. Use dot notation to set the values of the range structure as appropriate for your system.
The fields of the range structure are as follows.
State
— Bounds on controller state valuesBounds on controller state values, specified as a structure
containing fields Min
and Max
.
Each of Min
and Max
is a vector
of length nx, where nx is
the number of controller states. Range.State.Min
and Range.State.Max
contain
the minimum and maximum values, respectively, of all controller states.
For example, suppose you are designing a two-state controller. You
have determined that the range of the first controller state is [-1000,1000]
,
and that of the second controller state is [0,2*pi]
.
Set these bounds as follows:
Range.State.Min(:) = [-1000,0]; Range.State.Max(:) = [1000,2*pi];
MPC controller states include states from plant model, disturbance model, and noise model, in that order. Setting the range of a state variable is sometimes difficult when a state does not correspond to a physical parameter. In that case, multiple runs of open-loop plant simulation with typical reference and disturbance signals are recommended in order to collect data that reflect the ranges of states.
Reference
— Bounds on controller reference signal valuesBounds on controller reference signal values, specified as a
structure containing fields Min
and Max
.
Each of Min
and Max
is a vector
of length ny, where ny is
the number of plant outputs. Range.Reference.Min
and Range.Reference.Max
contain
the minimum and maximum values, respectively, of all reference signal
values. For example, suppose you are designing a controller for a
two-output plant. You have determined that the range of the first
plant output is [-1000,1000]
, and that of the second
plant output is [0,2*pi]
. Set these bounds as follows:
Range.Reference.Min(:) = [-1000,0]; Range.Reference.Max(:) = [1000,2*pi];
Usually you know the practical range of the reference signals being used at the nominal operating point in the plant. The ranges used to generate the explicit MPC controller must be at least as large as the practical range.
MeasuredDisturbance
— Bounds on measured disturbance valuesBounds on measured disturbance values, specified as a structure
containing fields Min
and Max
.
Each of Min
and Max
is a vector
of length nmd, where nmd is
the number of measured disturbances. If your system has no measured
disturbances, leave the generated values of this field unchanged.
Range.MeasuredDisturbance.Min
and Range.MeasuredDisturbance.Max
contain
the minimum and maximum values, respectively, of all measured disturbance
signals. For example, suppose you are designing a controller for a
system with two measured disturbances. You have determined that the
range of the first disturbance is [-1,1]
, and that
of the second disturbance is [0,0.1]
. Set these
bounds as follows:
Range.Reference.Min(:) = [-1,0]; Range.Reference.Max(:) = [1,0.1];
Usually you know the practical range of the measured disturbance signals being used at the nominal operating point in the plant. The ranges used to generate the explicit MPC controller must be at least as large as the practical range.
ManipulatedVariable
— Bounds on manipulated variable valuesBounds on manipulated variable values, specified as a structure
containing fields Min
and Max
.
Each of Min
and Max
is a vector
of length nu, where nu is
the number of manipulated variables. Range.ManipulatedVariable.Min
and Range.ManipulatedVariable.Max
contain
the minimum and maximum values, respectively, of all manipulated variables.
For example, suppose your system has two manipulated variables. The
range of the first manipulated variable is [-1,1]
,
and that of the second variable is [0,0.1]
. Set
these bounds as follows:
Range.ManipulatedVariable.Min(:) = [-1,0]; Range.ManipulatedVariable.Max(:) = [1,0.1];
If manipulated variables are constrained, the ranges used to generate the explicit MPC controller must be at least as large as these limits.
You have a modified version of this example. Do you want to open this example with your edits?