Problems with triggerCondition and evaluateCondition()


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)

If someone could help I would be very grateful.

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.


  1. Sends changing speed command to VC
  2. Wait for VC response


  1. Wait for changing speed command from PLC
  2. After setup, sends signal to PLC for job done
1 Like

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.

1 Like

If you are using VC4.8, check Conveyor Motor component from Conveyor Utilities.

Metadata shows how to use the component.

1 Like