```pascal // Block Type: FB // Block Number: 1805 // Original Network Languages: LAD FUNCTION_BLOCK "ProcedureFirstProduction" { S7_Optimized_Access := 'TRUE' } VERSION : 0.1 VAR_STAT Switch_Level : Real; mFirstProdONS : Bool; mAuxONS : Bool; mFirstProdTPON : Bool; mFirstProdTP1ON : Bool; mAuxTPON : Bool; mDelaySyrOkON : Bool; mTimeDoneON : Bool; mFirstProdTP : "TP_TIME:v1.0"; mFirstProdTP1 : "TP_TIME:v1.0"; mAuxTP : "TP_TIME:v1.0"; mDelaySyrOk : "TON_TIME:v1.0"; mTimeDone : "TON_TIME:v1.0"; END_VAR VAR_TEMP Switch_Level_RETVAL : Int; mFirstProdCountDone : Bool; mInitialSyrupOk : Bool; mSyrupCountInit : Real; Syrup_K : Real; Syrup_SUB : Real; SyrupLiters_MUL : Real; Syrup_Brix_SUB : Real; Syrup_Brix_ABS : Real; Delta_Brix_MUL : Real; Syrup_Brix_MUL : Real; END_VAR #_10S : Bool; // Auto-generated temporary #TON_INSTANCE_46 : Bool; // Auto-generated temporary BEGIN // Network 1: Qualifier (Original Language: LAD) "Procedure_Variables"."First_Production"."Qualifier" := ("gBlenderProdMode" AND "gBlenderRinseMode" AND "gBlenderSuppliesOk") OR ("gBlenderProdMode" AND "gBlenderRinseMode" AND "Procedure_Variables"."First_Production"."Done"); // Network 2: FirstProd (Original Language: LAD) // Exceptionally the Request Bit is Latched in order TO save it FOR the next // Production switching "Procedure_Variables"."First_Production"."Request" := "gBlenderCIPMode" OR ("gBlenderRinseMode" AND "Procedure_Variables"."First_Production"."Done") OR ("Procedure_Variables"."First_Production"."Done" AND "Procedure_Variables"."First_Production"."Request"); // Network 3: Reset (Original Language: LAD) // PBox SymPy processed, logic in consumer "FirstProductiontReset" := "Procedure_Variables"."First_Production"."Done" AND "Procedure_Variables"."First_Production"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated"; // P_TRIG("Procedure_Variables"."First_Production"."Done" AND "Procedure_Variables"."First_Production"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated") - Mem: "FirstProductiontReset" "Procedure_Variables"."First_Production"."Reset" := "Procedure_Variables"."First_Production"."Qualifier" OR "Procedure_Variables"."Blender_Rinse"."ONS_Done"; // Network 4: Reset (Original Language: LAD) IF "Procedure_Variables"."First_Production"."Reset" THEN "mFirstProdCountDone" := FALSE; END_IF; IF "Procedure_Variables"."First_Production"."Reset" THEN "Blender_Variables_Pers"."gFirstProdLatched" := FALSE; END_IF; IF "Procedure_Variables"."First_Production"."Reset" THEN "Procedure_Variables"."First_Production"."Done" := FALSE; END_IF; // Network 5: Wait (Original Language: LAD) // Wait UNTIL Production is Selected "Procedure_Variables"."First_Production"."Wait" := "gBlenderProdMode"; // Network 6: Latched (Original Language: LAD) // Network 6 did not produce printable SCL code. // Network 7: LEVEL - Stop Blender when First Production Done (Original Language: LAD) // Network 7 did not produce printable SCL code. // Network 8: Count Init (Original Language: LAD) IF "Procedure_Variables"."FTP302Line_Preparation"."Done" AND "gPV_SyrDensOk" AND "Blender_Variables_Pers"."gFirstProdLatched" THEN "mSyrupCountInit" := "HMI_Variables_Status"."Analog_Values"."SyrupTotalizerLt"; END_IF; // Network 9: Prod Count Done (Original Language: LAD) // During Fisrt Production the SyrupRunOutLiters Parameters is multiplied BY 1.3 // (30% more syrup) AND used TO state when all the Low Brix Syrup is ran Out "Syrup_K" := "Blender_Variables_Pers"."gSyrupTotal" / "Blender_Variables"."gActualSyrupDens"; "Syrup_SUB" := "Syrup_K" - "mSyrupCountInit"; "SyrupLiters_MUL" := "HMI_Blender_Parameters"."ProcessSetup"."_SyrupRunOutLiters" * 1.0; "mFirstProdCountDone" := "Syrup_SUB" > "SyrupLiters_MUL"; // Network 10: Latch (Original Language: LAD) "Procedure_Variables"."First_Production"."Latch" := ("Procedure_Variables"."First_Production"."Reset" AND "FirstScan" AND "Procedure_Variables"."First_Production"."Done" AND "Procedure_Variables"."First_Production"."Request") OR ("Procedure_Variables"."First_Production"."Reset" AND "FirstScan" AND "Procedure_Variables"."First_Production"."Done" AND "Procedure_Variables"."First_Production"."Latch"); // Network 11: First Production Running (Original Language: LAD) "Procedure_Variables"."First_Production"."Running" := "Procedure_Variables"."First_Production"."Wait" AND "Procedure_Variables"."First_Production"."Latch"; "HMI_Alarms"."gH_Status" := "Procedure_Variables"."First_Production"."Wait" AND "Procedure_Variables"."First_Production"."Latch"; "HMI_Variables_Status"."Procedures"."FirstProdRun" := "Procedure_Variables"."First_Production"."Latch"; // Network 12: Reset Totalizer (Original Language: LAD) // Network 12 did not produce printable SCL code. // Network 13: DelaySyrOK (Original Language: LAD) "Syrup_Brix_MUL" := "Blender_Variables"."gMeterSyrBrix" * "HMI_Recipe_Edit"."Actual_Recipe_Parameters"."_SyrupFactor"; "Syrup_Brix_SUB" := "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_SyrupBrix" - "Syrup_Brix_MUL"; "Delta_Brix_MUL" := "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_MaxSyrDeltaBrix" * 0.8; // Network 14: FirstProdDone (Original Language: LAD) // First production stops when product tank level gets MAX Lvel (80%) OR when the // Syrup Brix Error is minimum #TON_INSTANCE_46(IN := ("gBlenderLevelTarget" AND "gBlenderBlending" AND "AUX FALSE" AND "mInitialSyrupOk" AND "Procedure_Variables"."First_Production"."Latch") OR ("gBlenderLevelTarget" AND "gBlenderBlending" AND "AUX FALSE" AND "gSyrupRoomEn" AND "Procedure_Variables"."First_Production"."Latch"), PT := T#10S); // TODO: Declarar #TON_INSTANCE_46 : TON; "Procedure_Variables"."First_Production"."Done" := "mTimeDoneON" OR ("gBlenderRinseMode" AND "gBlenderStopLevel" AND "Procedure_Variables"."First_Production"."Latch"); // Network 15: FirstProdDone (Original Language: LAD) "HMI_Variables_Status"."System_Run_Out"."FirstProductionDone" := "Procedure_Variables"."First_Production"."Done"; END_FUNCTION_BLOCK ```