Jump to content

Shift time and run time


Recommended Posts

Hi again. 
I am trying to figure out how to calculate off time.  If I use SI31 I can display the current time. Every time the machine is running I have a TA timer counting up.  I want to deduct 6 hours of the SI31 (production shift starts at 6:00am) but when I deduct 600 it will display as an MI eg. 7:15 will be 115. How can I display that it time as 1:15?

Thanks in advance!

Link to comment
Share on other sites

  • MVP 2023

You need to break your 115 into two pieces, 1 and 15, and display them separately separated by a ":".   All you need to do is divide your accumulated time by 100 to get hours and then immediately move the remainder (SL 4) into another register for minutes.

Use leading zeros on the minute register.

If you post your code and tell us which register is the off time (containing 115) I'll hack it in for you.

Joe T.

Link to comment
Share on other sites

So with the data table I can show current date, current time, (RTC To ASCII)

then I deduct 600 (6 hours) from SI 31 to an MI

then with Num To ASCII I can Plug that MI  into the data table. These all work.

Now I have to figure out how to plug in the machine run time. I have a TA preset to 24:00:00;00. On the plc screen I have that timer set as type current, display elapsed  and after 12 min , it will show 12 min on the plc and 23:48:00;00 on the ladder timer.  With the T To ASCII it will show 00:00.  What  would be correct was to have the machine run time in the data table?

Link to comment
Share on other sites

  • MVP 2023

Tozo, perhaps you need to change tack and consider using UTC.  Storing UTC under certain parameters being met, and then doing compares when others are met lets you arrive at intervening times very easily. 

For OFF time, on initial start you simply do a compare to a stored UTC that is updated every second during normal running, and then derive the time from the result.  You might be surprised at how useful UTC is against RTC in some instances.

cheers, Aus.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...