averaging samples...slc5/03

Rob3192

Member
Join Date
Jun 2010
Location
NYC
Posts
8
I am trying to take the average of 120 samples over a 2 min period. I used indirect addressing (timer and counter combination) to fill a floating file. Now i need to average them.
i try using the compute instruction but its too many ...
thanks...
 
How about adding each sample to a "running sum" address (floating point) and when you get finished taking samples, just divide it by 120. Of course you must clear the value before you begin.
 
averaging samples

thanks for your reply...

I try creating the running sum before but had problems... when the rung was true it will execute on every scan cycle and the total was an erroneous number. i recycled the same address in the add instruction as source A and destination..
 
It sounds like your ADD instruction was staying true for multiple scans, adding the same sample over and over again.

Look into the OSR instruction.

When you take a sample, you want to use a oneshot type of instruction to perform the addition since you only want to add that number once. It is okay to have the same address as a source and destination.

If you post your code (zip it first) we can sort it out.

Paul
 

Similar Topics

Hi, I have a bit of PLC experience in Siemens and have unfortunately been blessed with working on Automation Studio and B&R which has been a big...
Replies
5
Views
1,331
The PLC code calculates oil flow rate and outputs it on D420. It is represented on the HMI as a vertical bar. Problem is that the operator says...
Replies
33
Views
4,855
Hello, I am working with a laser encoder that is providing the speed of a fiber strand to our AB 1756-L61 PLC. In order to calculate the amount...
Replies
3
Views
3,083
Hi ;Configure A1s64AD card in slot 3 is as attached. This is averaging count. my signals are coming in at channel 3 and 4. There are spiking so i...
Replies
1
Views
1,623
Hi, folks. Thanks for taking the time to read this. I need to average 5 numbers, they being an accumulated value (mSec) from a timer. My director...
Replies
19
Views
5,597
Back
Top Bottom