Analog filter

The Plc Kid

Member
Join Date
Feb 2009
Location
Macon, Georgia
Posts
3,233
I am in a real jam. Can someone help me setup a very simple filter for a analog input in a slc 5/04 the module is a flex i/o 1794-IE8. I have the value coming into the panelview i just need to average it or something to smooth it a little but i don't see a simple way to do it. Any ideas for a quick and dirty sloution?
 
I don't understand how that works? Lokks like it would just be adding a constant value to my signal?

signal is a shaft driven speed which changes quite a bit.
 
The formula is taking the new value ( snap shot of the unfiltered value)
then you subtract the filtered value from that new value. "C" is a multiplier that takes a portion of the difference ( New Value(unfiltered)minus the filtered value and adds it the the filtered value. Giving you an updated filtered value.

Plug some numbers in the formula it will become clearer what the formula is doing.

Better yet, program it into your SLC and then create a trend. Then watch what various constant values will do for you.
 
Last edited:
I don't understand how that works? Lokks like it would just be adding a constant value to my signal?

signal is a shaft driven speed which changes quite a bit.

Example:
FV from last Scan was 95.0
This Scan your analog input is 99.0

99.0-95.0 = 4.0

Multiply 4.0 by the constant, for this example, constant =0.75

So we take 4.0 * .75 = 3 and add this to the FV.

So FV is 98.0

next scan, analog input is 91.0

difference is -7
* C = -5.25
98 + (-5.25) = 92.75
FV= 92.75

See???
 
It depends on where you set the constant. Basically, it just limits how much change from the raw signal is applied to the result each scan. If you have the constant set at 0.25 for example, and applied a new signal that did not change for four scans, the filtered signal would then become equal to the the raw signal.

I agree with Mickey and suggest you try the code with some spare addresses, and then trend the raw signal against the filtered one to get a visual idea how it affects the responsiveness as you adjust the constant.

Paul
 
I usually use a timer to call the calculation rather than do it every scan. That allows me better control of the filtering, as I can use the weighting factor to address the degree of filtering and the time delay to compensate for slow changing or fast changing signals.

With any filtering you have a tradeoff. The more significant the filtering the less impact transients and oscilations have on the effective process measurement. The tradeoff is that the more significant the fitering greater the difference is between the current measurement and the effective process measurement and the longer it takes the effective process measurement to stabilize at the new level after a change in the process. This tradeoff is inherrent with any kind of filtering.
 
If you have the constant set at 0.25 for example, and applied a new signal that did not change for four scans, the filtered signal would then become equal to the the raw signal

How would that make the signals equal with aconstant of 0.25?

I did put it in and worked like a charm and i did trend it to see the changes but i still don't feel like i have a full understanding of it.

I know this is simple but i just still don't fully get it.
 
The Plc Kid,
Take the formula to your school and show it the your math teacher.
See if he/she can explain it for you.
 
I doubt the Math teacher would understand it either, they wouldn't know about the PLC scanning.
I used something similar eons ago with Modicon 485 just compared the input to Filtered value then added or subtracted 1.
Roy
 
I doubt the Math teacher would understand it either , they wouldn't know about the PLC scanning.
I used something similar eons ago with Modicon 485 just compared the input to Filtered value then added or subtracted 1.
Roy

You could be right. I just think the Kid is having problems with the math part of it.
 
It is basically a damper. Your input swings are dampened, they never spike as high or sink as low, due to the dampening. The filter is kind of like a shock absorber on a car. You are reducing the delta or change by the factor of the constant. If the constant is .36, you only get 36% of the change, per scan.
 

Similar Topics

Hi! I like to ask is there a way i can filter my analog input?
Replies
1
Views
1,083
I have a 4-20 ultrasonic sensor on an oil tank. I am getting spikes that I would like to get rid of. Have tried this but I get 1.#QNAN. V18, no...
Replies
28
Views
12,592
This sounds like a stupid question, but I can't find an answer anywhere. I realize that a lower filter freq on an analog input channel results in...
Replies
10
Views
3,485
I have an analog signal that has a small amount of noise. It is on an RX3I PLC and the analog in module (IC693ALG442) does not have filter...
Replies
35
Views
9,309
Hey fellas, I've got some Point I/O analog inputs (1734-IE8C) that I would like to filter. FYI, this is for some flow meters. The raw...
Replies
9
Views
7,338
Back
Top Bottom