EKF – Extended (nonlinear) Kalman filter
Block SymbolLicensing group: MODEL
Function Description
The block implements a nonlinear state estimator known as Extended
Kalman filter. The goal is to provide estimates of unmeasurable state
quantities of a nonlinear dynamic system described by a state space model
for a continuous-time
case and
for the case of a discrete-time system. The variables
are the process
and observation noises which are both assumed to be zero mean multivariate Gaussian processes with
covariance
and
specified in the block parameters. The Extended Kalman filter is the nonlinear version of the
Kalman filter which linearizes the state and output equations about the current working point.
It is a predictor-corrector type algorithm which switches between open-loop prediction using
the state equation and correction of the estimates by directly measured output quantities. The
measurements can be supplied to the filter non-equidistantly in an arbitrary execution period
of the block.
The prediction step is run in each execution period and solves the state equation by numerical integration, starting from an initial value and initial covariance . Various numerical methods, chosen by the user specified parameter , are available to perform the integration of the vector state differential equation. A special choice of signalizes the discrete-time system case for which the numerical integration reduces to simple evaluation of the recursive formula given by the first-order difference equation in . Apart from the state vector, also its covariance matrix is propagated in time, capturing the uncertainty of the estimates in the form of their (co)variances. Please refer to the documentation of the NSSM block for more details about the available numerical integration algorithms.
The filtering correction step takes place whenever the input of the block is set to . This signalizes that new vector of measurements is available at the input and it is used to correct the state and its covariance estimates from the prediction step. Multiple right sides of the output equation can be implemented in the cooperating REXLANG block. This may be useful e.g. for systems equipped with various sensors providing their data asynchronously to each other (and with respect to the block execution times) with different sampling periods. For the setting , the user algorithm signalizes no output data available in the current execution period, forcing the filter to extrapolate the state estimates by performing the prediction step only.
The Extended Kalman filter is generally not an optimal filter in the sense of minimization of the mean-squared error of the obtained state estimates. However, it provides modest performance for sufficiently smooth nonlinear systems and is considered to be a de facto standard solution for nonlinear estimation. A special case is obtained by setting linear state and output equations in the cooperating REXLANG block. This case leads to standard linear Kalman filter which is stochastically optimal for the formulated state estimation problem.
Inputs
funcRef | Cooperating REXLANG block reference | Reference |
u | Input vector of the model | Reference |
z | Output (mesurement) vector of the model | Reference |
nz | Index of the actual output vector set 1 | Long (I32) |
Qk | State noise covariance matrix | Reference |
Rk | Output noise covariance matrix | Reference |
RST | Block reset | Bool |
HLD | Hold | Bool |
x0 | Initial state vector | Reference |
P0 | Initial covariance matrix | Reference |
Parameters
nmax | Allocated size of output matrix (total number of items) 5 10000 20 | Long (I32) |
solver | Numeric integration method 2 | Long (I32) |
|
|
|
Outputs
x | Model state vector | Reference |
P | Model state covariance matrix | Reference |
trP | Trace of model state covariance matrix | Reference |
cmd | Cooperating REXLANG block requested function | Long (I32) |
f | Vector reference set by cooperating REXLANG block | Reference |
df | Matrix reference set by cooperating REXLANG block | Reference |
err | Error code (0 is OK, see SystemLog for details) | Long (I32) |
[Previous] [Back to top] [Up] [Next]
2023 © REX Controls s.r.o., www.rexygen.com