CD Kalman Gain VI

Control Design VI and Function

CD Kalman Gain VI

Owning Palette: State Feedback Design VIs

Installed With: Control Design and Simulation Module

Calculates the optimal steady-state Kalman gain L that minimizes the covariance of the estimation error for a continuous or discrete model affected by noise. You can use this VI to calculate the Kalman gain for a stochastic or deterministic model. You also can use this VI to discretize automatically a continuous stochastic or continuous deterministic model before calculating L. You must manually select the polymorphic instance you want to use.

Details  

Use the pull-down menu to select an instance of this VI.

 Place on the block diagram  Find on the Functions palette

CD Kalman Gain (Stochastic)

Stochastic State-Space Model In specifies a mathematical representation of a stochastic system.
Second-Order Statistics Noise Model specifies a mathematical representation of the noise model of the Stochastic State-Space Model.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
Closed-Loop Eigenvalues returns the poles of the Kalman filter when using the Steady-State Kalman Gain (L).
Steady-State Kalman Gain (L) returns the optimal gain matrix L that minimizes the Steady-State Estimation Error Covariance (P) for the given model and noise.
Steady-State Estimation Error Covariance (P) returns the covariance of the estimation error.
Steady-State Innovation Gain (M) returns the optimal gain matrix M that minimizes the Steady-State Error Covariance of Updated Estimate (Z) in the discrete estimation process.
Steady-State Error Covariance of Updated Estimate (Z) returns the covariance of the error between the actual states and the updated state estimates in the discrete estimation process.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

CD Kalman Gain (Deterministic)

G specifies the matrix that relates the process noise vector to the model states.
State-Space Model contains a mathematical representation of and information about the system of which this VI calculates optimal estimator gain.
Q specifies the auto-covariance matrix of w.
R specifies the auto-covariance matrix of v.
N specifies the cross-covariance matrix between the process noise vector w and the measurement noise vector v. If w and v are uncorrelated, N is a matrix of zeros.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
H specifies the matrix that relates the process noise vector to the model outputs.
Closed-Loop Eigenvalues returns the poles of the Kalman filter when using the Steady-State Kalman Gain (L).
Steady-State Kalman Gain (L) returns the optimal gain matrix L that minimizes the Steady-State Estimation Error Covariance (P) for the given model and noise.
Steady-State Estimation Error Covariance (P) returns the covariance of the estimation error.
Steady-State Innovation Gain (M) returns the optimal gain matrix M that minimizes the Steady-State Error Covariance of Updated Estimate (Z) in the discrete estimation process.
Steady-State Error Covariance of Updated Estimate (Z) returns the covariance of the error between the actual states and the updated state estimates in the discrete estimation process.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

CD Discretized Kalman Gain (Stochastic)

Continuous Stochastic State-Space Model specifies a mathematical representation of a continuous stochastic system.
Continuous Second-Order Statistics Noise Model specifies a mathematical representation of the continuous noise model of the Continuous Stochastic State-Space Model.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
Sampling Time (s) specifies the sampling time this VI uses to discretize the continuous model(s) before calculating the estimator gain.
Closed-Loop Eigenvalues returns the poles of the Kalman filter when using the Steady-State Kalman Gain (L).
Steady-State Kalman Gain (L) returns the optimal gain matrix L that minimizes the Steady-State Estimation Error Covariance (P) for the given model and noise.
Steady-State Estimation Error Covariance (P) returns the covariance of the estimation error.
Steady-State Innovation Gain (M) returns the optimal gain matrix M that minimizes the Steady-State Error Covariance of Updated Estimate (Z) in the discrete estimation process.
Steady-State Error Covariance of Updated Estimate (Z) returns the covariance of the error between the actual states and the updated state estimates in the discrete estimation process.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

CD Discretized Kalman Gain (Deterministic)

G specifies the matrix that relates the process noise vector to the model states.
State-Space Model contains a mathematical representation of and information about the system of which this VI calculates optimal estimator gain.
Q specifies the auto-covariance matrix of w.
R specifies the auto-covariance matrix of v.
N specifies the cross-covariance matrix between the process noise vector w and the measurement noise vector v. If w and v are uncorrelated, N is a matrix of zeros.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use exception control to treat what is normally an error as no error or to treat a warning as an error. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
H specifies the matrix that relates the process noise vector to the model outputs.
Sampling Time (s) specifies the sampling time this VI uses to discretize the continuous model(s) before calculating the estimator gain.
Closed-Loop Eigenvalues returns the poles of the Kalman filter when using the Steady-State Kalman Gain (L).
Steady-State Kalman Gain (L) returns the optimal gain matrix L that minimizes the Steady-State Estimation Error Covariance (P) for the given model and noise.
Steady-State Estimation Error Covariance (P) returns the covariance of the estimation error.
Steady-State Innovation Gain (M) returns the optimal gain matrix M that minimizes the Steady-State Error Covariance of Updated Estimate (Z) in the discrete estimation process.
Steady-State Error Covariance of Updated Estimate (Z) returns the covariance of the error between the actual states and the updated state estimates in the discrete estimation process.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

CD Kalman Gain Details

Continuous Stochastic and Deterministic Models

For continuous models, the estimation error is defined as . The Steady-State Estimation Error Covariance (P) is calculated as

The Kalman filter minimizes this quantity. This VI computes the Steady-State Kalman Gain (L) to apply to the Kalman filter by solving the continuous algebraic Riccati equation expressed in terms of P. This expression is defined as

The Steady-State Kalman Gain (L) is calculated as

The following equations define the noise covariance matrices Q, R, and N.

Discrete Stochastic and Deterministic Models

For discrete models, the prediction estimation error is defined as . The Steady-State Estimation Error Covariance (P) is calculated as

The Kalman filter minimizes this quantity. This VI computes the Steady-State Kalman Gain (L) to apply to the Kalman filter by solving the discrete algebraic Riccati equation expressed in terms of P. This expression is defined as

This VI calculates the Steady-State Kalman Gain (L) as

The following equations define the noise covariance matrices Q, R, and N.

This VI calculates the Steady-State Innovation Gain (M) as

The updated estimation error is defined as . The Steady-State Error Covariance of Updated Estimate (Z) is defined as Z = PMCP.

Matrix Restrictions

For both continuous and discrete models, which either are stochastic or deterministic, Q, R, and N must satisfy the following conditions:

  • Q is a symmetric, positive semi-definite matrix
  • R is a symmetric, positive definite matrix
  • N satisfies the following relationship:

The following conditions also must be satisfied.

The matrix must satisfy the following relationship:

The pair is detectable, and the pair is stabilizable.

where the following definitions apply:

The matrix is the full-rank factorization of the matrix , such that and .

The matrix is the full-rank factorization of the matrix , such that and .

Discretized Kalman Gain

These instances convert the A, B, C, and D matrices using the numerical integration method as proposed by Van Loan. Refer to the following sources for more information about this method.

  • G.F. Franklin, J.D. Powell, and M. Workman, Digital Control of Dynamic Systems, 3rd ed. Menlo Park, CA: Addison Wesley, 1997.
  • C.F.V. Loan, "Computing integrals involving the matrix exponential," IEEE Transactions on Automatic Control, vol. 23, no. 3, pp. 395–404, June 1978.

Delay Support

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.