Historian Tag Data - Calculating Runtime


I am trying to generate some very basic OEE data for some machines that we are monitoring. We are pulling of about a dozen sensor values in real time, and I have determined that if one of the sensors is reading above a certain value, then the machine can be considered in a running state, and other wise this value is near zero. I would like to know how I can easily calculate on different intervals for each machine what the percentage of the time that it was “running”. Thanks in advance!



One way would be to use a calculated tag that’s zero/False when your sensor is below your value and some positive value or True when the sensor is above that value. Then a tag calculation for Duration On will give you the number of seconds the tag was above zero.



Welcome to the forum @mnoll

I use a transaction group to log timestamps in a database based on changes on a run status tag. This query works well for binding to a pie chart.

SELECT Run_Status, SUM(TIMESTAMPDIFF(MINUTE, Start_Time, End_Time)) as Time 
FROM run_status_events 
WHERE Some Conditions
GROUP BY Run_Status