Calculate runtime percentage

I have a Boolean historical tag that is 1 when machine starts and 0 when it stops. I wanted to calculate the percentage of time that it is running over a certain time period. Anyone have any ideas how to calculate that? Any help is appreciated.

Try using system.tag.queryTagHistory.
It has an option that allows you to get the duration (in seconds) that the machine was on.
You can then divide that by the length of your time period in seconds to get an estimated running percentage.


That worked. Thank you