Main Content

setterminal

Terminal weights and constraints

Description

setterminal(mpcobj,Y,U) specifies diagonal quadratic penalty weights and constraints at the last step in the prediction horizon. The weights and constraints are on the terminal output y(t+p) and terminal input u(t+p – 1), where p is the prediction horizon of the MPC controller mpcobj.

example

setterminal(mpcobj,Y,U,Pt) specifies diagonal quadratic penalty weights and constraints from step Pt to the horizon end. By default, Pt is the last step in the horizon.

example

Examples

collapse all

Create an MPC controller for a plant with three output variables and two manipulated variables.

plant = rss(3,3,2);
plant.D = 0;
mpcobj = mpc(plant,0.1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.
   for output(s) y1 y2 and zero weight for output(s) y3 

Specify a prediction horizon of 8.

mpcobj.PredictionHorizon = 8;

Define the following penalty weights and constraints:

  • Diagonal penalty weights of 1 and 10 on the first two output variables

  • Lower bounds of 0 and -1 on the first and third outputs respectively

  • Upper bound of 2 on the second output

  • Lower bound of 1 on the first manipulated variable

Y = struct('Weight',[1,10,0],'Min',[0,-Inf,-1],'Max',[Inf,2,Inf]);
U = struct('Min',[1,-Inf]);

Specify the constraints and penalty weights at the last step of the prediction horizon.

setterminal(mpcobj,Y,U)

Create an MPC controller for a plant with three output variables and two manipulated variables.

plant = rss(3,3,2);
plant.D = 0;
mpcobj = mpc(plant,0.1);
-->"PredictionHorizon" is empty. Assuming default 10.
-->"ControlHorizon" is empty. Assuming default 2.
-->"Weights.ManipulatedVariables" is empty. Assuming default 0.00000.
-->"Weights.ManipulatedVariablesRate" is empty. Assuming default 0.10000.
-->"Weights.OutputVariables" is empty. Assuming default 1.00000.
   for output(s) y1 y2 and zero weight for output(s) y3 

Specify a prediction horizon of 10.

mpcobj.PredictionHorizon = 10;

Define the following terminal constraints:

  • Lower bounds of 0 and -1 on the first and third outputs respectively

  • Upper bound of 2 on the second output

  • Lower bound of 1 on the first manipulated variable

Y = struct('Min',[0,-Inf,-1],'Max',[Inf,2,Inf]);
U = struct('Min',[1,-Inf]);

Specify the constraints beginning at step 5 and ending at the last step of the prediction horizon.

setterminal(mpcobj,Y,U,5)

Input Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, use mpc.

Terminal weights and constraints for the output variables, specified as a structure with the following fields:

Weight1-by-ny vector of nonnegative weights
Min1-by-ny vector of lower bounds
Max1-by-ny vector of upper bounds
MinECR1-by-ny vector of constraint-softening Equal Concern for the Relaxation (ECR) values for the lower bounds
MaxECR1-by-ny vector of constraint-softening ECR values for the upper bounds

ny is the number of controlled outputs of the MPC controller.

If the Weight, Min or Max field is empty, the values in mpcobj are used at all prediction horizon steps including the last. For the standard bounds, if any element of the Min or Max field is infinite, the corresponding variable is unconstrained at the terminal step.

Off-diagonal weights are zero (as described in Standard Cost Function). To apply nonzero off-diagonal terminal weights, you must augment the plant model. See Provide LQR Performance Using Terminal Penalty Weights.

By default, Y.MinECR = Y.MaxECR = 1 (soft output constraints).

Choose the ECR magnitudes carefully, accounting for the importance of each constraint and the numerical magnitude of a typical violation.

Terminal weights and constraints for the manipulated variables, specified as a structure with the following fields:

Weight1-by-nu vector of nonnegative weights
Min1-by-nu vector of lower bounds
Max1-by-nu vector of upper bounds
MinECR1-by-nu vector of constraint-softening Equal Concern for the Relaxation (ECR) values for the lower bounds
MaxECR1-by-nu vector of constraint-softening ECR values for the upper bounds

nu is the number of manipulated variables of the MPC controller.

If the Weight, Min or Max field is empty, the values in mpcobj are used at all prediction horizon steps including the last. For the standard bounds, if individual elements of the Min or Max fields are infinite, the corresponding variable is unconstrained at the terminal step.

Off-diagonal weights are zero (as described in Standard Cost Function). To apply nonzero off-diagonal terminal weights, you must augment the plant model. See Provide LQR Performance Using Terminal Penalty Weights.

By default, U.MinECR = U.MaxECR = 0 (hard manipulated variable constraints)

Choose the ECR magnitudes carefully, accounting for the importance of each constraint and the numerical magnitude of a typical violation.

Step in the prediction horizon, specified as an integer between 1 and p, where p is the prediction horizon. The terminal weights and constraints are applied from prediction step Pt to the end.

Version History

Introduced in R2011a