PCFL - Analog Input conversion?


Thread Starter

Steve Hui

Hi Everybody,

I'm working on a system that gives an analog input on which I want to average out the values over the recent history. Basically there will be a variation in the analog signal, which I want to smooth out.

I believe how I want to do this is by using the DELAY block to hold and store the previous 10 values, then use the CALC block to sum and some other math functions to average out the values...not a weighted average.

My problem is that I'm not sure how the input works really. I will have a 3x register which will store the analog data. This takes up 1 register...but in all the PCFL functions each data value is expected to take up 2 registers...so does this mean there is some kind of conversion necessary?

Should I be using the AIN function to convert the raw analog data to engineering values? since the output of the AIN function consists of 2 registers and the input of it is 1 3x register.

Does this mean then that the PCFL functions operate on engineering values and not the raw analog data as I had previously thought.

Can somebody please help me...I would greatly appreciate it.

Stephen Hui

john coppini

simply use the pcfl aver function, assuming you are using modicon 984ll with modicon plc....makes a big difference???????????????
I can't help with the specific code on your PLC, but we use logic based on the following formula to filter analog data - either on the engineering units or raw data.

Y(n) = Y(n-1) + {1/j x [X(n) - Y(n-1)]}

Y(n) is the new filtered value
Y(n-1) is the revious filtered value
j is the number of samples over which the data is averaged
X(n) is the current reading

We do this off a timer to periodically calculate the samples. By changing the time delay (frequency) and the number of samples we can adjust the filtering for various applications. The pdf file attached has the ladder logic for an AutomationDirect PLC.