You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 30th, 2018, 09:08 AM   #1
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Compare TimeStamp with WallClockTime

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
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.

Last edited by MHammer; January 30th, 2018 at 09:25 AM.
  Reply With Quote
Old January 30th, 2018, 09:21 AM   #2
Dravik
Member
United States

Dravik is offline
 
Join Date: Jun 2008
Location: New York
Posts: 1,316
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.
  Reply With Quote
Old January 30th, 2018, 09:34 AM   #3
widelto
Member
Colombia

widelto is online now
 
widelto's Avatar
 
Join Date: Jul 2005
Location: barranquilla
Posts: 2,537
You can use elapsed time Add On Instruction from here:
http://search.rockwellautomation.com...elapsed%20time
__________________
My two cents.
  Reply With Quote
Old January 30th, 2018, 09:39 AM   #4
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Quote:
Originally Posted by Dravik View Post
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.
Quote:
Originally Posted by widelto View Post
You can use elapsed time Add On Instruction from here:
http://search.rockwellautomation.com...elapsed%20time
Thanks you two. I will look into your answers and report back if I get it working.

//Hammer
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old January 31st, 2018, 02:23 AM   #5
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Thanks to both of you. I was able to use the "Elasped Time Add-on Instruction" from the link widelto provided.

Filename: 69416

//Hammer
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old January 31st, 2018, 04:53 AM   #6
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Do you by any chance know if the AOI I used is based on a 24Hour clock or 12Hour?
The PLC is located in EU with the 24Hour clock.
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old January 31st, 2018, 07:06 AM   #7
widelto
Member
Colombia

widelto is online now
 
widelto's Avatar
 
Join Date: Jul 2005
Location: barranquilla
Posts: 2,537
As far as I know this AOI is based on 24 hour format.
__________________
My two cents.
  Reply With Quote
Old January 31st, 2018, 10:37 AM   #8
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Talking

Quote:
Originally Posted by widelto View Post
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
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old February 21st, 2018, 02:41 AM   #9
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
Talking

Quote:
Originally Posted by MHammer View Post
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.
Attached Images
File Type: jpg Change_DAY_PLC_to_DAY_STAMP.jpg (35.1 KB, 25 views)
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old February 21st, 2018, 02:45 AM   #10
MHammer
Member
Denmark

MHammer is offline
 
MHammer's Avatar
 
Join Date: Sep 2017
Location: Midjutland, Denmark
Posts: 20
In addition to #8
Attached Images
File Type: jpg Change_hour_latch.jpg (35.1 KB, 26 views)
__________________
Helpful? Rate it.
Solved? Post it.
Idiot? Shut up.
  Reply With Quote
Old February 22nd, 2018, 12:00 AM   #11
JaxGTO
Member
United States

JaxGTO is offline
 
Join Date: Apr 2009
Location: Kalieefornia
Posts: 569
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Logix Designer Compare Tool error message taylor1982 LIVE PLC Questions And Answers 6 January 16th, 2017 04:28 PM
Logix compare tool phuz LIVE PLC Questions And Answers 1 March 30th, 2016 08:45 AM
ControlLogix alarm timestamp passed to kepserver Hal9000 LIVE PLC Questions And Answers 0 August 26th, 2013 06:17 AM
Allen Bradley WALLCLOCKTIME Compare pr_wainwright LIVE PLC Questions And Answers 12 September 12th, 2011 11:33 AM
Compare in STL S7 Combo LIVE PLC Questions And Answers 2 January 10th, 2008 06:26 AM


All times are GMT -5. The time now is 09:23 AM.


.