(0)| 8/18/2010 3:53 PM | |
|
Posts: 31 Rating:
|
Hi All, At my project I use many analog inputs from various devices.. I have to filtersome of theAI's specially the loadcells. Forget about the hardware or OB issues I tried many of them I need much more stable inputs. So I wrote aSCL FB but it's not working..Ithink I must use diffrent or clone arrays to solve it..bu it's not working thisway.. Can you help me to solve this issue... The SCL FB's source is included with the message... Any Help is very valuable.. and urgent.. Thanks... AttachmentFILTER.zip (496 Downloads) |
| 8/19/2010 7:27 PM | |
|
Posts: 1742 Rating:
|
Hello, According to this link http://en.wikipedia.org/wiki/Low-pass_filterthere is a more simple formula to apply a first order filter. y[i] := α * x[i] + (1-α) * y[i-1] where - y[i] is the smoothed value - α is the smoothing factor (between 0 and 1) - x[i] is the actual analog value - y[i-1] is the smoothed value from the previous sample cycle. As you can see, you only need to store the last previous computed value, and not a complete array of old values. Because you can think that y[i-1] summarizes the past valuesin a certain way. For small values of α, y will follow slowly thevariations of x. Pay attention to vonvert values to reals before computation (required for small variations to be taken into account). In the same idea, there was an entry in the forum S7-1200 telling the same. See /tf/WW/en/Posts/47458 |
Last edited by: jklm at: 8/19/2010 7:32 PM |
|
Follow us on