.Modelica_LinearSystems2.WorkInProgress.DiscreteStateSpace.Design.EKF

Information

Syntax

(x_est, y_est, M, K) = DiscreteStateSpace.Design.EKF(x_pre, u_pre, y, M_pre, Q, R, Ts)

Description

Function EKF computes one recursion of the Kalman filter or the extended Kalman filter equations respectively, i.e updating the Riccati difference equation and the Kalman filter gain and correction of the predicted state.

The system functions are defined in function ekfFunction(), which is to provide by the user. Matrices A_k and C_k are the Jacobians F_x and H_x of the system equations f and h

x_k = f(x_k-1, u_k-1)
y_k = h(x_k, u_k)

i.e., in the case of linear systems the system matrix A and the output matrix C.

Interface

function EKF
  import Modelica;
  import Modelica_LinearSystems2;
  import Modelica_LinearSystems2.WorkInProgress.DiscreteStateSpace;
  import Modelica_LinearSystems2.Internal.StateSpace2;
  input DiscreteStateSpace.Internal.ekfSystemBase ekfFunction "Integrand function";
  input Real xpre[:] "State at instant k-1";
  input Real upre[:] "Input at instant k-1";
  input Real u[:] "Input at instant k";
  input Real y[:] "Output at instant k";
  input Real Mpre[size(xpre, 1), size(xpre, 1)] "Solution of the discrete Riccati equation at instant k-1";
  input Real Q[size(xpre, 1), size(xpre, 1)] = identity(size(xpre, 1)) "Weighted covariance matrix of the associated process noise (F*Q*F')";
  input Real R[size(y, 1), size(y, 1)] = identity(size(y, 1)) "Covariance matrix of the measurement noise";
  input Modelica.Units.SI.Time Ts "Sample time";
  output Real x_est[size(xpre, 1)] "Estimated state vector";
  output Real y_est[size(y, 1)] "Estimated output";
  output Real M[size(Mpre, 1), size(Mpre, 1)] "Solution of the discrete Riccati equation";
  output Real K[size(xpre, 1), size(y, 1)] "Kalman filter gain matrix";
  output Real x_cont[size(xpre, 1)] "Value of continuous state";
  output Real y_cont[size(y, 1)] "Value of continuous output";
end EKF;

Revisions

Date Author Comment
2010-06-11 Marcus Baur, DLR-RM Realization

Generated at 2024-04-27T18:15:52Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos