Hello
We are experiencing some unusual behavior in regards to Value Changed Tag Event Script.
Here is the situation
We determine which shift is active on a given machine and CurrentShift tag is updated to reflect that. We have a Value Changed script on the CurrentShift that updates the ShiftID tag which is a counter that we use to differentiate shifts. We noticed that on gateway restarts the ShiftID tag would increment even though the CurrentShift had not changed. After looking on the forum I believed that checking initialChange would solve out problem. And While yes it did it also introduced some unsual behavior. We have had this set up on 6 different machines and we noticed that on some of the machines even though the CurrentShift was updating the ShiftID was not incrementing. It happened on about 3/6 machines which confused us even more as it was not consistent. Also ShiftID would later increment on machines that had missed it. I will include our value changed event script below. Curious if anyone has seen similar behavior or has a different solution for us.
if not initialChange and currentValue.quality.isGood() and previousValue.quality.isGood():
id_path = "/".join(tagPath.split("/")[:-1]) + "/ShiftID"
curr_id = system.tag.readBlocking([id_path])[0].value
system.tag.writeBlocking([id_path], [curr_id + 1])
Ignition v8.1.1