RSLogix AVE

KLemas16!

Member
Join Date
Jun 2016
Location
NH
Posts
9
Hello again,

Looking to use an AVE block in ladder to calculate the average of 7 temperature elements in the foundation of an LNG tank. My issue is the AVE block only executes once when the rung is initiated but I want this to be continuous. Am I using the right block for my situation? If so, what would be a simple way to make this block work each scan?

I've attached an image of code. Thanks in advance for any help.

AVE.jpg
 
Is Foundation_Temperatures an array ?, Is Foundation_Temp_Ave a DINT or a real ?

You can tell by Rung #2 Foundation_Temperatures is an array of at least 7 elements....assuming the unshown prior rungs populate Foundation_Temperatures[0] to [5] in similar fashion.

But I agree....It looks like the AVE tag is a DINT...should be a REAL.
 
So I move the scaled value of each temperature into Foundation_Temperatures which is DINT[7] data type. for example:

A temperature into Foundation_Temperature[0]
B temperature into Foundation_Temperature[1]
.........
.........
G temperature into Foundation_Temperature[6]

I then use the AVE on this array Foundation_Temperature.

I added an OTU on the next rung to ControlAVE.EN but it doesn't seem to work.

Still on a learning curve coming from the DCS world. Thank you all.
 
Don't know if it's an issue, but every AVE I've ever done, I specify the Array as MyTag[0], not MyTag as you have shown. If you read the help on the AVE instruction, it specifically says "specify the first element of the group of elements to average". Since it compiles without it, though, I don't know.

Also, you might have to clear the Ctrl_AVE.POS, or at least clear the .DN bit. Not sure just clearing the .EN bit will reset the block. But the easiest is just to generate a 50ms timer and use the DN bit to reset the timer and fire the AVE block.
 
The ave instruction requires a false to true transition of the rung to trigger its operation.
The instruction determines this by the state of the EN of the control block.
Unlatching the EN bit forces the next execution of the instruction to behave like it has had a false to true transition. I think the same effect could be had by doing a RES on the control block.
 
Or just roll your averaging routine into a statement list routine and let it execute every scan.

I really prefer Statement List for any kind of math. And then, the sources of data do not have to be consecutively in an array as well.

You could even just create an AOI with the logic in statement if you like.
 
With the unlatch function, it looks like both the .EN and .DN needed to be reset. Now the block is working perfectly. Thank you all for the support.

On to the next challenge :)

Ken
 
With the unlatch function, it looks like both the .EN and .DN needed to be reset. Now the block is working perfectly. Thank you all for the support.

On to the next challenge :)

Ken

Replace the two unlatches with a single RES of the AVE control tag. This will handle all eventualities, (although I very much doubt you will ever generate the .ER bit, since your input array is DINTs, and your destination is a REAL), and it ensures the AVE instruction executes on every scan.
 
Last edited:

Similar Topics

I have a furnace and I'm wanting to calculate the average metal temp at which the furnace is tapped each day. There's no set number on the amount...
Replies
11
Views
1,258
Hello everyone! I am new to PLC programming and am using Studio 5000 to work with AB PLCs. My company uses VMware to allow me to remotely...
Replies
3
Views
1,316
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,715
Hello, Im getting aggrivated everytime Rslogix closes out I lose my Watchlist Tags.... Is there anyway to save a Tag lineup to use later??? Thanks
Replies
2
Views
2,081
I have a few projects I want to Save As file type SLC to be able to use the Translation tool in Studio 5000 (migrating from SLC 5/03 to...
Replies
3
Views
2,486
Back
Top Bottom