Compare TimeStamp with WallClockTime

MHammer

Member
Join Date
Sep 2017
Location
Midjutland, Denmark
Posts
20
Hi. I hope you could give me some advise here.



I'm ongoing with a project which has many plates that are glued individual and put into a storage shelf. When a part is glued and put into storage, it has to stay for drying for at least 2 hours and max 48 hours.

There's been made an UDT with a TimeStamp, Position, Size etc. but I need to make a function that can*compare the PartTimeStamp with the actual time in the PLC(WallClockTime). I've made an GSV function that collects the current time when a scan is done.

I've come up with an solution that works if the part is made and dried up within a month. But if the part is made in the end of one month and dry in the next, my algorithm won't add up correctly (i.e. 12AM 02/31/2018 to 12AM 03/02/2018).



Is there a compare function that would handle the issue as I've written?



Thanks

//MHammer
 
Last edited:
Well, You could instead save PartTimeStamp as total seconds from the epoch and compare that value to WallClockTime as total seconds from the epoch.

Check out answer 52347 on the RA knowledgebase, AOI written by one of the forum members.
 
Well, You could instead save PartTimeStamp as total seconds from the epoch and compare that value to WallClockTime as total seconds from the epoch.

Check out answer 52347 on the RA knowledgebase, AOI written by one of the forum members.


Thanks you two. I will look into your answers and report back if I get it working.

//Hammer
 
As far as I know this AOI is based on 24 hour format.

I had encoutered an error that meant if the difference between PLC_Time and Stamp_Time was under 24H it added 24 hours to the total elapsed time, thus showing an incorrect value.

In the AOI in RUNG 19 I've put an OTE[Hour_Hold_Latch] between the LES & SUB function. Further down in RUNG 20 I've merged a BRANCH after the TEMPORARY DAYS COUNT with a XIO[Hour_Hold_Latch] in the top and a XIC[Hour_Hold_Latch] with the SUB[Day_Juliand_Hold SUB 1 DEST Day_Julian_Hold].

Hope it would be helpfull for some in the future :)

//Hammer
 
I had encoutered an error that meant if the difference between PLC_Time and Stamp_Time was under 24H it added 24 hours to the total elapsed time, thus showing an incorrect value.

In the AOI in RUNG 19 I've put an OTE[Hour_Hold_Latch] between the LES & SUB function. Further down in RUNG 20 I've merged a BRANCH after the TEMPORARY DAYS COUNT with a XIO[Hour_Hold_Latch] in the top and a XIC[Hour_Hold_Latch] with the SUB[Day_Juliand_Hold SUB 1 DEST Day_Julian_Hold].

Hope it would be helpfull for some in the future :)

//Hammer

I've got another update to this. In RUNG 7, there's used a DAY_PLC tag but in the STAMP section, which results in an error (value 0) when the two dates is in February resulting it comparing DAY_PLC with DAY_PLC equaling zero.

Change_DAY_PLC_to_DAY_STAMP.jpg
 
Look on the Rockwell example code site. They have a great sample with aois for comparing adding subtracting times and dates. I use it for barcodes I read that have the produced date and make sure it’s not old product.
 

Similar Topics

Help please. Im new to Omron and have a machine down. I have a compare = for barcode label scan. I've attached two pics. On the Mnemonics you can...
Replies
4
Views
600
Hi everyone! Accidentally closed it and it wont appear again. Checked and unchecked the option and seem to make no difference. Running v7.10.00...
Replies
16
Views
1,814
I'm working on an array that contains a UDT of 5 Items Array[4] DataType[0] - Part 1 - Part 2 - Part 3 - Part 4...
Replies
1
Views
814
Hi. I have 2 files where I would like to see the ladder logic differences (similar to the Rockwell compare function). I am using TISoft Siemens...
Replies
1
Views
1,228
Hello experts, I am just starting with AB programing, I have a questions regarding a compare done in an old RSlogix500 and causing me issues when...
Replies
5
Views
1,913
Back
Top Bottom