# Generator Runtime Display in Hours

**URL:** <https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [December 27, 2024, 12:54pm UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252 "2024-12-27T12:54:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Treadway](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Matthew\_Treadway](https://forum.inductiveautomation.com/u/Matthew_Treadway)\
**Post date:** [December 27, 2024, 12:54pm UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252/1 "2024-12-27T12:54:58Z")

</div>

Hi all,

New to the scripting world and would like to get some input on a simple tag event script. I have a status input in my PLC code linked to a Boolean coil telling me when the generator is running - value 0 for normal utility power and value 1 for generator running. Without doing it through the code in the PLC, I'm looking for a way to track the Generator runtime in hours when the bit is true and display it for the operators on an overview screen.

Any input would be greatly appreciated - thanks!

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 28, 2024, 12:33am UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252/2 "2024-12-28T00:33:03Z")

</div>

You have tag history enabled?

---

<div class="post-metadata">

**Author:** ![Matthew\_Treadway](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Matthew\_Treadway](https://forum.inductiveautomation.com/u/Matthew_Treadway)\
**Post date:** [December 30, 2024, 5:37pm UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252/3 "2024-12-30T17:37:56Z")

</div>

Yes

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 30, 2024, 6:33pm UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252/4 "2024-12-30T18:33:36Z")

</div>

If you have the ability / authorisation to change the PLC code, I recommend adding a retentive timer or counter to the PLC to monitor the run hours. Then use the historian1 or a transaction group to log the meter value onChange and, if you want, at midnight. That way you can easily calculate daily run hours and runtime since midnight.

1 Ignition's Historian doesn't interpolate or extrapolate values to the boundary of a selected time range. That means you'll get errors which increase with the intervals between the last reading before and the first reading after midnight, for example.

Anywhere I've needed it I create a separate data table, a scheduled task to log the reading (at midnight / on the hour / every 15 minutes or whatever you decide) and onChange of the generator's run status.

---

<div class="post-metadata">

**Author:** ![Matthew\_Treadway](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Matthew\_Treadway](https://forum.inductiveautomation.com/u/Matthew_Treadway)\
**Post date:** [December 31, 2024, 12:18pm UTC](https://forum.inductiveautomation.com/t/generator-runtime-display-in-hours/100252/5 "2024-12-31T12:18:13Z")

</div>

Ok sounds good - I appreciate the feedback.
