Best Practices

Recommended configuration approach

A nonlinear state space model for the system must be implemented in a Java class extending the class GenericSSModelImpl. Looking at an example will probably speed up the implementation time. Let the KF parameter ‘Constant gain’ be true in the beginning (this is the default value). This results in a ballistic simulation which is useful for model behavior verification. Verify that the ‘Model type’ parameter is in conjunction with your implementation. Also verify the ‘Model path’ and ‘Model’ parameters. Connect the measurements and control variables are to the correct ports.
Once confident that the model behaves correctly, the filter can be activated. Rightclick to open the properties. press the Vector tab and locate the vk-noise vector. Expand this vector to the same size as the number of states, press Apply ('Reload model' must be hooked off). In the Matrix tab, locate and insert values for the system noise matrix Ck (the identity matrix can be a good choice for starters), press Apply. Insert values for the process noise covariance matrix Vk, press Apply. Insert values for the measurement noise covariance matrix Wk, press Apply. On the Parameters tab, toggle ‘Constant gain’ to false to activate the filter.

Optimization

Once a good filter matrix K is obtained, it is possible to freeze the K matrix by setting the ‘Constant gain’ parameter to true, this will decrease the cpu load. When the KF is used to linearize a system, it by default perturbs the variables and simulates the system one step for each perturbation to obtain the linear model. This can result in heavy cpu load. In the model class (which extends GenericSSModelImpl), it is possible to compute the matrices (one or all) from analytical equations. To do this, override the methods getA(), getB() etc.. 

Pitfalls and common mistakes

An error message “Singular matrix in the Kalmanfilter” often occurs with beginners. This is usually due to not configured or wrong values in the system noise matrix Ck, the process noise covariance matrix Vk and the measurement noise covariance matrix Wk. Set the size of the vector vk-noise to the number of states, Ck will then get correct size. If changing the size of vk-noise has no effect, hook off 'Reload model' in the Parameters tab.
Instability can occur if the Kalmanfilter gain matrix, K, is too large. This is usually due to too small measurement noise covariance matrix compared to the process noise covariance matrix.