Measuring noise variances for Kalman filter


I am trying to implement a Kalman filter in a PLC system controlling a second order system. I have a question regarding estimating the noise variances. The output is normal distributed with mean 0 and standard diviation 4.87 * 10^-3, but that contains the contributions from both the process and the measurement noise. How do one practically measure these quantities?

Thanks in advance

Reply to
Simon Johan
Loading thread data ...

My experience is in motion control so you will get a motion control explanation. Usually I do a system identification. I excite the system by changing the control output and see how the actual positions vary with the control output and I get a model similar to what you are working with. The system identification will return a sum of square errors between the models estimated position and the actual ( measured ) position. I use this as the upper value for process noise since it really contains all the noise. I have found that most of the measurement noise is not electrical but rather due to quantizing non- linearities. That is an encoders feed back is in counts but not infinitely fine counts. This noise is easy to estimate. At this point it would be nice to subtract the measurement noise from the noise from the system identification and leave just the process noise but I haven't seen how that is done yet and I haven't seen this covered in the books i have

The short answer is that I use system identification but I can only use that for a upper limit on noise.

Now for the reality of it. This sound like a class room project. I have never implemented a true Kalman filter except on paper. The reason why is that my customers would ask exactly the same question you have just asked and for good reason. I have had people e-mail me and tell me that adjusting the process and measurement arrays are part of the tweaking that must be done. If that is so then why bother with calculating Q and R arrays if they are only a best guess? I have found a more practical approach is to just calculate the K gains using a desired bandwidth. Customers can relate to that and it is very easy to implement. In the end the results are the same without all the Ricatti calculations. This is called a alpha-beta-gamma (ABG) filter in the case of a second order system like yours. This is very easy to implement.

If you are only interested in what is practical then this is you lucky day. You are not the first to ask about implementing a Kalman filter on a PLC. f See the implementation on page 9/9. A PLC can do this. It will be very difficult and tedious to implement the Ricatti equation on a PLC. Don't mess with the array manipulation. Expand the equations symbolically like I did in on page 9/9. This is easy enough to do for

3x3 matrices.

Note, page 3/9 is another way of calculating the steady state Kalman gains without going through all the iterations of the Ricatti equation. I did this just to verify the results are the same. In doing so I found an error in Dan Simon's book and errata.

This implementation of a ABG is good for filtering encoder feed back for a reference roll that you might want to gear to. The PLCs forums are littered with posts asking how to filter encoder feed back to get valid velocities.

Reply to

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.