Main Content

得到constraint

Obtain mixed input/output constraints from model predictive controller

Description

example

[E,F,G,V,S] = getconstraint(mpcobj)returns the mixed-input/output constraints previously defined for the MPC controller,mpcobj. For more information, seeMixed Input/Output Constraints.

Examples

collapse all

Create a third-order plant model with two manipulated variables, one measured disturbance, and two measured outputs.

plant = rss(3,2,3); plant.D = 0; plant = setmpcsignals(plant,mv=[1 2],md=3);

Create an MPC controller for this plant.

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.

Assume that you have two soft constraints.

u 1 + u 2 5 y 2 + v 1 0

Set the constraints for the MPC controller.

E = [1 1; 0 0]; F = [0 0; 0 1]; G = [5;10]; V = [1;1]; S = [0;1]; setconstraint(mpcobj,E,F,G,V,S)

Retrieve the constraints from the controller.

[E,F,G,V,S] = getconstraint(mpcobj)
E =2×210 0
F =2×20 0 0 1
G =2×15 10
V =2×11
S =2×10 1

Input Arguments

collapse all

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

Output Arguments

collapse all

Manipulated variable constraint constant, returned as anNc-by-Nmvarray, whereNcis the number of constraints, andNmvis the number of manipulated variables.

Ifmpcobjhas no mixed input/output constraints, thenEis[].

Controlled output constraint constant, returned as anNc-by-Nyarray, whereNyis the number of controlled outputs (measured and unmeasured).

Ifmpcobjhas no mixed input/output constraints, thenFis[].

Mixed input/output constraint constant, returned as a column vector of lengthNc., whereNcis the number of constraints.

Ifmpcobjhas no mixed input/output constraints, thenGis[].

Constraint softening constant representing the equal concern for the relaxation (ECR), returned as a column vector of lengthNc, whereNcis the number of constraints. Ifmpcobjhas no mixed input/output constraints, thenVis[].

IfVis not specified, a default value of1is applied to all constraint inequalities and all constraints are soft. This behavior is the same as the default behavior for output bounds, as described inStandard Cost Function.

To make theith努力约束,指定V(i) =0.

To make theithconstraint soft, specifyV(i) > 0in keeping with the constraint violation magnitude you can tolerate. The magnitude violation depends on the numerical scale of the variables involved in the constraint.

In general, asV(i) decreases, the controller hardens the constraints by decreasing the constraint violation that is allowed.

Measured disturbance constraint constant, returned as anNc-by-Nvarray, whereNvis the number of measured disturbances.

If there are no measured disturbances in the mixed input/output constraints, ormpcobjhas no mixed input/output constraints, thenSis[].

Algorithms

collapse all

Mixed Input/Output Constraints

The general form of the mixed input/output constraints is:

Eu(k+j) +Fy(k+j) +Sv(k+j) ≤G+εV

Here,j= 0,...,p, and:

  • pis the prediction horizon.

  • kis the current time index.

  • uis a column vector manipulated variables.

  • yis a column vector of all plant output variables.

  • vis a column vector of measured disturbance variables.

  • εis a scalar slack variable used for constraint softening (as inStandard Cost Function).

  • E,F,G,V, andSare constant matrices.

Since the MPC controller does not optimizeu(k+p),得到constraintcalculates the last constraint at timek+passuming thatu(k+p) =u(k+p-1).

已经rsion History

Introduced in R2011a