Timer running slow

Ive bound the cycle running output from a piece of equipment to a timer to track run time. at the end of the day I transfer the timers value to a memory tag and reset the timer. Ive noticed the last couple days the runtime being reported has been getting worse and worse. Im watching the value of the timer and it now seems to be incrementing at half speed. is there a reason the timer would not be reliable? is there a better way to track run time?

thank you.

Can you describe a bit more what the timer is? An hour meter tag in a group, a timer script that you’re using to accumulate values, an actual tag in a plc?


its a timer component in the designer I dragged into my project from the Misc component palette.

Although the timers speed does not seem to be consistent, from your earlier response I assume there is another method I should be using to track runtime? Im not familiar with the hour meter you mentioned - can you elaborate or point me in the right direction for runtime tracking.

Yeah, that timer component is not built to record how long something takes. It’s built to just do something repeatedly on-screen.

Check out the “hour meter” feature of transaction groups, they’re designed to do exactly what you described. For example, you could have a standard group that accumulated this time you’re tracking and then use an end-of-day trigger to store the information in a row of a database table.

thank you. I did look into using an hour meter but at this point I dont have database tables set up for this operation - I was just trying to do quick and very basic run time tracking using memory tags. What I came up with was using a tag change script - If cycle running is on I store epoch time to a tag and if cycle running is off I subtract the stored time from current time and then add this to the total.

import time; now = time.time() status = system.tag.getTagValue("grinding robot DL05/GRX0") if status == 1: system.tag.writeToTag('grinding robot DL05/Cycle start time', now) else: start = system.tag.getTagValue("grinding robot DL05/Cycle start time") elapsed = now - start current = system.tag.getTagValue("grinding robot DL05/Cycle time") current = current + elapsed system.tag.writeToTag('grinding robot DL05/Cycle time', current)

Whatever works for you.