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

*E**u*(*k* +
*j*) +
*F**y*(*k* +
*j*) + *S**v*(*k* +
*j*) ≤ *G* +
*ε**V*

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

*p* is the prediction horizon.

*k* is the current time index.

*u* is a column vector manipulated variables.

*y* is a column vector of all plant output variables.

*v* is a column vector of measured disturbance variables.

*ε* is a scalar slack variable used for constraint softening (as in Standard Cost Function).

*E*, *F*, *G*, *V*, and *S* are constant matrices.

Since the MPC controller does not optimize
*u*(*k*+*p*),
`getconstraint`

calculates the last constraint at time
*k*+*p*

assuming that *u*(*k*+*p*) =
*u*(*k*+*p*-1).