AVE Instruction

trcash2

Member
Join Date
Feb 2011
Location
Alabama
Posts
9
Good Day Everyone. I am starting a project where I want to display the average of a drives current ouptu for one cycle. Has anyone had a similiar project? Any ideas or sample code would be greatly appreciated.

Thanks in advance for all of your feedback.
 
Without knowing your plc brand, first idea that comes to my mind is to use a fifo queue, load the queue every time you decide then use the fifo values and divide then by the numer of steps.
 
I am using a Logix 5000. I was thinking down the same path. Load a set of registers then use the AVE function. I just had never used that function in Logix.
 
That's a complicated arrangement for a queue.

Here's a simpler, faster, more memory efficient method.

The data storage array FIFO is shifted downwards* by the COP, [1] to [0], [2] to [1], etc., then the new value is put into the array at [29]. Then the average is calculated.

* We use COP "backwards" like this to stop the array "filling" with the value in [0]

2011-12-21_000901.jpg
 
Nice Daba.

Trcash2 - What do you mean by "one cycle"?
How long is a cycle?
And just to be sure, you want the average current over the cycle?
Do the cycle times vary? -- If so, you will want to make the FIFO buffer big enough to handle the longest time. Also, with varying cycle times, you will want to add some logic to Daba's post above, to only average the valid samples (and ignore the empty part of the FIFO).
 

Similar Topics

I"m trying to average an array of DINT's called FIFO_ARRAY. It has 1000 elements in it. Here is what I have entered into the AVE instruction...
Replies
11
Views
4,728
I am trying to use the moving average instruction. Getting a little caught up on the details. What is the "Storage Array" and what type of tag...
Replies
2
Views
2,658
I am looking at using an AVE instruction in my application, but when I look at the instruction help, it makes no sense to me. I would just like to...
Replies
1
Views
2,938
Looking to convert a decimal value to turn on a bit eg. like the DCD instruction in 500 where it converts a 4 to 1 of 16
Replies
3
Views
3,174
Hi all, First post in this forum. I am having trouble with a moving average (MAVE) instruction on an RSLogix 5000 controller. I have very...
Replies
3
Views
6,500
Back
Top Bottom