Breakdown Time gateway script not working

I am trying to calculate how many seconds a machine has been broken down in a gateway script. I have made the code increment a tag by 1 each second, but it is not working. Does anyone know why?

Thanks.

  • When you see sleep() in your scripts you know you're lost.
  • Never ever use a never-ending while loop in an Ignition script.
  • When you need to read multiple tags do them all in one statement using system.tag.readBlocking which accepts a list of tags.

Instead:

  • Create a gateway tag change event on the machine fault.
  • When the fault tag goes true record the time in a memory tag of type DateTime.
  • Calculate the downtime using an expression with now(1000) - the stop time tag value.
4 Likes

I am indeed lost, as I am not an avid programmer. Thank you for pointing me in the right direction, I will try this method.