I am trying to simulate two real conveyors and I have written a python script for each. I am setting a target speed and an acceleration from PLCSIM (tia portal) which works perfect. The problem is that one of the conveyors’ speed does not change, due to the python script getting stucked in the “evaluateCondition()” function, as it can be seen in the image.
Both scrips are the same so cannot find why one works but the other doesn´t. (Both conveyors are activated from the PLC but only one gets to the target speed)
setTargetSpeed consumes time, which is delay, so there might be a chance that when you are trying to trigger triggerCondition, Script is still executing setTargetSpeed. You could add one more signal for handshaking between VC and PLC.
Note that triggerCondition() is only re-evaluated when a signal connected to the script (i.e. you get OnSignal call for it) is triggered, or you manually call evaluateCondition().
I didn’t read through your code so maybe that is not the issue but just FYI.