Procédé

Tutoriel - Lina Procédé - 05/2024

9.3 SCL FC564_SEQ_RECUP_PROG

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

REGION SEQ EN-TÊTE

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

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

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

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

"DB564_SEQ_RECUP_PROG".SEQ.ETAT01 := 0; (* *)
END_IF;

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

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

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

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

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

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

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

"DB564_SEQ_RECUP_PROG".SEQ.NOM_ETAPE := 'Attente de demande de recuperation de programme';
"DB564_SEQ_RECUP_PROG".SEQ.DESCRIP_TRANSITION := 'Code de recuperation de programme';

//ATTENTE DMD RECUPERATION PROGRAMME
IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer <> 0 THEN
"DB564_SEQ_RECUP_PROG".SEQ.T_100MS := 0;
"DB564_SEQ_RECUP_PROG".SEQ.T_1S := 0;
"DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE := 100;
END_IF;
END_IF;
END_REGION

REGION RECUPERATION PROGRAMME

(*Etape 100 : Chargement du programme à récupérer associé au code*)
IF "DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE = 100 THEN

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

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 11 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 21 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB591_STOCKAGE_PROG_011_020".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 21 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 31 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB592_STOCKAGE_PROG_021_030".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 31 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 41 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB593_STOCKAGE_PROG_031_040".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 41 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 51 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB594_STOCKAGE_PROG_041_050".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 51 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 61 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB595_STOCKAGE_PROG_051_060".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 61 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 71 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB596_STOCKAGE_PROG_061_070".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;
IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 71 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 81 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB597_STOCKAGE_PROG_071_080".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer >= 81 AND "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer < 91 THEN
"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].NOM;
"DB555_RECUP_PROG".ETAPES := "DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB598_STOCKAGE_PROG_081_090".PROGRAMMES["DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF "DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer = "DB599_STOCKAGE_PROG_AUTRES".Code_programme THEN

"DB550_GESTION_COM_LINA".RP_Nom_programme_recupere := "DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.NOM;
"DB555_RECUP_PROG".ETAPES := "DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.ETAPES;
"DB555_RECUP_PROG".COMPLEMENT := "DB599_STOCKAGE_PROG_AUTRES".PROGRAMMES.COMPLEMENT;
END_IF;

"DB564_SEQ_RECUP_PROG".SEQ.NOM_ETAPE := 'Chargement du programme a recuperer en fonction du code';
"DB564_SEQ_RECUP_PROG".SEQ.DESCRIP_TRANSITION := '';

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

(*Etape 110 : Mise à 1 de la demande de récupération*)
IF "DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE = 110 THEN

"DB550_GESTION_COM_LINA".RP_Dmd_recuperation := 1;

"DB564_SEQ_RECUP_PROG".SEQ.NOM_ETAPE := 'Reponse de demande de recuperation ok';
"DB564_SEQ_RECUP_PROG".SEQ.DESCRIP_TRANSITION := '';

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

(*Etape 120 : Attente récupération OK Lina*)
IF "DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE = 120 THEN

"DB564_SEQ_RECUP_PROG".SEQ.NOM_ETAPE := 'Attente raz de la reponse par Lina';
"DB564_SEQ_RECUP_PROG".SEQ.DESCRIP_TRANSITION := 'Reponse raz par Lina';

IF "DB550_GESTION_COM_LINA".RP_Dmd_recuperation = 0 THEN
"DB564_SEQ_RECUP_PROG".SEQ.T_100MS := 0;
"DB564_SEQ_RECUP_PROG".SEQ.T_1S := 0;
"DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE := 130;
END_IF;
END_IF;

(*Etape 130 : Réinitialisation automate*)
IF "DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE = 130 THEN

//RAZ
"DB550_GESTION_COM_LINA".RP_Code_programme_a_recuperer := 0;

"NULL" := 0;
"DB564_SEQ_RECUP_PROG".SEQ.INT01 := FILL(BVAL := "NULL", BLK => "DB555_RECUP_PROG");
"DB564_SEQ_RECUP_PROG".SEQ.INT01 := FILL(BVAL := "NULL", BLK => "DB550_GESTION_COM_LINA".RP_Nom_programme_recupere);

"DB564_SEQ_RECUP_PROG".SEQ.NOM_ETAPE := 'Vidage du db de recuperation';
"DB564_SEQ_RECUP_PROG".SEQ.DESCRIP_TRANSITION := '';

IF "Tjrs_1" THEN
"DB564_SEQ_RECUP_PROG".SEQ.T_100MS := 0;
"DB564_SEQ_RECUP_PROG".SEQ.T_1S := 0;
"DB564_SEQ_RECUP_PROG".SEQ.NUM_ETAPE := 10;
END_IF;
END_IF;
END_REGION