RSlogix 5000

muusic_man

Member
Join Date
Nov 2008
Location
Delaware
Posts
148
I've seen several examples of averaging a number on here, but can't get any to work right for me.

I have a real number from a pressure transmitter.
I want to take 1 sample per second
a total of 5 samples
Average and send to an word that is then displayed on my HMI

I see an AVE command and I tried to use it but I don't understand how the "control" value works.

Any specific help would be greatly appreciated.

Thanks in advance.
 
The Conrol value is a CONTROL Data Type. You have to create that tag and set the values of Len (number of elements to average, in your case 5) and POS (position of the array where the average starts, in ypour case 0)
For your example you can create an array of 5 DINT( DINT[4]), a tag REAL to use as dest, a Control tag and set the "Dim to vary" to 0.

For the sample per second you can create a periodic task of 1 second to fill the array with some insruction like FOR and n=n+1 position, in structured text.

Then, with the array complete the AVE function (in another task) will be calculating the average of the actual values in the array, that will be changing every 1 second.
 
Hope I'm not being obtuse here but since you've got such a small

set of data why not totalize the value once per second for five

seconds and then divide it by 5. No control words, special

function, or anything else. Just really simple math.



Good luck

(8{)} :) .)

(Yosi)
 
RSLOGIX 5000 Symbol

WEll im new in PLCS.net and im here cause i need help :) and ill help to answer questions 2 ...!

In Rslogix 5000 im trying this in structured text

Y2:= 1.0/ (1.0 + EXP(-ENT[I,2]*(VAR_EN - ENT[I,3])));

but the exp doesnt recognize its the e(x) operation ... i tried ...e((-ENT[I,2]*(VAR_EN - ENT[I,3]))); ...
...E((....
Its not XPY of course...

Well i hope somebody knows thank you
 
Try using the double asterisk, e**x.
e is not a predefined variable or language element, so you will have to use 2.718281828**x
 

Similar Topics

Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
62
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
169
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
610
First off, I'm a hobbyist-level programmer, and this program isn't controlling anything anything that could even remotely be considered "life...
Replies
18
Views
549
Back
Top Bottom