Procédé

Tutoriel - Lina Procédé - 05/2024

9. Annexes

9.1 Code FC560_SEQ_SAUV_PROG 

//RAZ STRING D ETAT ETAPES
"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := ' ';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := ' ';

REGION SEQ EN-TÊTE

//INIT SEQUENCE PAR AFFICHEUR
IF "DB810_GESTION_IHM".INIT_SEQ THEN
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 0;
END_IF;

//RAZ DES VARIABLES
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 0 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;

%DB560.DBW6 := 0; (* RAZ CMD01*)
%DB560.DBW8 := 0; (* RAZ CMD02*)
%DB560.DBW10 := 0; (* RAZ CMD03*)
%DB560.DBW12 := 0; (* RAZ CMD04*)

"DB560_SEQ_SAUV_PROG".SEQ.INT01 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.INT02 := 0; (* *)

"DB560_SEQ_SAUV_PROG".SEQ.ETAT01 := 0; (* *)

END_IF;

// DEMARRAGE DE LA SEQUENCE
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 0 AND "REPRISE_API_OK" THEN
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 10;
END_IF;

// INCREMENTATION TEMPO
IF "BIT_100ms" AND "DB560_SEQ_SAUV_PROG".SEQ.T_100MS < 32766 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := "DB560_SEQ_SAUV_PROG".SEQ.T_100MS + 1;
END_IF;
IF "BIT_1s" AND "DB560_SEQ_SAUV_PROG".SEQ.T_1S < 32766 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := "DB560_SEQ_SAUV_PROG".SEQ.T_1S + 1;
END_IF;

// ETAPE DE PREPARATION AU DEMARRAGE
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 10 THEN

"DB560_SEQ_SAUV_PROG".SEQ.CMD01_00 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_01 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_02 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_03 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_04 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_05 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_06 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_07 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_08 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_09 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_10 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_11 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_12 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_13 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_14 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD01_15 := 0; (* *)

"DB560_SEQ_SAUV_PROG".SEQ.CMD02_00 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_01 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_02 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_03 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_04 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_05 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_06 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_07 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_08 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_09 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_10 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_11 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_12 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_13 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_14 := 0; (* *)
"DB560_SEQ_SAUV_PROG".SEQ.CMD02_15 := 0; (* *)

"DB560_SEQ_SAUV_PROG".SEQ.INT01 := 0; (* *)
(*"DB560_SEQ_SAUV_RECETTE".SEQ.INT02 := 0; (* *)*)

"DB560_SEQ_SAUV_PROG".SEQ.ETAT01 := 0; (* *)

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Attente notif de demande de sauvegarde';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := 'Notif demande de sauvegarde recue';

IF "DB550_GESTION_COM_LINA".SP_Dmd_sauvegarde_prog = 1 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := ' ';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := ' ';
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 100;
END_IF;
END_IF;
END_REGION

REGION SAUVEGARDE

(*Etape 100 : Sauvegarde de la recette dans le DB associé au code recette*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 100 THEN

(*Sauvegarde de la recette dans le DB associé au code recette*)
IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 10 THEN
"DB590_STOCKAGE_PROG_001_010".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB590_STOCKAGE_PROG_001_010".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB590_STOCKAGE_PROG_001_010".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 11 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 21 THEN
"DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;
IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 21 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 31 THEN
"DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 31 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 41 THEN
"DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 41 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 51 THEN
"DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 51 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 61 THEN
"DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 61 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 71 THEN
"DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;
IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 71 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 81 THEN
"DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 81 AND "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder < 91 THEN
"DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder].COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder >= 91 THEN
"DB599_STOCKAGE_PROG_AUTRES".Code_programme := "DB550_GESTION_COM_LINA".SP_code_prog_a_sauvegarder;
"DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.NOM := "DB550_GESTION_COM_LINA".SP_Nom_prog;
"DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.ETAPES := "DB551_PROG_RECEPT_LINA".ETAPES;
"DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.COMPLEMENT := "DB551_PROG_RECEPT_LINA".COMPLEMENT;
END_IF;

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Recette stockee en fonction du code';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := '';

//"DB821_GES_AFF_RECETTE_DE_BASE".Index_rec_choix_memo := 0;//a mettre a o pour reactualiser l'afficheur

IF "Tjrs_1" THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 110;
END_IF;
END_IF;

(*Etape 110 : Validation sauvegarde effectuée*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 110 THEN

(*Validation sauvegarde effectué*)
"DB550_GESTION_COM_LINA".SP_Rep_sauvegarde_prog_api := 1;

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Reponse automate recette stockee';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := '';

IF "Tjrs_1" THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 120;
END_IF;
END_IF;

(*Etape 120 : Attente échange Lina raz*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 120 THEN

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Attente notif echange Lina raz';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := 'Notif echange Lina raz';

IF "DB550_GESTION_COM_LINA".SP_Rep_sauvegarde_prog_api = 0 AND "DB550_GESTION_COM_LINA".SP_Dmd_sauvegarde_prog = 0 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 200;
END_IF;
END_IF;
END_REGION

REGION VIDAGE

(*Etape 200 : Attente demande vidage tampon*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 200 THEN

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Attente demande de vidage';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := 'Demande recue';

IF "DB550_GESTION_COM_LINA".SP_Dmd_vidage_tampon THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 210;
END_IF;
END_IF;

(*Etape 210 : Vidage tampon*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 210 THEN

"NULL" := 0;
"DB560_SEQ_SAUV_PROG".SEQ.INT01 := FILL(BVAL := "NULL", BLK => "DB551_PROG_RECEPT_LINA");

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Vidage du DB tampon';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := 'DB tampon vide';

IF "DB551_PROG_RECEPT_LINA".ETAPES[1].CODE_ETAPE = 0 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 220;
END_IF;
END_IF;

(*Etape 220 : Réponse vidage tampon OK*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 220 THEN

"DB550_GESTION_COM_LINA".SP_Rep_vidage_tampon_api := 1;

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Reponse vidage tampon ok';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := '';

IF "Tjrs_1" THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 230;
END_IF;
END_IF;

(*Etape 230 : Attente échange Lina raz*)
IF "DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE = 230 THEN

"DB560_SEQ_SAUV_PROG".SEQ.NOM_ETAPE := 'Attente notif echange Lina raz';
"DB560_SEQ_SAUV_PROG".SEQ.DESCRIP_TRANSITION := 'Notif echange Lina raz';

IF "DB550_GESTION_COM_LINA".SP_Rep_vidage_tampon_api = 0 AND "DB550_GESTION_COM_LINA".SP_Dmd_vidage_tampon = 0 THEN
"DB560_SEQ_SAUV_PROG".SEQ.T_100MS := 0;
"DB560_SEQ_SAUV_PROG".SEQ.T_1S := 0;
"DB560_SEQ_SAUV_PROG".SEQ.NUM_ETAPE := 10;
END_IF;
END_IF;
END_REGION