Documentation

setterminal

Terminal weights and constraints

Syntax

setterminal(MPCobj,Y,U)
setterminal(MPCobj,Y,U,Pt)

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.

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.

Input Arguments

MPCobj

MPC controller, specified as an MPC controller object

Y

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 non-zero off-diagonal terminal weights, you must augment the plant model. See Implementing Infinite-Horizon LQR by Setting Terminal Weights in a Finite-Horizon MPC FormulationImplementing Infinite-Horizon LQR by Setting Terminal Weights in a Finite-Horizon MPC Formulation.

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.

U

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 non-zero off-diagonal terminal weights, you must augment the plant model. See Implementing Infinite-Horizon LQR by Setting Terminal Weights in a Finite-Horizon MPC FormulationImplementing Infinite-Horizon LQR by Setting Terminal Weights in a Finite-Horizon MPC Formulation.

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.

Pt

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

Default: Prediction horizon p

Examples

This example shows how to specify constraints and a penalty weight at the last step of the prediction horizon of an MPC controller. The controller has three output variables and two manipulated variables.

  1. Specify a prediction horizon of 8.

    MPCobj.PredictionHorizon = 8;
  2. Define a penalty weight and constraints:

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

    The constraints and weights include:

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

    • Lower bounds of 0 and –1 on outputs 1 and 3, none on output 2

    • Upper bound at 2 on output 2, none on outputs 1 and 3

    • Lower bound at 1 on manipulated variable 1

    • No other conditions (weights or bounds) on the manipulated variables

  3. Specify the constraints and weight at the last step (step 8) of the prediction horizon:

    setterminal(MPCobj,Y,U);

This example shows how to specify constraints and a penalty weight beginning with step 5 and ending at the last step of the prediction horizon of an MPC controller, The controller has three output variables and two manipulated variables.

  1. Specify a prediction horizon of 8.

    MPCobj.PredictionHorizon = 8;
  2. Define a penalty weight and constraints:

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

    The constraints and weights include:

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

    • Lower bounds of 0 and –1 on outputs 1 and 3, none on output 2

    • Upper bound at 2 on output 2, none on outputs 1 and 3

    • Lower bound at 1 on manipulated variable 1

    • No other conditions (weights or bounds) on the manipulated variables

  3. Specify the constraints and weight beginning with step 5 and ending at the last step of the prediction horizon:

    setterminal(MPCobj,Y,U,5);

More About

expand all

Tips

  • Advanced users can impose terminal polyhedral state constraints:

    K1HxK2.

    First, augment the plant model with additional artificial (unmeasured) outputs, y = Hx. Then specify bounds K1 and K2 on these y outputs.

Was this topic helpful?