Grabbing a Baseline Value using RLL in Studio 5000

DavidFogle

Member
Join Date
May 2020
Location
South Carolina
Posts
10
I'm looking at trying to program Relay Ladder Logic to average out a value for X amount of time.

In this application I'm looking to have an output set at 30% over "Value X". I want value X to be set by taking 15-30 seconds of live data and averaging out the data.

I was wondering how I would attempt to set this up in Relay Ladder Logic. Currently I was considering Having 5 Timers set for 5 seconds each and while each timer was running write the measurement value to a tag. Then after the 25 seconds I would average out the 5 values I'm left with and set that as my Value X.

Is this the a feasible way to approach this application?

Thanks,

David
 
Perhaps use one timer, move the values into a shift register of x number of readings then add them all up & divide by the number of shifts. So for example, you shift the value into a shift register every 5 seconds with a shift register of 5 words long, add them up & divide by 5 you have an average over the 25 seconds. Caveats: when you start the average value would be based on the values in the shift register either from the initial start up of all registers at 0 or if the system has been powered down then the values would be as per last run and not reflect current situation. Some PLC's have an average function built in.
 
Perhaps use one timer, move the values into a shift register of x number of readings then add them all up & divide by the number of shifts. So for example, you shift the value into a shift register every 5 seconds with a shift register of 5 words long, add them up & divide by 5 you have an average over the 25 seconds. Caveats: when you start the average value would be based on the values in the shift register either from the initial start up of all registers at 0 or if the system has been powered down then the values would be as per last run and not reflect current situation. Some PLC's have an average function built in.

I'm not familiar with using Shift functions. My PLC programming training was very basic covering the simple functions of RLL.
 
perhaps, you can try with one timer and and array.

Create an array, say 5 elements, and an int variable called index.

Set index to 0.

When timer is done first you will move your value into array[index] and then increment the index by one(ADD function).

When index is 4 or greater then move 0 to index.

It will work in a loop so in your array you will always have last five samples.

You can use AVE function to average.

Hope this helps
 
perhaps, you can try with one timer and and array.

Create an array, say 5 elements, and an int variable called index.

Set index to 0.

When timer is done first you will move your value into array[index] and then increment the index by one(ADD function).

When index is 4 or greater then move 0 to index.

It will work in a loop so in your array you will always have last five samples.

You can use AVE function to average.

Hope this helps

I looked into the array function on Studio 5000 and I'm a bit lost on how to code this using Studio. I haven't necessarily messed with Arrays any so this is all a new concept to me.

Thanks.
 
No need for a shift register. Zero a DINT register (or REAL if using fractional measurements). Add measurement in x number of times. Then divide total by x.


If you want to do it again then just zero the register and start again.
 

Similar Topics

I've got 16-bit data at address 40200 on a Schneider Scapack 350. I can grab the data over Modbus TCP using Kepware at IP 172.16.1.100. When I...
Replies
8
Views
2,480
Im trying to extract data from a process analyst object, to create custom trend controls. The object exists on a citect page and onPageShow, I...
Replies
1
Views
1,852
I am working on a Scada project where the device (a Hydrocarbon Detecting equipment) have a RS-232 port for serial interface. But you can only...
Replies
2
Views
1,683
I cannot add SLC500 analog input tag (I: 8.3) to EZSeries Touch Panel Editor (V 5.3). I used all the listed tag datatype but it all says "Invalid...
Replies
8
Views
173
I want to set user security level based on the value of a tag in my PLC called "ActiveUser". That tag will contain the A-P code which we use for...
Replies
6
Views
205
Back
Top Bottom