
FUNCTION_BLOCK FB30

VAR_TEMP
    // variables temporaires

END_VAR
VAR
    flag_Manu_Bp_section0, flag_Manu_Bp_section1, flag_Manu_Bp_section2, flag_Manu_Bp_section3, flag_Manu_Bp_section4, flag_Manu_Bp_section5, falg_Manu_BP_tapis: BOOL;
    flag_Manu_Bp_RackZ7: BOOL;
END_VAR

"GestionManu".ManuSection0:= (("HMI_DB".Manu_Bp_section0 AND NOT flag_Manu_Bp_section0) AND "GestionChariotDB".nbChariotSection[1] <4  AND NOT B_ASI20B2_presenceP1 
                                OR "GestionManu".ManuSection0) 
                                AND B_ASI20B1_presenceP0 AND NOT Z7_chargementEnCours; // section 0
"GestionManu".ManuSection1:= (("HMI_DB".Manu_Bp_section1 AND NOT flag_Manu_Bp_section1) AND "GestionChariotDB".nbChariotSection[2] <2  AND NOT B_ASI30B2_presenceP1 
                                OR "GestionManu".ManuSection1) AND B_ASI30B1_presenceP0 ; // section 1
"GestionManu".ManuSection2:= (("HMI_DB".Manu_Bp_section2 AND NOT flag_Manu_Bp_section2) AND "GestionChariotDB".nbChariotSection[3] <3  AND NOT B_ASI40B2_presenceP1 
                                OR "GestionManu".ManuSection2) 
                                AND B_ASI40B1_presenceP0 AND NOT Z10_mouvementEnCours; // section 2
"GestionManu".ManuSection3:= (("HMI_DB".Manu_Bp_section3 AND NOT flag_Manu_Bp_section3) AND "GestionChariotDB".nbChariotSection[4] <2  AND NOT B_ASI50B2_presenceP1 
                                OR "GestionManu".ManuSection3) 
                                AND B_ASI50B1_presenceP0; // section 3
"GestionManu".ManuSection4:= (("HMI_DB".Manu_Bp_section4 AND NOT flag_Manu_Bp_section4) AND "GestionChariotDB".nbChariotSection[5] <2  AND NOT B_ASI60B2_presenceP1 
                                OR "GestionManu".ManuSection4) 
                                AND B_ASI60B1_presenceP0 AND NOT Z9_mouvementEnCours; // section 4
"GestionManu".ManuSection5:= (("HMI_DB".Manu_Bp_section5 AND NOT flag_Manu_Bp_section5) AND "GestionChariotDB".nbChariotSection[0] <5  AND NOT B_ASI10B2_presenceP1 
                                OR "GestionManu".ManuSection5) AND B_ASI10B1_presenceP0; // section 5
"GestionManu".ManuTapis:= "HMI_DB".Manu_Bp_tapis;
"GestionManu".chargementZ7:= "HMI_DB".Manu_Bp_RackZ7 AND B_ASI20B3_presenceRack OR Z7_chargementEnCours ; // vérouille le mode chargement Z7 de la section 0, retombe quand le chargement est fini
"GestionManu".DechargementZ9:= "HMI_DB".Manu_Bp_RackZ9 OR Z9_mouvementEnCours ; // vérouille le mode chargement Z9 de la section 0, retombe quand le chargement est fini
"GestionManu".DechargementZ10:= "HMI_DB".Manu_Bp_RackZ10 OR Z10_mouvementEnCours ; // vérouille le mode chargement Z10 de la section 0, retombe quand le chargement est fini

//reset mémoire HMI
IF Z7_chargementEnCours THEN
    "HMI_DB".Manu_Bp_RackZ7:= false;
END_IF;
IF Z9_mouvementEnCours THEN
    "HMI_DB".Manu_Bp_RackZ9:= false;
END_IF;
IF Z10_mouvementEnCours THEN
    "HMI_DB".Manu_Bp_RackZ10:= false;
END_IF;

//gestion front
flag_Manu_Bp_section0:= "HMI_DB".Manu_Bp_section0;
flag_Manu_Bp_section1:= "HMI_DB".Manu_Bp_section1;
flag_Manu_Bp_section2:= "HMI_DB".Manu_Bp_section2;
flag_Manu_Bp_section3:= "HMI_DB".Manu_Bp_section3;
flag_Manu_Bp_section4:= "HMI_DB".Manu_Bp_section4;
flag_Manu_Bp_section5:= "HMI_DB".Manu_Bp_section5;
falg_Manu_BP_tapis:= "HMI_DB".Manu_Bp_tapis;
flag_Manu_Bp_RackZ7:= "HMI_DB".Manu_Bp_RackZ7;

END_FUNCTION_BLOCK
