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

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
520
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
502
Hello all, I have a question in regards to RSlogix 5000. I am having issues with the program force closing when I try to make online edits. We...
Replies
0
Views
115
Greetings ... someone sent me a request for some student handsouts that I developed ... turns out that I had this hosted on my business website...
Replies
0
Views
127
Back
Top Bottom