Instruction for pulling 2 hour old data RSlogix

With the unconditional rung the copy will move new data every scan. So after 120 scan cycles your array is full of the same data.

you can branch the copy below the Move

Timer.dn [ons] mov and copy
 
OK I added the ONS after the 1 minute timer interval. In the screen shot it still appears to move and store the 1 minute data instead back 120 minutes. During this screen shot I should see 40k lbs. Below the MOV I branched the COP. Timer.DN(1min)> ONS > MOV (Current Weight into array [120] > COP Array [1] Array[0].

Ive also tried the COP before the MOV . I still get data in what appears to be 1 minute old.
 
Your 120 min old data will be in Array[0]. It is now full of old data from the unconditional Copy.

Open Controller Tags, Use the monitor tab. watch the Array[121] you should new data shift once every minute. it will take 2 hours after ONS was added before the Array is Full of the Correct Data.
 
Your right, Its updating! You have been a big help with this. Now I have a little more understanding of how this data is stored. Thanks Rich.
 
If you have access to the structured text editor in logix5000 it would be pretty easy to handle this, also very efficient transaction. We do something similar to track serial numbers and status values of the parts we produce.

There are 1442 minutes in a 24 hour day. You would start out by creating an UDT array with the infor you want to capture. I can think of possibly 4 values you would need at a minimum would be a real called "weight", integer called "time", an integer called "Day" and the 4th integer called "Position Full".

Using the system clock every minute the time changes you would call up the structured text routine to add the data to the UDT array you created. In that routine you would first zero your pointer needed to scroll thru the 1443 records you are creating. Have the pointer look for a zero in the position full. When it finds the first position full register (at the pointer value) you write the weight to the .weight, the time of day in minutes to the .Time, the Julian day to the .Day and a 1 to the .Position Full. After it writes you end the routine. Each minute it will write the next weight captured to the next register with a zero in the position full and so on. Then you will need another structured routine that is used to look up the data in the array every two hours. Every minute the system clock changes you will trigger the "Lookup" routine. In that routine you will have a pointer start out a zero and scroll thru the array until it finds a value in the .Time that is 120 minutes from the current system time. When it locates the register that is two hours before it will copy the weight value from that position of the array into another tag to be used by Wonderware.
The reason I have the date as a item captured is because at midnight your system minutes will be reset back to zero so you will use that in your time calculation to find the weight between midnight and 2am only. When you write that info to wonderware you can clear that register to be refilled for the next capture. So if I understand you correctly you will be adding a weight record every minute and logging to wonderware every minute what the weight was two hours prior. The would work great and may sound confusing but its actually pretty easy with very little code. Write time and lookup time shoulb be equal to one scan (very fast).
I did something very similar this week. Our machine was already populating a 3000 record array with our specific data. Every hour I do a search for a specific part status data and find any serial numbers that have been sitting between our tester and packing station. Any serial number that was not run thru our pack station within 60 minutes would get display on HMI and our machine would lock down until we could locate the serial numbers displayed. We do this to make sure our packing/inspection station has not been skipped. Very similar to what your trying to do but we use the info for a different reason.
 
In that routine you would first zero your pointer needed to scroll thru the 1443 records you are creating.
Nice, but he only asked for and only needs 120 records, stored every 1 minute for 2 hours.
 
Then he can adjust his array size from 1443 down to 121. Everything still works the same, it was just a idea and can be setup however.
 
@rootboy - Not sure if you are unaware, but there is a DTR instruction in Logix that automagically handles generating a one shot for a change in a DINT.

Thanks, but I'll stick with the NEQ. I like simple, and it doesn't get much simpler than this.
 
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.

I am going to have to disagree with you on this MOV before COP debate.

If you put your new data into [120] and then do the COP (shift), then you have made array element [119] the same as the new entry that was put into [120]. It will appear in [0] too early.

Here's a proof, derived by reducing the size of the problem....

Assume he wants his data exactly 2 minutes old instead of 120 minutes...

You would then suggest a 3-element array, and you would...

MOV New_Data Array[2]
COP Array[1] Array[0] 2

On the first timed trigger, the new data would go into [2] and immediately get copied into [1]. It will then only take 1 more timed trigger to get that data into [0].

So there is only 1 minute between the new data being presented to the array, and it appearing in element [0] - ergo, it is not 2 minutes old, it is 1 minute old.

Now try it with COP (or CPS) before the MOV, and NewData arrives at [0] exactly 2 trigger periods later, not 1.
 
Last edited:

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
92
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
109
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
119
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
284
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
372
Back
Top Bottom