Main Content

simplify

Reduce explicit MPC controller complexity and memory requirements

Description

EMPCreduced = simplify(empcobj,'exact') attempts to reduce the number of piecewise affine (PWA) regions in an explicit MPC controller by merging regions that have identical controller gains and whose union is a convex set. Reducing the number of PWA regions reduces memory requirements of the controller. This command returns a reduced controller, EMPCreduced. If the second argument is omitted then it is assumed to be 'exact'.

example

EMPCreduced = simplify(empcobj,'exact',uniteeps) specifies the tolerance for identifying regions that can be merged.

EMPCreduced = simplify(empcobj,'radius',r) retains only regions whose Chebyshev radius (the radius of the largest ball contained in the region) is larger than r.

EMPCreduced = simplify(empcobj,'sequence',index) eliminates all regions except those specified in an index vector.

simplify(empcobj,___) applies the reduction to the explicit MPC controller empcobj, rather than returning a new controller object. You can use this syntax with any of the previous reduction options.

Examples

collapse all

Define a plant model. For this example, define the plant model as a double integrator.

plant = tf(1,[1 0 0])                   % plant model
plant =
 
   1
  ---
  s^2
 
Continuous-time transfer function.

Create an MPC controller with a sampling time of 0.1 seconds, a prediction horizon or 10 steps, and a control horizon of 3 steps. Also define a constraint on the manipulated variable.

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

Place hard constraint on the manipulated variable.

mpcobj.ManipulatedVariables = struct('Min',-1,'Max',1);

Create a range structure to specify the ranges for input, state, and reference signals.

range.ManipulatedVariable.Min = -1.1;   % input signal min
range.ManipulatedVariable.Max = 1.1;    % input signal max

range.State.Min(:) = [-10;-10];         % states min
range.State.Max(:) = [10;10];           % states max

range.Reference.Min = -2;               % reference min
range.Reference.Max = 2;                % reference max

Generate an explicit MPC controller with the specified signal ranges using the generateExplicitMPC function, and display the resulting controller.

mpcobjExplicit = generateExplicitMPC(mpcobj,range)
-->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.


Regions found / unexplored:       19/       0

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

Note that the resulting explicit controller has 19 polyhedral regions.

Use simplify to simplify the explicit MPC controller, and display the resulting controller.

reducedEMPC = simplify(mpcobjExplicit)
Regions to analyze:       15/      15

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

Note that the simplified explicit controller has 15 polyhedral regions.

Input Arguments

collapse all

Explicit MPC controller to reduce, specified as an Explicit MPC controller object. Use generateExplicitMPC to create an explicit MPC controller.

Tolerance for joining PWA regions, specified as a positive scalar.

Minimum Chebyshev radius for retaining PWA regions, specified as a nonnegative scalar. When you use the 'radius' option, simplify keeps only the regions whose Chebyshev radius is larger than r. The default value is 0, which causes all regions to be retained.

Indices of PWA regions to retain, specified as a vector. The default value is [1:nr], where nr is the number of PWA regions in empcobj. Thus, by default, all regions are retained. You can obtain a sequence of regions to retain by performing simulations using empcobj and recording the indices of regions actually encountered.

Output Arguments

collapse all

Reduced MPC controller, returned as an Explicit MPC controller object.

Version History

Introduced in R2014b