LabVIEW Control Design and Simulation Module

Discrete Extended Kalman Filter Function

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

Owning Palette: Estimation Functions

Requires: Control Design and Simulation Module

Calculates the estimated states, predicted states, and estimated outputs of a discrete nonlinear stochastic state-space system. This function also calculates the Kalman gain and associated prediction error covariance matrix.

Refer to the LabVIEW Control Design User Manual for more information about using extended Kalman filters.

Details  

Dialog Box Options
Block Diagram Inputs
Block Diagram Outputs

Dialog Box Options

ParameterDescription
Polymorphic instanceSpecifies whether this function uses an External Jacobian matrix or an Internal Jacobian matrix. The default value is External Jacobian.
FeedthroughConfigures the function to be either a Direct or Indirect feedthrough function. Refer to the Details section for a description of the parameters that determine the feedthrough behavior of this function.
ParametersLists all the parameters associated with this function. Select a parameter from this list to configure the parameter. When you select a parameter, the parameter and its associated Parameter source control appear in the Parameter Information section of the configuration dialog box.
PreviewDisplays a graphical preview, if available, of the function output or configuration.
Parameter InformationContains the parameters you can configure for this function. You must select a parameter from the Parameters list to make that parameter and its associated Parameter source control visible in the Parameter Information section of the configuration dialog box.
Parameter sourceSpecifies whether you configure this parameter using the Configuration Dialog Box or a Terminal on the simulation diagram. The default value is Configuration Dialog Box. If you select Terminal, LabVIEW displays an input for that parameter on the simulation diagram, and you can wire values to that input to configure this function programmatically. If you select Configuration Dialog Box, LabVIEW removes that input from the simulation diagram. You then must set the value for this parameter inside the configuration dialog box.
JacobiansSpecifies a reference to the Jacobian matrix that the extended Kalman filter uses to estimate the states of the model. This parameter is available only if you select External Jacobian from the Polymorphic instance pull-down menu.

Wire a reference to a VI representing the Jacobian matrix to this input. Use the SIM Continuous Jacobians template VI or the SIM Discrete Jacobians template VI, located in the labview\templates\Control and Simulation directory, to create the Jacobian matrix.

periodSpecifies the length of the discrete time step, in seconds, of this function. If you enter a value of –1, this function inherits the discrete time step you specify for the simulation diagram. Otherwise, the value of period must be a multiple of the discrete time step you specify for the simulation diagram. The default value of period is -1.
dataSpecifies a reference to any external data that the plant model requires. This parameter is a variant. Use the To Variant function to convert LabVIEW data to variant data.
Initialize?Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
Initial Estimation Error Covariance P(0|-1)Initial Estimation Error Covariance P(0|-1) specifies the initial covariance of the estimation error associated with the Initial State Estimate xhat(0|-1). The default value is 1.
Initial State Estimate xhat(0|–1)Specifies the initial states from which this function begins estimating the model states. The default value of Initial State Estimate xhat(0|-1) is 1.
skewSpecifies the length of time by which you want to delay the execution of this function. The default value is 0.
Noise ModelSpecifies a mathematical representation of the noise model of a stochastic state-space model. You can create a noise model using the CD Construct Noise Model VI.
  • E{w}—Specifies the expected value or mean of the process noise vector. The default is 0.
  • Q—Specifies the covariance matrix of the process noise vector. The default is 0.01.
  • E{v}—Specifies the expected value or mean of the measurement noise vector. The default is 0.
  • R—Specifies the covariance matrix of the measurement noise vector. The default is 0.1.
  • N—Specifies the cross-covariance matrix between the process noise vector and the measurement noise vector. If the noise vectors w and v are uncorrelated, N is a matrix of zeros. The default is 0.
Jacobian OrderSpecifies the order of the Jacobian matrix. This parameter is available only if you select Internal Jacobian from the Polymorphic instance pull-down menu.

Block Diagram Inputs

ParameterDescription
JacobiansSpecifies a reference to the Jacobian matrix that the extended Kalman filter uses to estimate the states of the model. This parameter is available only if you select External Jacobian from the Polymorphic instance pull-down menu.

Wire a reference to a VI representing the Jacobian matrix to this input. Use the SIM Continuous Jacobians template VI or the SIM Discrete Jacobians template VI, located in the labview\templates\Control and Simulation directory, to create the Jacobian matrix.

periodSpecifies the length of the discrete time step, in seconds, of this function. If you enter a value of –1, this function inherits the discrete time step you specify for the simulation diagram. Otherwise, the value of period must be a multiple of the discrete time step you specify for the simulation diagram. The default value of period is -1.
dataSpecifies a reference to any external data that the plant model requires. This parameter is a variant. Use the To Variant function to convert LabVIEW data to variant data.
Initialize?Specifies whether to restart the calculation from any initial values you provide. The default is FALSE.
Initial Estimation Error Covariance P(0|-1)Initial Estimation Error Covariance P(0|-1) specifies the initial covariance of the estimation error associated with the Initial State Estimate xhat(0|-1). The default value is 1.
Initial State Estimate xhat(0|–1)Specifies the initial states from which this function begins estimating the model states. The default value of Initial State Estimate xhat(0|-1) is 1.
skewSpecifies the length of time by which you want to delay the execution of this function. The default value is 0.
Noise ModelSpecifies a mathematical representation of the noise model of a stochastic state-space model. You can create a noise model using the CD Construct Noise Model VI.
  • E{w}—Specifies the expected value or mean of the process noise vector. The default is 0.
  • Q—Specifies the covariance matrix of the process noise vector. The default is 0.01.
  • E{v}—Specifies the expected value or mean of the measurement noise vector. The default is 0.
  • R—Specifies the covariance matrix of the measurement noise vector. The default is 0.1.
  • N—Specifies the cross-covariance matrix between the process noise vector and the measurement noise vector. If the noise vectors w and v are uncorrelated, N is a matrix of zeros. The default is 0.
Output y(k)Specifies measurements made on the Plant Model.
input u(k)Specifies the control action this function applies to the model. If you specify a vector of zeros for input u(k), this function does not apply a control action.
Plant ModelSpecifies the plant model whose states you want to estimate.

Wire a reference to a VI representing the plant model to this input. Use the SIM Continuous Nonlinear Plant Model template VI or the SIM Discrete Nonlinear Plant Model template VI, located in the labview\templates\Control and Simulation directory, to create a plant model.

Jacobian OrderSpecifies the order of the Jacobian matrix. This parameter is available only if you select Internal Jacobian from the Polymorphic instance pull-down menu.

Block Diagram Outputs

ParameterDescription
Estimated Output yhat(k)Returns the estimated output of the Plant Model at time k.
Corrected State Estimate xhat(k|k)Returns the corrected Kalman state estimate at time k, given all measurements up to and including time k.
Predicted State Estimate xhat(k+1|k)Returns the predicted state estimate for the next time step k + 1, given all measurements up to and including time k. The length of this vector is equal to the number of model states.
Kalman Filter Gain M(k)Returns the Kalman filtered gain matrix this function uses to calculate the Corrected State Estimate xhat(k|k).
Prediction Error Covariance P(k+1|k)Returns the covariance matrix of the estimation error associated with the Predicted State Estimate xhat(k+1|k), given all measurements up to and including time k.

Discrete Extended Kalman Filter Details

Feedthrough Behavior

The instance you select in the Feedthrough pull-down menu determines the feedthrough behavior of this function.

The following input/output pairs have indirect feedthrough behavior:

  • input u(k)Corrected State Estimate xhat(k|k)
  • input u(k)Predicted State Estimate xhat(k+1|k)

The remaining input/output pairs have direct feedthrough behavior.

Refer to the LabVIEW Control Design User Manual for more information about the calculations this function performs.

Log in to get a better experience