Generator Runtime Display in Hours

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!

You have tag history enabled?

Yes

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.

Ok sounds good - I appreciate the feedback.