Script about calculate the cumulative downtime

i have no idea about the tag history i will try the script first ,if it can't be ,i will try tag history,thanks very much all

Oh no! You are using a user interface component to run your process!

Don't do that! Any disruption to your client will break your process.

Run your script in a gateway event.

1 Like

I would use a transaction group for this (or a scripted equivalent).

I use a transaction group to store the following every ten seconds:

  • actual count
  • goal count (how many should have been made at that time)
  • line status (we also have small stops in there)

This allows me to easily trend efficiencies, and caclulate uptimes / downtimes.

As an example, our line status is:

  • 0 : running
  • 1-4 : small stops
  • 5 : down
  • 6 : break

To calculate times (in seconds) the query would be something like:

SELECT line_status, COUNT(line_status) * 10
WHERE t_stamp >= '2023-12-11 08:00:00'
  AND t_stamp <  '2023-12-11 20:00:00'
GROUP by line_status
3 Likes

Where is the gateway event? for about the label text

Gateway event

https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts

Have the gateway event update a memory tag.
Bind the label props.text to the memory tag.