
FUNCTION_BLOCK FB21
VAR_TEMP
    // variables temporaires

END_VAR
VAR
    TR: ARRAY[0..1] OF BOOL;
    cDRepos: BOOL;
    cDReposTimer: BOOL;
    tempo: S5TIME;
    tempo_bin : word;
END_VAR

//transition
TR[0]:= "G7_GestionSection".tapis[0] AND NOT CDrepos; // TR 0 vers 1
TR[1]:= "G7_GestionSection".tapis[1] AND CDReposTimer; // TR 1 vers 0

//etape
IF TR[0] THEN // 0 vers 1
    "G7_GestionSection".tapis[0]:= false;
    "G7_GestionSection".tapis[1]:= true;
END_IF;
IF TR[1] THEN // 1 vers 0
    "G7_GestionSection".tapis[1]:= false;
    "G7_GestionSection".tapis[0]:= true;
END_IF;

//gestion cd repos
CDRepos:= "G7_GestionSection".section_0[1] AND "G7_GestionSection".section_1[0] AND "G7_GestionSection".section_2[0] AND "G7_GestionSection".section_3[0] 
            AND ("G7_GestionSection".section_4[0] OR "G7_GestionSection".section_4[2]) AND "G7_GestionSection".section_5[0];
tempo:= S_ODT (T_NO:= T1, S:=CDRepos, TV:=T#30s, R:=FALSE, BI:=tempo_bin,Q:=CDReposTimer) ;
END_FUNCTION_BLOCK
