Question about Boolean tags & value change event scripts

Question related to an issue I’m trying to work through…
We have boolean OPC tags set to boolean PLC logic to go TRUE when quality test passes and another for the opposite of when the test fails.

To record when either pass or fail occurs, the boolean OPC tags have event scripts that start like below:

if currentValue.value == True:
code for recording to SQL database

Question: The boolean OPC tags change to TRUE for only about 1-2 seconds, so could the code for recording to SQL database potentially not complete due to internet speed or a backup in ignition execution since the currentValue.value no longer == TRUE?

This may be a simple answer, but my worry is that we are setting our self up for random ‘misses’ since the value change event script should run when the boolean OPC tag == TRUE anyway, without adding an if statement like above into the value change event script.

For context: We are experiencing random moments (sometimes over multiple hours) where many ‘misses’ occur.

Thanks!

No, this wouldn't be the cause of your miss. If the transition to true is received it'll execute.

You're probably missing the transition at the driver level where polling occurs. You need a handshake, not a hope and a prayer that you see a temporary transition.

edit: although if you have a lot of these scripts and/or they are executing frequently another possibility is that event script execution is overflowing. Check the missedEvents flag in your script and add logging to see if that is happening.

2 Likes