
FUNCTION FC71 : void
VAR_TEMP
    // variables temporaires
    i,j: INT; // variable pour boucle
    section, ordre: INT;
    X, Y, Z: INT;
    
END_VAR


FOR i:= 1 TO 9 DO
    section:= "GestionChariotDB".chariot[i,0];
    ordre:= "GestionChariotDB".chariot[i,2];
    X:= -40;
    Y:= 0;
    "HMI_positionChariotDB".chariot[i,2]:= "GestionChariotDB".chariot[i,1];
    
    CASE section OF
        0: CASE ordre OF
                0: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                1: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-16;
                2: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-32;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-48;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-48;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-48;
                6: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-48;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=x+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                END_CASE;
                
            1: CASE ordre OF
                0: "HMI_positionChariotDB".chariot[i,0]:=X;
                       "HMI_positionChariotDB".chariot[i,1]:=Y+64;
                1: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+48;
                2: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+32;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+16;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+16;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+16;
                6: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+16;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=0;
                END_CASE;
                
            2: CASE ordre OF 
                0: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                       "HMI_positionChariotDB".chariot[i,1]:=Y+80;
                1: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;
                2: "HMI_positionChariotDB".chariot[i,0]:=X+64;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;
                6: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+96;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                END_CASE;
       
            3: CASE ordre OF 
                0: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                   "HMI_positionChariotDB".chariot[i,1]:=Y+16;
                1: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+32;
                2: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+48;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+64;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+64;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+64;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+64;
                6: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y+64;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                END_CASE;
                
            4: CASE ordre OF 
                0: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                       "HMI_positionChariotDB".chariot[i,1]:=Y-48;
                1: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-32;
                2: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-16;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X+80;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+64;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                6: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                END_CASE;
                
            5: CASE ordre OF 
                0: "HMI_positionChariotDB".chariot[i,0]:=X;
                       "HMI_positionChariotDB".chariot[i,1]:=Y-64;
                1: "HMI_positionChariotDB".chariot[i,0]:=X;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;
                2: "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;                
                3: "HMI_positionChariotDB".chariot[i,0]:=X+32;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;
                4: "HMI_positionChariotDB".chariot[i,0]:=X+48;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;
                5: "HMI_positionChariotDB".chariot[i,0]:=X+64;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;
                6: "HMI_positionChariotDB".chariot[i,0]:=X+72;
                    "HMI_positionChariotDB".chariot[i,1]:=Y-80;
                ELSE
                    "HMI_positionChariotDB".chariot[i,0]:=X+16;
                    "HMI_positionChariotDB".chariot[i,1]:=Y;
                END_CASE;
    ELSE
        "HMI_positionChariotDB".chariot[i,0]:=X+16;
        "HMI_positionChariotDB".chariot[i,1]:=Y;
    END_CASE;
END_FOR;
END_FUNCTION
