Instruction for pulling 2 hour old data RSlogix

remullis

Member
Join Date
Oct 2012
Location
Georgia
Posts
179
I am needing to capture weight of a bin 2 hours prior to actual time. Is there and instruction that does this in RSlogix. Thanks in advance.

Rich
 
I found the DEDT instruction but looking at how this is used I would need to create a Storage Array of 25993 which doesn't seem practical. Given that I need to sample back two hours which is 7200 seconds / .277 which my delta T = 25993. If this is correct how would it affect memory the system with this size of an array and first is this the best way to grab this data. I blindly setup a 120 array tag but my data is not accurate its still at the real time weight.

Thanks
Rich
 
RSLogix 500 or 5000?

How often do you need to sample the data?

If you only need once a minute (for examples sake) then you could have a 60 second recycling timer where the .DN bit loads the current bin weight to a FIFO buffer (look at FFL and FFU instructions) with a length of 120.

This buffer will then hold the last 120 samples (from the previous 2 hours) in it.
 
If you need to be able to at any point gather data from 2 hours ago, you're going to have to be storing at least two hours worth of data somewhere at all times. As brendan said, first you need to work out how often you need to sample and record the weight; the more often you sample it the more storage you're going to need.

The simplest way is probably what brendan suggested above with the FIFO buffer, but if you're sampling too frequently and the amount of data storage required becomes impractical, you may need to investigate exporting the data to an excel spreadsheet or SQL database, and importing it back in on demand.
 
I could sample every minute that would not be a problem. I just need that instant weight exactly 2 hours previous and show it in wonder ware. Every minute update would be fine. I'll have to read up on the fifo buffers . thanks rich
 
I think the simplest way to store and retrieve the data would be by using the COP Instruction. First Create a Storage Array for a length of 121. This gives you 0-120. Then, every minute MOV your current reading into Array[120] and then COP Array[1] to Array[0] For a Length of 120. This will copy 1-120 and Paste results in 0-119. That way your 2 hour old data will always be in word 0. So,Then you just need to Display Array[0] in Wonderware.
 
Thanks for all the suggestions I'm gonna work through both methods just to get the practice of setting these up. I've never used FFL/FFU instructions and have limited experience with Storage Arrays. I may have questions as I go. Thanks Rich
 
I think the simplest way to store and retrieve the data would be by using the COP Instruction. First Create a Storage Array for a length of 121. This gives you 0-120. Then, every minute MOV your current reading into Array[120] and then COP Array[1] to Array[0] For a Length of 120. This will copy 1-120 and Paste results in 0-119. That way your 2 hour old data will always be in word 0. So,Then you just need to Display Array[0] in Wonderware.

You need to do the COP before you move the new data into the end of the buffer array. I would also use CPS, so that the array "shift" can't be interrupted by anything else, such as the SOTS (System Overhead Time-Slice).

CPS Array[1] Array[0] 120
MOV NewData Array[120]


Also, you can put this code into a Periodic Task, set to trigger every 120 secs, there's no need to scan a timer every scan.... Give the task the highest priority, and it will trigger exactly every 120 seconds, to the microsecond... (you did say you wanted exactly 2 hour old data....).

Do not be concerned about memory usage, even if this were floating point (REAL) array data, it would still only "use" 121 words of data memory, plus the minimal amount of program memory for the 2 instructions. That's a drop in the ocean for a Logix5000 controller.
 
Here ya go:

You will have to create your own minute timer using GSV (class name: WALLCLOCKTIME), but it will be pretty darn accurate.

The first rung creates the oneshot "NewMinute" and stores the current minute in "NewMinute" (creating the oneshot effect), and incrementes a counter. The counter is just used to provide test data.

The next rung loads and once full, unloads the FIFO (unloads it into "MyData").

Two Hour Delay.jpg
 
Also, you can put this code into a Periodic Task, set to trigger every 120 secs, there's no need to scan a timer every scan.... Give the task the highest priority, and it will trigger exactly every 120 seconds, to the microsecond... (you did say you wanted exactly 2 hour old data....).

Daba - did you have the length of the array stuck in your head?
 
Rich,
You do not Copy before Move. If you do then you will get a double entry.

New Data Moved into Array[120] will be shifted by the copy to Array[119]. Array[120] will still have the Data that was Moved into it.

You have to Move new data into Array[120] which overwrites the old data that was shifted to Array[119].

Array[120] is for New Data Entry Only!

Array[0]-[119] Contains the past 120 minutes of Data Entries.
 
Last edited:
I have attached the logic that I done so far, as you can see I am not getting the actual data back 120 minutes ago its almost as if its updating every minute data. By trending the data back 2 hours I should have been getting about 4000lbs and 2 hrs later reading the current weight of 50k or so. So My objective is the get a run rate based on a solid 2 hours of filling these bins.

BinWtCurrent - BinWt 2hr Prior *24/ 2 gives the hourly.

What am I missing on this?

PS. The timer is done as a function block and is temporary until I can get this other logic working.

Thanks
Rich

2hr old weight.jpg
 
Attached is the Trend for the bin with the red bar being back 2 hours from current time which is the blue line at the very right end of the chart. 2hrs prior we were at 10k lbs and now at 60k. I want to grab that 2hr earlier data.

QCbinTrend.jpg
 

Similar Topics

I'm trying to dig to the source of a minor "recoverable" system fault throwing a fault light on a machine that has been confusing my operator...
Replies
3
Views
83
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
93
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
116
Hello All, Was hoping I could get a little help with Modicon ladder logic. This is the first time I have seen Modicon logic and currently trying...
Replies
6
Views
266
Hello all, I am currently trying to establish a message instruction to pass data from a 1756-L73 to a 1756-L71. My communication path from the...
Replies
8
Views
353
Back
Top Bottom