FactoryTalk - DateAndTimeInteger

rtgibson

Member
Join Date
May 2012
Location
Barnsley
Posts
44
I want to take the value of this tag and add a number of minutes to it storing it in a new tag - I then want to display it in proper "dd/mm/yyyy hh:mm:ss" format - is there a way of doing this without having to resort to VBA and using DateAdd & Format etc ???
 
So what you're trying to do is display what the time will be a couple of minutes from now? Can I ask why, just for curiosity?

The only ways I know of to do the adding part are to use VBA or a PLC. Use VBA (or the PLC to add however many minutes to the minutes tag and store it back in a different tag (e.g. modified_minutes_tag). Then just create some text. You can add tag values to your text caption, so just set your text up to read "[day_tag]/[month_tag]/[year_tag] [hour_tag]:[modified_minute_tag]:[second_tag]" In the editor it'll look much longer than that because when you put a tag in it inserts the path, and decimal point parameters, etc etc. But you get the idea.
 
Although now that I think about it, you would also have to check that your minutes tag didn't get to 60, and if it did then subtract 60 and add 1 to the hours. And then likewise with hours-days, days-months, and months-years. And then you run into trouble because not every month has the same amount of days.

So at the very least, you'll probably have to allow for a modified_hours_tag and a modified_days_tag as well. I think you may be better sticking with VBA after all...

I think at this point I'd once again be stepping back and asking what you're trying to achieve here, maybe there's an easier way :)
 
Hi and thanks for your reply. Basically we have a machine that does a 'cycle' that will last for a time decided by the user x hours, x minutes and x seconds when the cycle starts we want to estimate and display to the user the date and time that the cycle will end. You are correct in that it becomes a pain in adding things together such as running over 60 secs we have to increment the minutes which opens up a world of pain for spanning into the next hour possibly day, possibly month - not all months have the same amount of days etc etc Lord forbid a leap year should play a part. So in Wonderwares Intouch there's a similar function where you can add a number of seconds to the UTC value (which starts sometime in 1970) there is then a function to convert that back to 'dd/mm/yyyy hh:mm:ss' - that's what I want to do in FactoryTalk.
 
That makes sense. Clearly, the people who designed our Roman calendar didn't take into account the difficulty they were creating for future programmers! :angr:

I've not come across a similar function to the one you describe in FTView. But somebody else here may well have :)
 
Hi and thanks for your reply. Basically we have a machine that does a 'cycle' that will last for a time decided by the user x hours, x minutes and x seconds when the cycle starts we want to estimate and display to the user the date and time that the cycle will end. You are correct in that it becomes a pain in adding things together such as running over 60 secs we have to increment the minutes which opens up a world of pain for spanning into the next hour possibly day, possibly month - not all months have the same amount of days etc etc Lord forbid a leap year should play a part. So in Wonderwares Intouch there's a similar function where you can add a number of seconds to the UTC value (which starts sometime in 1970) there is then a function to convert that back to 'dd/mm/yyyy hh:mm:ss' - that's what I want to do in FactoryTalk.

The UTC you are referring to is the # of seconds elapsed since midnight 1/1/1970 to be exact. Crimson 3.0 (Red Lion HMIs) use this value to set their clocks by. I made an AOI that converts a Controllogix date and time into UTC so the Red Lion can sync to it. Works well enough. If you had a similar value in your PLC, you could add the estimated task time in seconds and extrapolate the new value back into a time date string for your panel view to display. I would do the calculation and string manipulation in the controllogix. The panel view is much too stupid for this kind of work lol. If interested, shoot me a pm and I can send over the AOI over to you when I'm back in the office.
 

Similar Topics

I have two identical machines running similar HMI projects, the only difference is one is done in FactoryTalk View Version 10 and the other is...
Replies
0
Views
3
how to communicate FactoryTalk Optix and Mitsubishi Q Series. I want to know the details of that
Replies
0
Views
36
Hoping someone can give me some guidance or confirmation of what I need to do. We have a FactoryTalk SE program that I need to change the IP...
Replies
2
Views
82
We are a water/wastewater plant, collecting realtime and manually entered data. We have been using FactoryTalk Historian (OSI PI) for real time...
Replies
3
Views
130
Good morning! Let me start by saying, I am still learning about this type of HMI programming. I recently watched a video about recipes and how it...
Replies
0
Views
70
Back
Top Bottom