QP_UPDATE – Update matrices/vectors of quadratic programming

Block SymbolLicensing group: ADVANCED
PIC

Function Description
The QP_UPDATE function block cooperates with the QP_MPC2QP block which converts the MPC problem described by equations (15.1)–(15.4) with prediction horizon np and control horizon nc (inputs np and nc), to quadratic programming and pre-computes the Hessian matrix H, parts of the gradient vector Gx, Gv, Gw, matrices determining state constraints SuL, Sv, T, and matrices determining output constraints ScuL, Scv, Tc. Besides the constant Hessian matrix H, the other vectors and matrices are connected to input references uGx, uGv, uGw, uSuL, uSv, uT, uScuL, uScv and uTc.

For detailed information, see the PDF version of this manual.

The output references yx0, yxmin, yxmax, yymin, yymax,yV, yGx, yGv, yGw, ySuL, ySv, yT, yScuL, yScv, yTc, yG, yCA, yLBA and yUBA are always set to the corresponding input ux0, uxmin, uxmax, uymin, uymax,uV, uGx, uGv, uGw, uSuL, uSv, uT, uScuL, uScv, uTc, uG, uCA, uLBA and yUBA.

If HLD = on then nothing is computed.

The error flag E is set to on if:

  • the prediction horizon np < 1 or control horizon nc < 1, or nc > np,
  • the reference ux0 is not defined or the element type of the array it references is not Double (F64),
  • the internal variable bStateConstr = on and at least one of the references uxmin, uxmax is not defined, or the element type of at least one of the arrays they reference is not Double (F64),
  • the internal variable bOutputConstr = on and the reference uymin is defined and the element type of the array it references is not Double (F64),
  • the internal variable bOutputConstr = on and the reference uymax is defined and the element type of the array it references is not Double (F64),
  • the reference uV is defined and the element type of the array it references is not Double (F64),
  • the reference uG is defined and at least one of the references uGx, uGv, uSuL, uSv or uT is not defined,
  • the reference uG is defined and the element type of the array it references is not Double (F64), or the reference uGx is defined and the element type of the array it references is not Double (F64), or the reference uGv is defined and the element type of the array it references is not Double (F64), or the reference uGw is defined and the element type of the array it references is not Double (F64),
  • the reference uSuL is defined and the element type of the array it references is not Double (F64), or the reference uSv is defined and the element type of the array it references is not Double (F64), or the reference uT is defined and the element type of the array it references is not Double (F64),
  • the reference uScuL is defined and the element type of the array it references is not Double (F64), or the reference uScv is defined and the element type of the array it references is not Double (F64), or the reference uTc is defined and the element type of the array it references is not Double (F64),
  • the reference uCA or uLBA or uUBA or the element type of at least one of the arrays they reference is not Double (F64),
  • the arrays referenced by defined references are too small or have incompatible dimensions.

If E = on, see the system log for details.

Inputs

np

Prediction horizon   1  1000000

Long (I32)

nc

Control horizon   1  1000000

Long (I32)

ux0

Input reference to initial condition vector x0 of the state vector x

Reference

uxmin

Input reference to vector of low limits of the state vector elements

Reference

uxmax

Input reference to vector of high limits of the state vector elements

Reference

uymin

Input reference to vector of low limits of the output inequalities

Reference

uymax

Input reference to vector of high limits of the output inequalities

Reference

uV

Input reference to vector predicted disturbancies

Reference

uGx

Input reference to part of gradient vector G corresponding to state vector x

Reference

uGv

Input reference to part of gradient vector G corresponding to disturbance vector v

Reference

uGw

Intput reference to part of gradient vector G corresponding to vector W

Reference

uSuL

Input reference to work matrix Su*L

Reference

uSv

Input reference to work matrix Sv

Reference

uT

Input reference to work matrix T

Reference

uScuL

Input reference to work matrix Scu*L

Reference

uScv

Input reference to work matrix Scv

Reference

uTc

Input reference to work matrix Tc

Reference

uG

Input reference to gradient vector G

Reference

uCA

Input reference to QP constraints matrix CA

Reference

uLBA

Input reference to lower constraints’ bound vector LB

Reference

uUBA

Input reference to upper constraints’ bound vector LB

Reference

HLD

Hold

Bool

Outputs

yx0

Output reference to initial condition vector x0 of the state vector x

Reference

yxmin

Output reference to vector of low limits of the state vector elements

Reference

yxmax

Output reference to vector of high limits of the state vector elements

Reference

yymin

Output reference to vector of low limits of the output inequalities

Reference

yymax

Output reference to vector of high limits of the output inequalities

Reference

yV

Output reference to vector predicted disturbancies

Reference

yGx

Output reference to part of gradient vector G corresponding to state vector x

Reference

yGv

Output reference to part of gradient vector G corresponding to disturbance vector v

Reference

yGw

Output reference to part of gradient vector G corresponding to vector W

Reference

ySuL

Output reference to work matrix Su*L

Reference

ySv

Output reference to work matrix Sv

Reference

yT

Output reference to work matrix T

Reference

yScuL

Output reference to work matrix Scu*L

Reference

yScv

Output reference to work matrix Scv

Reference

yTc

Output reference to work matrix Tc

Reference

yG

Output reference to gradient vector G

Reference

yCA

Output reference to QP constraints matrix CA

Reference

yLBA

Output reference to lower constraints’ bound vector LB

Reference

yUBA

Output reference to upper constraints’ bound vector LB

Reference

E

Error indicator

Bool

2023 © REX Controls s.r.o., www.rexygen.com