LabVIEW Control Design and Simulation Module

CD Linear Quadratic Regulator VI

  • Updated2023-03-14
  • 8 minute(s) read

CD Linear Quadratic Regulator VI

Owning Palette: State Feedback Design VIs

Requires: Control Design and Simulation Module

Calculates the optimal steady-state feedback gain matrix K that minimizes a linear quadratic cost function you specify. You can use this VI to calculate K for a continuous or discrete state-space model. You also can use this VI to calculate automatically a discrete K for a continuous state-space model. This calculation uses a specified sampling time and an associated continuous cost function. You must manually select the polymorphic instance to use.

Details  

CD Linear Quadratic Regulator (LQR)

Weighting Type determines the type of cost function this VI minimizes. Refer to the Details section for the cost function equations.

0state weighting (default)—Selects a cost function that weights the model states.
1output weighting, Dimension Q = Ny—Selects a cost function that weights the model outputs, where Q is in terms of the model outputs. If you select this option, Q must be an r × r matrix, where r is the number of model outputs.
2output weighting, Dimension Q= Nx—Selects a cost function that weights the model outputs, where Q is in terms of the model states. If you select this option, Q must be an n × n matrix, where n is the number of model states.
State-Space Model contains a mathematical representation of and information about the system for which this VI calculates state feedback optimal gain.
Q specifies a symmetric, positive semi-definite matrix that penalizes the state vector x in the cost function. If you specify a cost function that weights the model outputs, Q penalizes the output vector y in the cost function.
R specifies a symmetric, positive definite matrix that penalizes the input vector u in the cost function.
N specifies a matrix of appropriate dimensions that penalizes the cross-product between the input and state vectors. If you do not wire a value to this parameter, this VI sets N to an appropriately-sized matrix of zeros.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Optimal Gain (K) is the resulting state feedback gain matrix K that minimizes the cost function.
Eigenvalues are the poles of the resulting closed-loop system. The poles are equal to the eigenvalues of A–BK.
Riccati Solution (X) returns the symmetric, positive semi-definite solution X to the continuous or discrete algebraic Riccati equation, depending whether the model you wire to the State-Space Model input of this VI is continuous or discrete. However, the Discretized LQR instance of this VI always returns the solution to the discrete algebraic Riccati equation. Refer to the Details section for the definitions of the Riccati equations.
error out contains error information. This output provides standard error out functionality.

CD Linear Quadratic Regulator (Discretized LQR)

Weighting Type determines the type of cost function this VI minimizes. Refer to the Details section for the cost function equations.

0state weighting (default)—Selects a cost function that weights the model states.
1output weighting, Dimension Q = Ny—Selects a cost function that weights the model outputs, where Q is in terms of the model outputs. If you select this option, Q must be an r × r matrix, where r is the number of model outputs.
2output weighting, Dimension Q= Nx—Selects a cost function that weights the model outputs, where Q is in terms of the model states. If you select this option, Q must be an n × n matrix, where n is the number of model states.
Continuous State-Space Model specifies the continuous state-space model for which this VI designs a discrete-time LQR controller.
Q specifies a symmetric, positive semi-definite matrix that penalizes the state vector x in the cost function. If you specify a cost function that weights the model outputs, Q penalizes the output vector y in the cost function.
R specifies a symmetric, positive definite matrix that penalizes the input vector u in the cost function.
N specifies a matrix of appropriate dimensions that penalizes the cross-product between the input and state vectors. If you do not wire a value to this parameter, this VI sets N to an appropriately-sized matrix of zeros.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
Sampling Time specifies the discrete sampling time this VI uses to discretize the continuous state-space model and cost function. The resulting discrete Optimal Gain (K) is associated with this sampling time. The default value is 1 second.
Optimal Gain (K) is the resulting state feedback gain matrix K that minimizes the cost function.
Eigenvalues are the poles of the resulting closed-loop system. The poles are equal to the eigenvalues of A–BK.
Riccati Solution (X) returns the symmetric, positive semi-definite solution X to the continuous or discrete algebraic Riccati equation, depending whether the model you wire to the State-Space Model input of this VI is continuous or discrete. However, the Discretized LQR instance of this VI always returns the solution to the discrete algebraic Riccati equation. Refer to the Details section for the definitions of the Riccati equations.
error out contains error information. This output provides standard error out functionality.

CD Linear Quadratic Regulator Details

The value you specify for the Weighting Type parameter determines the cost function this VI minimizes. The cost function also depends on whether the model is continuous or discrete.

Continuous Models

State Weighting

Output Weighting, Dim[Q] = Ny

Output Weighting, Dim[Q] = Nx

For continuous models, Optimal Gain (K) = R–1[BTX+NT].

This VI solves the continuous algebraic Riccati equation, defined as ATX+XA–[XB+N]R–1[XB+N]T+Q = 0.

Discrete Models

State Weighting

Output Weighting, Dim[Q] = Ny

Output Weighting, Dim[Q] = Nx

For discrete models, Optimal Gain (K) = [BTXB+R]–1[BTXA+NT].

This VI solves the discrete algebraic Riccati equation, defined as ATXA–[ATXB+N][BTXB+R]–1][ATXB+N]T+Q = X.

Matrix Restrictions

For continuous models, you must be able to stabilize the pair .

where = ABR–1NT
B1 is the full-rank factorization of G = BR–1BT, that is, G = B1BT1 and rank[G] = rank[B1]

For discrete models, you must be able to stabilize the pair .

For continuous and discrete models, you must be able to detect the pair .

whereC1 is the full-rank factorization of H = QNR–1NT, that is, H = C1CT1 and rank[H] = rank[C1]

Q and R must satisfy the following relationships, respectively:

Q = QT ≥ 0

R = RT > 0

N must satisfy the following relationship:

whereu is the input
y is the output
x is the states
t is continuous time
k is discrete time
Q is the state-weighting matrix
R is the input-weighting matrix
N is the cross-weighting matrix between the states and inputs
B is the input matrix
C is the output matrix
D is the direct transmission matrix
I is the identity matrix
X is the solution to the continuous or discrete algebraic Riccati equation

Discretized Linear Quadratic Regulator

This instance converts the A, B, C, and D matrices using the numerical integration method as proposed by Van Loan. Refer to the reference material by the following authors for more information about this method:

  • Franklin, G.F., J.D. Powell, and M. Workman.
  • Loan, C.F.V.

This VI does not support delays unless the delays are part of the mathematical model that represents the dynamic system. To account for the delays in the synthesis of the controller, you must incorporate the delays into the mathematical model of the dynamic system using the CD Convert Delay with Pade Approximation VI (continuous models) or the CD Convert Delay to Poles at Origin VI (discrete models). Refer to the LabVIEW Control Design User Manual for more information about delays and the limitations of Pade Approximation.

Log in to get a better experience