Procédé

Tutoriel - Lina Procédé - 05/2024

8.3 Code SEQ_RECUP_PROG

L10:(* -------------------------------- init ------------------------------------------- *)
(* Init Séquence *)
IF RAZ_SEQ THEN SEQ_RECUP_PROG.NUM_ETAPE :=0;END_IF;

(*RAZ DES VARIABLES*)
IF SEQ_RECUP_PROG.NUM_ETAPE = 0 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;

SEQ_RECUP_PROG.CMD01 := 0; (* CMD *)
SEQ_RECUP_PROG.CMD02 := 0; (* CMD *)
SEQ_RECUP_PROG.CMD03 := 0; (* CMD *)

SEQ_RECUP_PROG.INT01 := 0; (* *)
SEQ_RECUP_PROG.INT02 := 0; (* *)

SEQ_RECUP_PROG.ETAT01 := 0; (* *)
END_IF;

(*DEMARRAGE DE LA SEQUENCE*)
IF SEQ_RECUP_PROG.NUM_ETAPE = 0 THEN
SEQ_RECUP_PROG.NUM_ETAPE := 10;
END_IF;

(*INCREMENTATION TEMPO*)
IF BIT_100ms AND SEQ_RECUP_PROG.T_100MS < 32766 THEN
SEQ_RECUP_PROG.T_100MS := SEQ_RECUP_PROG.T_100MS + 1;
END_IF;
IF BIT_1s AND SEQ_RECUP_PROG.T_1S < 32766 THEN
SEQ_RECUP_PROG.T_1S := SEQ_RECUP_PROG.T_1S + 1;
END_IF;

(*ETAPE DE PREPARATION AU DEMARRAGE*)
IF SEQ_RECUP_PROG.NUM_ETAPE = 10 THEN

SEQ_RECUP_PROG.CMD01.00 := 0; (* *)
SEQ_RECUP_PROG.CMD01.01 := 0; (* *)
SEQ_RECUP_PROG.CMD01.02 := 0; (* *)
SEQ_RECUP_PROG.CMD01.03 := 0; (* *)
SEQ_RECUP_PROG.CMD01.04 := 0; (* *)
SEQ_RECUP_PROG.CMD01.05 := 0; (* *)
SEQ_RECUP_PROG.CMD01.06 := 0; (* *)
SEQ_RECUP_PROG.CMD01.07 := 0; (* *)
SEQ_RECUP_PROG.CMD01.08 := 0; (* *)
SEQ_RECUP_PROG.CMD01.09 := 0; (* *)
SEQ_RECUP_PROG.CMD01.10 := 0; (* *)
SEQ_RECUP_PROG.CMD01.11 := 0; (* *)
SEQ_RECUP_PROG.CMD01.12 := 0; (* *)
SEQ_RECUP_PROG.CMD01.13 := 0; (* *)
SEQ_RECUP_PROG.CMD01.14 := 0; (* *)
SEQ_RECUP_PROG.CMD01.15 := 0; (* *)

SEQ_RECUP_PROG.CMD02.00 := 0; (* *)
SEQ_RECUP_PROG.CMD02.01 := 0; (* *)
SEQ_RECUP_PROG.CMD02.02 := 0; (* *)
SEQ_RECUP_PROG.CMD02.03 := 0; (* *)
SEQ_RECUP_PROG.CMD02.04 := 0; (* *)
SEQ_RECUP_PROG.CMD02.05 := 0; (* *)
SEQ_RECUP_PROG.CMD02.06 := 0; (* *)
SEQ_RECUP_PROG.CMD02.07 := 0; (* *)
SEQ_RECUP_PROG.CMD02.08 := 0; (* *)
SEQ_RECUP_PROG.CMD02.09 := 0; (* *)
SEQ_RECUP_PROG.CMD02.10 := 0; (* *)
SEQ_RECUP_PROG.CMD02.11 := 0; (* *)
SEQ_RECUP_PROG.CMD02.12 := 0; (* *)
SEQ_RECUP_PROG.CMD02.13 := 0; (* *)
SEQ_RECUP_PROG.CMD02.14 := 0; (* *)
SEQ_RECUP_PROG.CMD02.15 := 0; (* *)

SEQ_RECUP_PROG.INT01 := 0; (* *)
SEQ_RECUP_PROG.INT02 := 0; (* *)

SEQ_RECUP_PROG.ETAT01 := 0; (* *)

DES_RECUP_PROG.NOM_ETAPE := 'Attente lancement d un transfert';
DES_RECUP_PROG.DESCRIP_TRANSITION := 'Attente marche et Conditions initiales';

(*ATTENTE DMD RECUPERATION PROGRAMME*)
IF GES_PROCEDE.RP_Code_programme_a_recuperer <> 0 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;
SEQ_RECUP_PROG.NUM_ETAPE := 100;
END_IF;
END_IF;

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

(*Sauvegarde de la recette dans le DB associé au code recette*)
IF GES_PROCEDE.RP_Code_programme_a_recuperer < 10 THEN
GES_PROCEDE.RP_Nom_programme_recupere := STOCKAGE_PROG_001_010[GES_PROCEDE.RP_Code_programme_a_recuperer].NOM;
PROG_RECUP_ETAPES := STOCKAGE_PROG_001_010[GES_PROCEDE.RP_Code_programme_a_recuperer].ETAPES;
PROG_RECUP_COMP := STOCKAGE_PROG_001_010[GES_PROCEDE.RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF GES_PROCEDE.RP_Code_programme_a_recuperer >= 11 AND GES_PROCEDE.RP_Code_programme_a_recuperer < 21 THEN
GES_PROCEDE.RP_Nom_programme_recupere := STOCKAGE_PROG_011_020[GES_PROCEDE.RP_Code_programme_a_recuperer].NOM;
PROG_RECUP_ETAPES := STOCKAGE_PROG_011_020[GES_PROCEDE.RP_Code_programme_a_recuperer].ETAPES;
PROG_RECUP_COMP := STOCKAGE_PROG_011_020[GES_PROCEDE.RP_Code_programme_a_recuperer].COMPLEMENT;
END_IF;

IF GES_PROCEDE.RP_Code_programme_a_recuperer = STOCKAGE_PROG_AUTRE_CODE THEN

GES_PROCEDE.RP_Nom_programme_recupere := STOCKAGE_PROG_AUTRE.NOM;
PROG_RECUP_ETAPES := STOCKAGE_PROG_AUTRE.ETAPES;
PROG_RECUP_COMP := STOCKAGE_PROG_AUTRE.COMPLEMENT;
END_IF;

IF Tjrs_1 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;
SEQ_RECUP_PROG.NUM_ETAPE := 110;
END_IF;
END_IF;

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

GES_PROCEDE.RP_Dmd_recuperation := 1;

IF Tjrs_1 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;
SEQ_RECUP_PROG.NUM_ETAPE := 120;
END_IF;
END_IF;

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

IF GES_PROCEDE.RP_Dmd_recuperation = 0 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;
SEQ_RECUP_PROG.NUM_ETAPE := 130;
END_IF;
END_IF;

(*Etape 130 : Réinitialisation automate*)
IF SEQ_RECUP_PROG.NUM_ETAPE = 130 THEN

(*RAZ*)
GES_PROCEDE.RP_Code_programme_a_recuperer := 0;

PROG_RECUP_ETAPES := PROG_VIDE_ETAPES;
PROG_RECUP_COMP := PROG_VIDE_COMP;

IF Tjrs_1 THEN
SEQ_RECUP_PROG.T_100MS := 0;
SEQ_RECUP_PROG.T_1S := 0;
SEQ_RECUP_PROG.NUM_ETAPE := 10;
END_IF;
END_IF;