Sign in to follow this  
Followers 0
MHammer

Compare TimeStamp with WallClockTime

2 posts in this topic

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

Share this post


Link to post
Share on other sites

I think you're going to have to roll your own. You might do something like what Excel does and "normalize" your date/time readings to a common starting point, like January 1 2018, and store the time as how many hours since Jan 1 2018. Or pick some other base date/time. Your code will have to account for leap years and will have to know how many days are in each month. I did something like that in a SLC 5/04 once to calculate the Julian date (basically the day of the year). It's been a LONG time since I messed with it, though. I think the last time I tinkered with something like that it was in an HMI (Red Lion G3 series) so that won't help you much.

This might be something that you can roll into an add-on instruction, just pass it 2 dates as DINT[7] arrays and have it return the elapsed time between them.  Hmmmm.....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0