I need an advice or at least to be pointed to right direction.
I have boolean tag scanned every 1 second. That tag is part of UDT and UDT parameters define correct OPC path. That tag in the UDT has valueChanged() event programmed. In case that boolean tag turns TRUE, script in event valueChanged() should run (the script begins with “if currentValue==True:”).
The basic workflow is as follows:
- read value in “other tag”
- in case the value in “other tag” is not populated yet, sleep(0.4)
- as soon as the value is populated (it always is - sooner or later - when boolean goes True):
- do some calculations
- query database (these database queries take =< 30 ms - DB is not the bottleneck)
- write response back to writable tags
Sometimes, it seems the script is not fired at all … the first tag turns True, shortly after that, the other tag is populated and script should run … I can tell it has run because I see that values have been written to writable tags.
In case everything goes flawlessly, the whole operation is finished within blink of an eye (from receiving TRUE to writing data back).
In case things go south, the first tag goes True, second tag is populated shortly after that and nothing happens. The whole operation must be finished under 5 seconds, usually takes less then 1 second if everything is OK, but in case of a problem, you can wait 30 seconds and nothing happens.
The script is really trivial, the same goes for database tables with hundreds of records.
I have no idea where that event can get lost.
Many thanks in advance for pointing me to the right direction, right now, I am clueless.