I have a pretty generic question that I couldn't really find an answer for on the forums, but I do think it can be applicable to other peoples projects as well. If this question is already answered elsewhere, link it here and I'll remove/edit this question.
The basic idea of what I'm trying to do is display a timer countdown component (using the Perspective Simple Gauge component) for each station in an assembly line. Assume in this case there will be at most 50 stations. What I mean by timer is similar to a physical timer - I set a 20 minute timer on my phone to take a nap, and I can be sure the timer will go off in 20 minutes (whether I wake up is a different story).
This component in my project is similar - given a Takt time for a station and a start time, I would like to use the gauge to display a decreasing gauge value every second, like a handheld timer.
Station A has a Takt time of 300 seconds (5 minutes). An assembly arrives at Station A (how an arrival is determined is irrelevant for now), and the second it arrives at the station, we capture a start time. Then, our Gauge component would start from 300 and decrease every second by one value (Takt is measured in seconds as well).
Not exactly rocket science... What I want advice on is how to best accomplish this using the timers that are available in Ignition in a way that's scalable and not resource-intensive.
**A high level approach I've thought of: use a gateway timer script and write to a "heartbeat" tag every second, starting from 0 at midnight up to 86399. Then, when an assembly arrives, capture the start time using
system.date.now() and the heartbeat tag value. I would bind the gauge's
value property to an expression similar to
TaktTime - (CurrentHeartbeat - StartHeartbeat)
CurrentHeartbeat will come from a tag and will be what triggers the gauge's
value property to refresh. Too complicated? Too simple? I don't know...
I appreciate any and all ideas are appreciated. There are many ways to accomplish this, as is common in Ignition, but I'm looking for the most bomb-proof, least resource-intensive method possible.