Countdown Timer

Might sound crazy but looking to display a countdown or count up timer based upon a tag change. Any ideas or help would be much appreciated.

If you have a start and finishing timestamp, I would think that using one of these expressions would suffice - *Between - Ignition User Manual 8.1 - Ignition Documentation

Thanks, any ideas on how to write the script or expression?

Need a bit more information on your setup and exact end goal, not sure what you are doing but assuming you have a tag that is a date type representing the end time, you could do something like

secondsBetween(now(100), {path.to.tag2}) would should show the number of seconds from the current moment until your expected end time stamp. This would update every 100 milliseconds based on the parameter fed to now().

Just want a timer to show when our transfer switch will switch back to normal utility power. I have a tag that shows we are on regular utility power and another that shows that generator is running. Want to show a timer when regular utility power is restored. It takes 15 minutes to transfer.

If you've got a tag indicating which power source you're on, add a tag change script to it that writes the current timestamp to some other tag. Then in your UI, use @bkarabinchak.psi's expression to show the delta between that stored timestamp and the current time for a 'count up'.

If you're guaranteeing 15 minutes, then do the same, but 'store' time of switch + 15 minutes (system.date.addMinutes()) and use the same delta display logic.

1 Like