FUNCTION_BLOCK FB23
VAR_TEMP
END_VAR
VAR
    TR: ARRAY[0..1] OF BOOL; // tableau de transition
    tOffStep1: BOOL;
    tOff: S5TIME;
    tOfftempo_bin : word;

END_VAR

//Transition
TR[0]:= "G7_GestionSection".section_1[0] AND B_ASI30B1_presenceP0 AND NOT B_ASI30B2_presenceP1 AND NOT tOffStep1 AND "GestionChariotDB".nbChariotSection[2] < 2; // TR 0 vers 1
TR[1]:= "G7_GestionSection".section_1[1] AND NOT B_ASI30B1_presenceP0; // TR 1 vers 0

//etape
IF TR[0] THEN // 0 vers 1
    "G7_GestionSection".section_1[0]:= false;
    "G7_GestionSection".section_1[1]:= true;
END_IF;
IF TR[1] THEN // 1 vers 0
    "G7_GestionSection".section_1[1]:= false;
    "G7_GestionSection".section_1[0]:= true;
END_IF;   
  
//gestion tempo
tOff:= S_OFFDT (T_NO:= T3, S:="G7_GestionSection".section_1[1], TV:=T#7s, R:=FALSE, BI:=tOfftempo_bin,Q:=tOffStep1);

END_FUNCTION_BLOCK
