
FUNCTION_BLOCK FB26
VAR_TEMP
    // variables temporaires

END_VAR
VAR
    TR: ARRAY[0..4] OF BOOL;
    flag_Z9_mouvementEnCours: BOOL;
    tOffStep3, tOnByPass: BOOL;
    tOff, tOn: S5TIME;
    tOfftempo_bin,tOntempo_bin: WORD;
    
END_VAR

//transition
//transition
TR[0]:= "G7_GestionSection".section_4[0] AND B_ASI60B1_presenceP0 AND 
            (B_ASI60B3_presenceRack AND TypeRackSection(section:= 4, typeChariot:= 1)
            OR ChariotZero404(section:=4)); // 0 vers 2
TR[1]:= "G7_GestionSection".section_4[0] AND B_ASI60B1_presenceP0 AND 
            (B_ASI60B3_presenceRack AND TypeRackSection(section:= 4, typeChariot:= 2)
            OR NOT B_ASI60B3_presenceRack
            ) AND NOT TR[0]; // 0 vers 1
TR[2]:= "G7_GestionSection".section_4[1] AND (NOT Z9_mouvementEnCours AND flag_Z9_mouvementEnCours OR tOnByPass); // 1 vers 2
TR[3]:= "G7_GestionSection".section_4[2] AND "GestionChariotDB".nbChariotSection[5] < 2 AND NOT B_ASI60B2_presenceP1 AND NOT tOffStep3; //2 vers 3
TR[4]:= "G7_GestionSection".section_4[3] AND NOT B_ASI60B1_presenceP0 ; // 3 vers 0

//etape
IF TR[0] THEN // TR 0 vers 2
    "G7_GestionSection".section_4[0]:= false;
    "G7_GestionSection".section_4[2]:= true;
END_IF;
IF TR[1] THEN //TR 0 vers 1
    "G7_GestionSection".section_4[0]:= false;
    "G7_GestionSection".section_4[1]:= true;
END_IF;
IF TR[2] THEN //TR 1 vers 2
    "G7_GestionSection".section_4[1]:= false;
    "G7_GestionSection".section_4[2]:= true;
END_IF;
IF TR[3] THEN //TR 2 vers 3
    "G7_GestionSection".section_4[2]:= false;
    "G7_GestionSection".section_4[3]:= true;
END_IF;
IF TR[4] THEN //TR 3 vers 0
    "G7_GestionSection".section_4[3]:= false;
    "G7_GestionSection".section_4[0]:= true;
END_IF;

//gestion tempo
tOff:= S_OFFDT (T_NO:= T2, S:="G7_GestionSection".section_4[3], TV:=T#4s, R:=FALSE, BI:=tOfftempo_bin,Q:=tOffStep3) ;
tOn:= S_ODT (T_NO:= T4, S:="G7_GestionSection".section_4[1] AND NOT Z9_mouvementEnCours, TV:=T#10s, R:=FALSE, BI:=tOntempo_bin,Q:=tOnByPass) ;

//gestion front
flag_Z9_mouvementEnCours:= Z9_mouvementEnCours;
END_FUNCTION_BLOCK

