Run Hours
medium
Totals a machine's run time as hours, minutes, and seconds, retaining the total through stops, with a manual reset.
What it teaches
An hour meter must stay exact for hours, whatever the scan time. A timer that restarts itself each second loses one scan at every restart: after 10 s at 100 ms scans it shows 9 s. Some tests scan once a second while the simulation scans every 100 ms, so logic that works in the simulation can still fall behind, or stop counting, in the tests.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| In_Run | Input | BOOL | 0 | Signal to track run time |
| In_Reset | Input | BOOL | 0 | Clears the accumulated total |
| Out_Seconds | Output | DINT | 0 | Seconds portion of the total, 0-59 |
| Out_Minutes | Output | DINT | 0 | Minutes portion of the total, 0-59 |
| Out_Hours | Output | DINT | 0 | Whole hours of accumulated run time |
Required behavior
- Accumulates run time while In_Run is 1 and holds the total — including any partial second — while In_Run is 0.
- Every 1000 ms of run time adds exactly one second to the display, however long the machine runs and whatever the scan time. A timer that restarts itself loses time at each restart, so the meter falls further behind every minute.
- Out_Seconds and Out_Minutes roll over at 60.
- In_Reset clears the total to 0:00:00, including any partial second, whether the machine is running or stopped.