Average an Analog Signal

DaveMac

Member
Join Date
May 2003
Location
South Carolina
Posts
34
I have a Banner LT3 laser sending 4-20ma signal to a Compact Logix System. The signal is the level of product on a conveyor. The signal is fast, too fast. I also have odd shapes within the product stream therefore I want to display an average. Using Logix5000 what would be some methods. This is supposedly a great product for this type of thing lets see. I am thinking that a FFL is the way to go but have never used it. Do you have to have a FFU too? Lets say Bed Level is B1Level_1 and the FIFO is B1_BL_FIFO. OK that’s all I know.


Thanks
 
I've never worked with CompactLogix, so maybe it doesn't support certain Logix5000 functions or maybe it doesn't support block programming, I don't know. But if it does support all Logix5000 functions and block programming, it sounds like the MAVE function is what you want.
 
Omron analogue cards have an average reading value built in up to an average of 16 reads. I am not sure if Compact Logix has this or not.
Maybe worth checking.


You can code it easily enough. Use a timer of specfic time and each time it cycles, use a differentiated up trigger to add the value at the time into a register. Also use the timer cycle into a counter set for say 10 reads. When the counter counts down. use the counter output to divide the value in the add register by 10 (or whatever value you have in the counter). This way the timer and counter are adjustable until you achieve the results you require.
 
Don't use a preset timer, simply use processor scan time. I prefer this method for all of my fast moving analog signals. I can vary the number of samples by changing the counter preset.

I have included a jpg for you as example. Haven't tried to insert a LADDER in these post and don't want to type it all out.

convlvl_ave.jpg
 
? maybe this requires more thought.

Why not get data every scan instead of every other?

What about overflow and the limit that place on the number of data points to be averaged? What if the analog inputs are 16 bit inputs?

Why not make the AveragedValue valid every scan instead of 1 out of 10 scans?

How can a FIFO be used to average data every scan?

Why not mulitply by .1 instead of divide by 10? Is it the same? Are you sure?

Just stirring the muddy waters. :)

BTW David, I like the prefixes in front of the variable that indicate the data type.
 
Peter,
"Why not get data every scan instead of every other? " It does...assuming the data is updated from the analog card, otherwise the same value as rcv'd on last scan is added.. Let's not go there and confuse DaveMac with plc scan rate vs analog update times

"What about overflow and the limit that place on the number of data points to be averaged? What if the analog inputs are 16 bit inputs? " Creating the tags as 'floaters' handles 16 bit pretty well, 'double ints' do too, and limit is covered by the # entered into the counter preset. I have never ran into an overflow so I can't answer that one

"Why not make the AveragedValue valid every scan instead of 1 out of 10 scans? " I use that also for a rolling average and this could be used by minor mods to prevent clearing of counter, doing the average every scan once initial count has been reached, etc..


"How can a FIFO be used to average data every scan? " It can be done but not worth effort in MHO. I try to stay with the K.I.S.S. method whenever possible!

"Why not mulitply by .1 instead of divide by 10? Is it the same? Are you sure? " Since I can vary the value of the counter preset... I don't want to hard code the divide or make it a multiply

"Just stirring the muddy waters. " Me too so please, carry on. If it gets muddy enough, you can actually appear to walk on it...... (at least to the customers ;) )

"BTW David, I like the prefixes in front of the variable that indicate the data type " It's a standard that one of my customers used and it REALLY makes life easy. BTW, place a "g" in front of globals to make them stand out in a program. PM me and I will email you a copy of the naming convention...
 

Similar Topics

Hi all-- I need to create code in a Micrologix 1400 project that requires minimum, maximum and running average calculated values (Flows and...
Replies
17
Views
3,744
First off, I'm very rusty at the moment when it comes to programming, last time I did any programming was 15 years ago, and now this project has...
Replies
18
Views
7,202
Hello, I'd like to obtain average of my analog input value which will be displayed on SCADA. For examplle, analog value should be sampled avery...
Replies
2
Views
2,126
hi I have to take average of my analog input data from analog input module FX 2N-2AD using with FX1N plc. As I cant treat REAL NUMBERS in FX1N...
Replies
0
Views
2,036
Hi I am trying to find out , how to get an average of an analog input for 24 hours. I am interest to know the average of analog input value for...
Replies
6
Views
7,044
Back
Top Bottom