Stopwatch to calculate operating hours
Hi folks,
Question:
How can I calculate the operating hours of a machine? The data that I have is a timestamp for every data change of boolean values. The data comes from a Kepware tag and is stored in a Value Stream.
Context:
I am logging the tag as a property "is the motor on?" of a machine in a ValueStream.
By calling the service QueryPropertyHistory I have two columns: timestamp and "is the motor on" (boolean). The Value Stream stores every data change.
I want to sum the elapsed time every time my data change from true to false. Something like a stopwatch / time counter to measure the operating hours.
The furthest I came so far getting the time difference between the first timestamp and the last one 😅 by using QueryPropertyHistory + dateDifference.
Any help is appreciated!

