In the function block PGR_HBW_Ablauf in li_StepCase 60 the program checks the warehouse for the first available product. If there is no product that matches the ordered product, the warehouse goes to the last used position in the warehouse. In practise this results in a random (sometimes empty) container being presented to the robot (VGR), which eventually results in a system error.
Looking at the code, an attempt was made to catch this situation. This code, however, does not function as inteded. These are the important lines for the problem I am describing:
FOR #li_Counter_Hor := 1 TO 3 DO
FOR #li_Counter_Ver := 1 TO 3 DO
IF (...) THEN
...
#li_Counter_Act_Hor := #li_Counter_Hor;
#li_Counter_Act_Ver := #li_Counter_Ver;
END_IF;
END_FOR;
END_FOR;
IF (#li_Counter_Act_Hor = 4) OR (#li_Counter_Act_Ver = 4) THEN
#li_StepCase := 40;
ELSE
#li_StepCase := 70;
END_IF;
When no valid positions are found the li_Counter_Hor and li_Counter_Ver are both 4. This only happens, because the FOR-loops have finished but the value is increased at the end. The li_Counter_Act_Hor and li_Counter_Act_Ver are however still set from the last time the warehouse was able to find a valid product. These variables can never end up being 4 as they are only set whitin the FOR-loops, where they never exceed 3. \
This means that the evaluation never returns true and the else statement is always run, continuing the pickup sequence. This results in the pickup of the previously found container.
In the function block PGR_HBW_Ablauf in
li_StepCase 60
the program checks the warehouse for the first available product. If there is no product that matches the ordered product, the warehouse goes to the last used position in the warehouse. In practise this results in a random (sometimes empty) container being presented to the robot (VGR), which eventually results in a system error.Looking at the code, an attempt was made to catch this situation. This code, however, does not function as inteded. These are the important lines for the problem I am describing:
When no valid positions are found the
li_Counter_Hor
andli_Counter_Ver
are both 4. This only happens, because the FOR-loops have finished but the value is increased at the end. Theli_Counter_Act_Hor
andli_Counter_Act_Ver
are however still set from the last time the warehouse was able to find a valid product. These variables can never end up being 4 as they are only set whitin the FOR-loops, where they never exceed 3. \ This means that the evaluation never returns true and the else statement is always run, continuing the pickup sequence. This results in the pickup of the previously found container.