Code example: Several conveyor belts
INFORMATION
The following example can be imported in the IEC Editor. In the IEC Editor, open the menu [Tools] > [Scripting] > [Scripts] > [R], and select the menu entry [Robotics_Examples.py].
When using several conveyor belts, the various conveyor belts must be switched using a CallFunction. To that end, the CallFunction interface must be, e.g. linked in the USER_PRG.Init() action. The use of the CallFunction function is described in chapter IEC call function for the SRL program.
Due to the use of the CallFunction, the function block instances of the conveyor belts are created as global variables.
ConveyorTracking_GVL
The coordinate systems are switched using CallFunction.
Like the process with only one conveyor belt, the respective origin of the conveyor belts is parameterized in the PRG_ExampleMultipleConveyorTracking.Init_Conveyors() action.
Afterwards, the program in the USER_PRG.HighPrio() action and the respective Init() action of the conveyor instances are opened in USER_PRG.Init().
User_PRG.HighPrio()
PRG_ExampleSingleConveyorTracking();
User_PRG.Init()
xInitDone := (* xInitDone AND *)
ConveyorTracking_GVL.afbConveyor[1].Init() AND
ConveyorTracking_GVL.afbConveyor[2].Init();
If additional Init() signals are depicted in the USER_PRG.Init() action (for example the Init for the CallFunction), all of them must be linked.