Actually, I want to record the ON state duration of our packing machines towerlight status (Green, Red, Yellow). Like when the batch started (success count > 200), how much time (in minutes) the machine has spent on the Green Light (running state), on the Red Light (fault state) and on the Yellow light (standby/stopped by the operator state).
As, this duration will help me in the OEE calculation.
Previously, I tried the tag event script (on value change) where a while loop runs and increment a 'Running_Duration' tag for every minutes passed. This works well when I applied this for Green light boolean state, but when I do this for other two lights. The script keeps running and not stopping. After studying from the forum found that loops are not a good idea to run in the tag event script.
You have this question open in multiple topics, and with answers. It is against this forum's rules to do that. At least, not without linking to the other topics.