Smoothing Analog Inputs

damica1

Member
Join Date
Aug 2015
Location
Illinois
Posts
839
Mickey has posted a formula for doing this that a lot of people seem to make use of.

Could somebody please give a simple "Ladder" diagram as to how this gets done. (I understand the formula but don't know how to make it work with "Ladder".)

Thanks

I have some low end temperature 4-20ma (12 bit) sensors that bounce 20 degrees. These are not critical but would like to get a more stable readout.

FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-.99) The smaller the number the more dampening.
NV= New Value

Filtered Value= Filtered Value+Constant*(New Value-Filtered Value)

New Value = Unfiltered Value

Constant= 0.00-.99 The smaller the number the more damping.
 
Something similar I gave to our electricians last year, and did a text email for the ladder logic..

"This I did in 2 rungs on PLC5, using a 20/80 ratio

Variables: (addresses are examples)

New Analog sample N7:0
Stored Analog sample N7:1
Timer 1 T4:0
Analog sampled calculation 1 N7:2
Analog sampled calculation 2 N7:3
Analog sampled calculation 3 N7:4


Rung 1
XIO, T4:0.dn………………………………….TON, T4:0, .01, 100, 0 (self-running 1 second timer)

Rung 2
XIC, T4:0.dn
|…………………………………MUL,N7:0, 20, N7:2
|……………………………….MUL, N7:1, 80, N7:3
|……………………..……….ADD, N7:2, N7:3, N7:4
|……………………………… DIV, N7:4, 100, N7:1

And N7:1 is the one that you want to use for display, as that should be a smoother value than your actual signal at N7:0"

Try that and vary the values 20/80 to change the smoothing..
 
Hello,

I would like to ask a couple of questions regarding the analog smoothing formula provided by Mickey.

I saw the ladder code provided but since i am using a ML1100 (its what i have) i don't have the compute function. i wrote out the formula using math instructions but when i run it, the filtered value is always equal to the new value. obviously i am doing something wrong as i have seen that many have used this with great success. I have attached my ladder I hope somebody can point me into the right direction.

thanks
Ricardo L.
 
I see nothing wrong with your logic.

The problem is you are dealing with very small numbers in the example you are showing.

The best way to see if the filter is working is to create a trend monitoring the raw value vs the filtered value.

Then play with the filter constant ( .1 ,maybe try .001 first)

Edit: What is the first "ADD" instruction for (F8:10 +F8:0)?
 
Last edited:
Thanks Mickey,

I appreciate your response. The first "add" instruction is for adding an offset to the input value.

can you provide a bit more info where you say

The best way to see if the filter is working is to create a trend monitoring the raw value vs the filtered value.

do you mean to use the raw analog input value as the input in the filter then scale the filtered value whatever units i want to see?

Ricardo L.
 
Thanks Mickey,

do you mean to use the raw analog input value as the input in the filter then scale the filtered value whatever units i want to see?

Ricardo L.

No. See link below to create a trend (strip chart). It says it's for RSLogix5 but it's the same for RSLogix500.

Just drop the raw value and the filtered value into the trend.

https://www.youtube.com/watch?v=x-zJsHASh04
 
Hello Mickey,

sorry, i now understand what you meant. i created a trend and i do see the smoothing out of the signal. the signal i am looking at right now does not have much variation. I was working with a TC signal that was jumping around 2-5 degrees (i think it was a grounding problem that was causing the variations) so i wanted to see how it would smooth out that type of swing. I will try to find an input signal with a greater variation so i can test the filter.

thank you
Ricardo L.
 

Similar Topics

Hello, I'm pretty new to RSLogix 500. I'm trying to smooth out the raw analog input. Current 4-20ma. I'm in an environment that I can not control...
Replies
5
Views
2,918
Hello, I am using a P1000 CPU (P1-540) with a P1-04DAL-2 and a P1-04ADL-2 I tried doing a data transfer now I am trying to scale them both...
Replies
0
Views
1,101
Good Morning, So i have attached some really crude programming to try and work around my inability to smooth an anlog signal (actually several)...
Replies
22
Views
8,522
I am trying to make an input less jumpy. The monitored input has large spikes, and changes too fast. I am trying to smooth it out. I am using...
Replies
2
Views
2,117
Good morning guys, So i know this is extremely basic, but im just starting our with analog signals and trying to wrap my head around it. I...
Replies
10
Views
4,286
Back
Top Bottom