Rolling average of a DINT tag

About Kalman Filters

There are Kalman filters. This is a predictor corrector method and the Kalman gains ( corrector gains ) are computed each iteration. This is time consuming and complicated. This is too much for a PLC. In addition, a proper Kalman filter requires knowing the process noise and the measurement noise. What the Kalman filter does is weight a process prediction with the current measurement based on the noise. The sad truth is that even on the engineering forums the engineers generally don't know the process noise and the measurement noise so the 'fudge' it. Well what is the point of that?

There are static Kalman filters. Static Kalman filters assume the process noise and measurement noise don't change so the Kalman gains only need to be calculated once. It is possible to implement a static Kalman filter on a PLC BUT, what is the process noise and measurement noise.

Finally, there are alpha-beta-gamma filters. These are dumbed down Kalman filters. They aren't optimal bit neither are Kalman filters if you don't know the process and measurement noise. We implement alpha-beta-gamma filters on our newest products. The customer only needs to select a bandwidth that works for him. There is no need to know the process or measurement noise. Like the Kalman and static Kalman filter there is a predictor and corrector phase so one gets 95% of the benefit of a Kalman filter with 5% of the effort. I think that is a good bargain. There is no problem implementing an alpha-beta-gamma filter in a PLC.
http://deltamotion.com/peter/Maxima/ABG.html
 
Thank-you Peter.

I think if I can get 95% of a Kalman with an Alpha-Beta-Gamma it ought to knock spots off that "simplified" Kalman I posted above.

A lot of what I have read about A-B-G filters is in context to what I am trying to achieve... flying vehicle tracking, so it all looks promising.

Just need to find an Arduino implementation that I can include in my project, or re-code one of the several C examples scattered around the net. I could even run the above alongside an A-B-G filter and compare results.

I think if I could achieve sub-100mS updates it will be adequate for my needs, as the rest of the code is simple addition, subtraction and scaling.
 
For those of us that aren't maiths experts and can't even spell it, a little bit easier to understand example of the A-B-G filter.
I will be looking into it Versus Mahoney/Madgwick, but l think they maybe the same thing as they have similar gains to play with (the Madgwick anyway).

http://www.megamanual.com/ms2/alphabeta.htm
 
Last edited:
Dear all

I will be home alone the next 4 days and was thinking I would give the Kalman filter a chance in a Compact logix PLC, it may or may not be better that the filters I use today but just to cross it of the list I will have to give it a go :)

I have a dynamic scale, measuring weights on objects going over the scale at a certain speed, this is link to my PLC via a Hardy "HI 1769-2WS" module, now the easy way was just to use a weight controller between my scale and the PLC, but I am very allergic to process controls, that I can't see from my PLC, so...

There are a few tolls in the Hardy module, but just for kicks I will turn everything off, so i get the raw value from the load cell and work it in the PLC.

So I have one analog input to filter, I feed it into an array roughly 200 values pr. item going over the scale, I have all the time in the world to get a filtered result (4 sec) before the next item reaches the scale, the only task the PLC is receiving the analog signal and filter it.

I have the luxury of being able to send a know weight over the scale, in a somewhat normal production setup, so I will have an idea of the noise level in the process, as a starting factor for one of the variables in the Kalman filter.

The biggest task I have is to translate the documentation on the Kalman filter into something my mind can work with đź“š if anyone have done any work on this on any level, I am very interested to hear about there experience.

Cheers
 

Similar Topics

Does anyone have any logic for Allen Bradley for parts per minute, and rolling averages. Im trying to write logic for uptime / downtime /...
Replies
6
Views
5,335
Hello, I a would like to create a rolling average for a flowmeter signal. I'm quite new to Siemens Step 7 - does anyone have a FB or can paste in...
Replies
5
Views
8,973
Afternoon all, I'm working on setting up a large excel recipe table for porting updates through the Linx Gateway RTD/DDE function into my recipe...
Replies
2
Views
95
Compactlogix controller, program has 28 conveyors that use TON's to start the conveyors. The TT sounds a warning horn during start and the DN...
Replies
10
Views
482
I'm a Manufacturing Engineer with limited PLC experience and I am doing some research for our Controls Department. Does anyone have experience...
Replies
4
Views
174
Back
Top Bottom