# generateExplicitRange

Bounds on explicit MPC control law parameters

## Description

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`

.

## Examples

### Generate Explicit MPC Controller

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 is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property 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 channel #1. -->The "Model.Noise" property 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

`MPCobj`

— Traditional MPC controller

MPC controller object

Traditional MPC controller, specified as an MPC controller object.
Use the `mpc`

command to create
a traditional MPC controller.

## Output Arguments

`Range`

— Parameter bounds

structure

Parameter 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 values

structure

Bounds on controller state values, specified as a structure
containing fields `Min`

and `Max`

.
Each of `Min`

and `Max`

is a vector
of length *n _{x}*, where

*n*is the number of controller states.

_{x}`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 values

structure

Bounds on controller reference signal values, specified as a
structure containing fields `Min`

and `Max`

.
Each of `Min`

and `Max`

is a vector
of length *n _{y}*, where

*n*is the number of plant outputs.

_{y}`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 values

structure

Bounds on measured disturbance values, specified as a structure
containing fields `Min`

and `Max`

.
Each of `Min`

and `Max`

is a vector
of length *n _{md}*, where

*n*is the number of measured disturbances. If your system has no measured disturbances, leave the generated values of this field unchanged.

_{md}`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 values

structure

Bounds on manipulated variable values, specified as a structure
containing fields `Min`

and `Max`

.
Each of `Min`

and `Max`

is a vector
of length *n _{u}*, where

*n*is the number of manipulated variables.

_{u}`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.

## Version History

**Introduced in R2014b**

## See Also

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)