Obsidean_VM/04-SIDEL/00 - MASTER/Source/source/PumpsControl.md

17 KiB

// Block Type: FC
// Block Number: 1870
// Original Network Languages: LAD, STL

FUNCTION "PumpsControl" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1

VAR_TEMP
  mWaterPumpRun : Bool;
  mWaterPump2Run : Bool;
  mSyrupPumpRun : Bool;
  mProductPump1Run : Bool;
  mProductPump2Run : Bool;
  mCIP_Return_PumpRun : Bool;
  P1_Water_Pump_Fault : Bool;
  P5_Water_Pump_Fault : Bool;
  P2_Syrup_Pump_Fault : Bool;
  P3_Product_Pump_Fault : Bool;
  P4_Vacuum_Pump_Fault : Bool;
  P5_Rinse_Tank_Pump_Fault : Bool;
  P6_Recircul_Pump_Fault : Bool;
  P7_CIP_Return_Pump_Fault : Bool;
  mP1_CIP_RunPump : Bool;
  P7_CIP_Return_Pump : Bool;
END_VAR

  #_1s : Bool; // Auto-generated temporary
  #_60S : Bool; // Auto-generated temporary
BEGIN

  // Network 1: DelayStartP1 (Original Language: LAD)

  "mP1_CIP_RunPump" := "HMI_Device"."PPM303"."Out" AND "HMI_Device"."AVM362"."Out" AND "CIP_Program_Variables"."Status"."Started" AND "gBlenderCIPMode";

  // Network 2: PPN301 Water Pump Run (Original Language: LAD)

  // Network 2 did not produce printable SCL code.

  // Network 3: DEOX Recovery completed (Original Language: LAD)

  IF ("AUX TRUE" AND "CIP_Program_Variables"."Status"."CausticRecoveryRun" AND "HMI_Digital"."LSN302L"."Filtered" AND "HMI_Digital"."LSN301L"."Filtered") OR ("AUX TRUE" AND "CIP_Program_Variables"."Status"."CausticRecoveryRun" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_DoubleDeair" AND "HMI_Digital"."LSN301L"."Filtered") THEN
    "M110.0" := TRUE;
  END_IF;

  IF "AUX TRUE" AND "CIP_Program_Variables"."Status"."CausticRecoveryRun" THEN
    "M110.0" := FALSE;
  END_IF;

  // Network 4: Pump PPN301Ctrl (Original Language: LAD)

  // Network 4 did not produce printable SCL code.

  // Network 5: Pump PPN301Alarm (Original Language: LAD)

  "HMI_Device"."PPN301"."Alarm" := "mPPN301_Pump" OR "DI_PPN301_Ovrld";

  // Network 6: Pump PPN301Start (Original Language: LAD)
  //   P1 Water Pump

  "HMI_Device"."PPN301"."Out" := ("HMI_Device"."PPN301"."Alarm" AND "HMI_Device"."PPN301"."ManOn" AND "gIN_VoltageOk") OR ("HMI_Device"."PPN301"."Alarm" AND "mWaterPumpRun" AND "HMI_Device"."PPN301"."Auto" AND "gIN_VoltageOk");

  // Network 7: Pump PPN301VFC (Original Language: LAD)

  IF "HMI_PID"."PPN301"."Config" THEN
    PPN301_VFC_Ctrl();
  END_IF;

  // Network 8: Pump PPN305 (Original Language: STL)
  //   PPN305

  // --- BEGIN STL Network 8 ---
   
     	A_BRACK
     	O_BRACK
     	A	"HMI_Digital".LSN302L.Filtered
     	A_BRACK
     	O	"gBlenderBlending"
     	O	"Procedure_Variables".Blender_Rinse.Running
     	BRACKET
     	L	S5T#3S_500MS
     	OnDelay	"mDelayStartPPN305Blend"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayStartPPN305Blend"
     	BRACKET
     	O
     	A_BRACK
     	A	"HMI_Digital".LSN302L.Filtered
     	A	"gBlenderCIPMode"
     	A_BRACK
     	ON	M110.0
     	ON	"CIP_Program_Variables".Status.CausticRecoveryRun
     	BRACKET
     	L	S5T#10S
     	OnDelay	"mDelayStartPPN305"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayStartPPN305"
     	BRACKET
     	A	"gBlenderStartPumps"
     	O
     	A	"HMI_Digital".LSN302L.Filtered
     	A	"gDeairTank_Loading"
     	O_BRACK
     	A	"HMI_Digital".LSN302L.Filtered
     	A	"gP_PPN305"
     	L	S5T#1S
     	OffDelay	"mDelayStopPPN305"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayStopPPN305"
     	BRACKET
     	O_BRACK
     	A	"HMI_Digital".LSN302L.Filtered
     	A	"gBlenderCIPMode"
     	A	"gIN_CIP_DrainRequest"
     	A	"gBlenderStartPumps"
     	L	S5T#20S
     	OffDelay	"mDelayCIPStopP5"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayCIPStopP5"
     	BRACKET
     	BRACKET
     	A	"HMI_Device".PPN305.Config
     	=	"mWaterPump2Run"
     	A	"mWaterPump2Run"
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._Simulation
     	=	"gOUT_PPN305_Run"
   
  // --- END STL Network 8 ---

  // Network 9: Pump PPN305 Alarm (Original Language: STL)
  //   PPN305

  // --- BEGIN STL Network 9 ---
   
     	A_BRACK
     	A_BRACK
     	A	"HMI_Device".PPN305.Out
     	AN	"DI_Water_Pump2_Contactor"
     	L	S5T#500MS
     	OnDelay	"mPPN305_Pump"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mPPN305_Pump"
     	BRACKET
     	=	"P5_Water_Pump_Fault"
     	A	"P5_Water_Pump_Fault"
     	O	"DI_Water_Pump2_Ovrld"
     	O
     	A	"HMI_Device".PPN305.Alarm
     	AN	"gIN_ResetBtn"
     	BRACKET
     	A	"HMI_Device".PPN305.Config
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._Simulation
     	=	"HMI_Device".PPN305.Alarm
   
  // --- END STL Network 9 ---

  // Network 10: Pump PPN305 Start (Original Language: LAD)
  //   P5 Water Pump

  "HMI_Device"."PPN305"."Out" := ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "HMI_Device"."PPN305"."ManOn") OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "mWaterPump2Run" AND "HMI_Device"."PPN305"."Auto") OR ("gIN_VoltageOk" AND "HMI_Device"."PPN305"."ManOn" AND "HMI_Device"."PPN305"."Alarm") OR ("gIN_VoltageOk" AND "mWaterPump2Run" AND "HMI_Device"."PPN305"."Auto" AND "HMI_Device"."PPN305"."Alarm");

  // Network 11: Pump PPP302 (Original Language: STL)

  // --- BEGIN STL Network 11 ---
   
     	A_BRACK
     	A_BRACK
     	A_BRACK
     	O	"HMI_Digital".LAL_S3.Filtered
     	O	"gIN_SyrTank_MinLvl"
     	BRACKET
     	A_BRACK
     	A	"gBlenderProdMode"
     	AN	"gBlenderRinseMode"
     	AN	"Blender_Variables_Pers".gWaterRecipe
     	A	"gBlenderStartPumps"
     	O	"gP_PPP302"
     	BRACKET
     	O_BRACK
     	A_BRACK
     	O	"HMI_Digital".LAL_S3.Filtered
     	O	"gIN_SyrTank_MinLvl"
     	BRACKET
     	A_BRACK
     	O	"gBlenderCIPMode"
     	O
     	A	"gBlenderRinseMode"
     	AN	"System_RunOut_Variables".FastChangeOverActivated
     	BRACKET
     	A	"gBlenderStartPumps"
     	AN	"HMI_Variables_Status".Procedures.CIP_SyrTankFloodRun
     	AN	"gCIP_SyrTank_Flood"
     	=	"gCIPRinseEnableRMP302"
     	A	"gCIPRinseEnableRMP302"
     	L	S5T#2S
     	OffDelay	"mDelayCIPStopP2"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayCIPStopP2"
     	BRACKET
     	BRACKET
     	L	S5T#600MS
     	OnDelay	"mDelayStartPPP302"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayStartPPP302"
     	BRACKET
     	A	"HMI_Device".PPP302.Config
     	=	"mSyrupPumpRun"
     	A	"mSyrupPumpRun"
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._Simulation
     	=	"gOUT_PPP302_Run"
   
  // --- END STL Network 11 ---

  // Network 12: Pump PPP302 Syrup Pump alarm (Original Language: LAD)

  // Network 12 did not produce printable SCL code.

  // Network 13: Pump PPP302 Syrup Pump alarm (Original Language: LAD)

  "HMI_Device"."PPP302"."Alarm" := ("mPPP302_Pump" AND "HMI_Device"."PPP302"."Config") OR ("DI_PPP302_Ovrld" AND "HMI_Device"."PPP302"."Config");

  // Network 14: Pump PPP302 Start (Original Language: LAD)
  //   P2 Syrup Pump

  "HMI_Device"."PPP302"."Out" := ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "HMI_Device"."PPP302"."ManOn") OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "mSyrupPumpRun" AND "HMI_Device"."PPP302"."Auto") OR ("gIN_VoltageOk" AND "HMI_Device"."PPP302"."Alarm" AND "HMI_Device"."PPP302"."ManOn") OR ("gIN_VoltageOk" AND "HMI_Device"."PPP302"."Alarm" AND "mSyrupPumpRun" AND "HMI_Device"."PPP302"."Auto");

  // Network 15: Pump PPP302 VFC (Original Language: LAD)

  IF "HMI_PID"."PPP302"."Config" THEN
    PPP302_VFC_Ctrl();
  END_IF;

  // Network 16:  (Original Language: LAD)

  // Network 16 did not produce printable SCL code.

  // Network 17: Product Pump 1 PPM303 Run (Original Language: LAD)

  // Network 17 did not produce printable SCL code.

  // Network 18: Product Pump 1 PPM303 Start (Original Language: LAD)
  //   P3 Product Pump

  "HMI_Device"."PPM303"."Out" := ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND (("mProductPump1Run" AND "HMI_Device"."PPM303"."Auto") OR ("HMI_PID"."PPM303"."ManualControl"."ManOut" AND (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Device"."PPM303"."ManOn") OR ("HMI_Device"."PPM303"."ManOn" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterProdPumpPPM303"))))) OR ("gIN_VoltageOk" AND "HMI_Device"."PPM303"."Alarm" AND (("mProductPump1Run" AND "HMI_Device"."PPM303"."Auto") OR ("HMI_PID"."PPM303"."ManualControl"."ManOut" AND (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Device"."PPM303"."ManOn") OR ("HMI_Device"."PPM303"."ManOn" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterProdPumpPPM303")))));

  // Network 19: Product Pump 1 PPM303 Ctrl (Original Language: LAD)

  // Network 19 did not produce printable SCL code.

  // Network 20: Product Pump 1 PPM303 Alarm (Original Language: LAD)

  "HMI_Device"."PPM303"."Alarm" := ("DI_PPM303_Ovrld" AND "HMI_Device"."PPM303"."Config") OR ("mPPM303_Pump" AND "HMI_Device"."PPM303"."Config");

  // Network 21: Product Pump 1 PPM303 VFC (Original Language: LAD)

  IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" OR "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterProdPumpPPM303" THEN
    PPM303_VFC_Ctrl();
  END_IF;

  // Network 22: Product Pump 2 PPM305 Run (Original Language: LAD)

  // Network 22 did not produce printable SCL code.

  // Network 23: Product Pump 2 PPM305 Start (Original Language: LAD)
  //   P3 Product Pump

  "HMI_Device"."PPM305"."Out" := ("mProductPump2Run" AND "HMI_Device"."PPM305"."Auto") OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Device"."PPM305"."ManOn" AND "HMI_PID"."PPM305"."ManualControl"."ManOut") OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterProdPumpPPM303" AND "HMI_Device"."PPM305"."ManOn" AND "HMI_PID"."PPM305"."ManualControl"."ManOut");

  // Network 24: Product Pump 2 PPM305 Alarm (Original Language: LAD)

  "HMI_Device"."PPM305"."Alarm" := ("DI_PPM303_Ovrld" AND "HMI_Device"."PPM305"."Config") OR ("gIN_ResetBtn" AND "HMI_Device"."PPM303"."Alarm" AND "HMI_Device"."PPM305"."Config");

  // Network 25: Product Pump 2 PPM305 VFC (Original Language: LAD)

  IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" OR "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterProdPumpPPM303" THEN
    PPM305_VFC_Ctrl();
  END_IF;

  // Network 26: Vacuum Pump PPN304 Run (Original Language: LAD)

  "gOUT_PPN304_Run" := ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "gBlenderProdMode" AND "gP_PPN304" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_Deareation_Vacum" AND "HMI_Device"."PPN304"."Config" AND "HMI_Alarms"."gH_Message") OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation" AND "gBlenderProdMode" AND "gStillWaterByPassEn" AND "Procedure_Variables"."TN301_StartUp"."Done" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_Deareation_Vacum" AND "HMI_Device"."PPN304"."Config" AND "HMI_Alarms"."gH_Message");

  // Network 27: Vacuum Pump PPN304 Ctrl (Original Language: LAD)

  // Network 27 did not produce printable SCL code.

  // Network 28: Vacuum Pump PPN304 Alarm (Original Language: LAD)

  "HMI_Device"."PPN304"."Alarm" := ("HMI_Device"."PPN304"."Config" AND "mPPN304_Pump") OR ("HMI_Device"."PPN304"."Config" AND "DI_PPM305_Ovrld");

  // Network 29: Vacuum Pump PPN304 Start (Original Language: LAD)
  //   P4 Vacuum Pump

  "HMI_Device"."PPN304"."Out" := ("gIN_VoltageOk" AND "HMI_Device"."PPN304"."Alarm" AND "HMI_Device"."PPN304"."ManOn") OR ("gIN_VoltageOk" AND "HMI_Device"."PPN304"."Alarm" AND "gOUT_PPN304_Run" AND "HMI_Device"."PPN304"."Auto");

  // Network 30: Recycle Pump PPM306 Run (Original Language: LAD)

  "gOUT_PPM306_Run" := ("gBlendRecircActive" AND "gBlenderProdMode" AND "gBlenderRinseMode" AND "gBlenderMinLevel" AND "HMI_Device"."PPM306"."Config") OR ("gBlenderProdMode" AND "gBlenderRinseMode" AND "gBlenderStartPumps" AND "gBlenderMinLevel" AND "HMI_Device"."PPM306"."Config");

  // Network 31: Recycle Pump PPM306 Start (Original Language: LAD)
  //   P6 Recirculation Pump

  "HMI_Device"."PPM306"."Out" := ("gIN_VoltageOk" AND "HMI_Device"."PPM306"."ManOn" AND "HMI_Device"."PPM306"."Alarm") OR ("gIN_VoltageOk" AND "gOUT_PPM306_Run" AND "HMI_Device"."PPM306"."Auto" AND "HMI_Device"."PPM306"."Alarm");

  // Network 32: Recycle Pump PPN306 Alarm (Original Language: LAD)

  "mPPM306_Pump"(IN := "HMI_Device"."PPM306"."Out" AND "DI_PPM306_Contactor", PT := S5T#1s); // TODO: Declarar "mPPM306_Pump" : TON;

  "HMI_Device"."PPM306"."Alarm" := ("mPPM306_Pump".Q AND "HMI_Device"."PPM306"."Config") OR ("gIN_ResetBtn" AND "HMI_Device"."PPM306"."Alarm") OR ("HMI_Device"."PPM306"."Config" AND "DI_PPM306_Ovrld");

  // Network 33: CIP  Pump PPM307 Run (Original Language: STL)
  //   CIP Pump

  // --- BEGIN STL Network 33 ---
   
     	A_BRACK
     	O_BRACK
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem
     	A	"gProdAvailable"
     	A_BRACK
     	A	"gBlenderMinLevel"
     	A_BRACK
     	A	"gOUT_FillerMinimumLevel"
     	A	"gIN_Filler1ProductReq"
     	O	"gBlendRecircActive"
     	BRACKET
     	O
     	AN	"gPrdTank_Empty"
     	A_BRACK
     	O	"Procedure_Variables".TM301_RunOut.Latch
     	O	"System_RunOut_Variables".ProdPipe_RunOut.Latch
     	BRACKET
     	BRACKET
     	L	S5T#4S
     	OffDelay	"mDelayProdStopPPM303"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayProdStopPPM303"
     	BRACKET
     	O
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem
     	A	"gBlenderMinLevel"
     	A_BRACK
     	O	"Procedure_Variables".First_Production.Running
     	O
     	A	"gWorkshopTest"
     	A	"Procedure_Variables".Blender_Run.Latch
     	O
     	A	"Procedure_Variables".Blender_Run.Latch
     	A	"gEnRecircPHE"
     	BRACKET
     	O_BRACK
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem
     	A	"Procedure_Variables".Blender_Run.Latch
     	A_BRACK
     	O	"gBlenderMinLevel"
     	ON	"gPrdTank_Empty"
     	BRACKET
     	A_BRACK
     	AN	"HMI_Variables_Status".Procedures.CIP_ProdTankFloodRun
     	AN	"gIN_CIP_TankFilling"
     	A	"gIN_FillerCIPRequest"
     	A	"gBlenderCIPMode"
     	O
     	AN	"System_RunOut_Variables".FastChangeOverActivated
     	A	"gBlenderRinseMode"
     	BRACKET
     	L	S5T#4S
     	OffDelay	"mDelayCIPStopPPM303"
     	NOP_0
     	NOP_0
     	NOP_0
     	A	"mDelayCIPStopPPM303"
     	BRACKET
     	O
     	A	"HMI_Digital".LSM302L.Filtered
     	A	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem
     	A_BRACK
     	A	"gBlenderProdMode"
     	AN	"gBlenderRinseMode"
     	O
     	A	"Procedure_Variables".Blender_Run.Latch
     	A_BRACK
     	A	"gBlenderCIPMode"
     	A	"gIN_CIP_CIPRunning"
     	AN	"HMI_Variables_Status".Procedures.CIP_ProdTankFloodRun
     	AN	"gIN_CIP_TankFilling"
     	O
     	A	"gBlenderRinseMode"
     	A	"System_RunOut_Variables".In_Flr_WaterRinseRequest
     	BRACKET
     	A	"HMI_Device".AVM362.Out
     	BRACKET
     	A	"HMI_PID".PPM303.ManualControl.PidEnable
     	O
     	A	"HMI_Digital".LSM302L.Filtered
     	A	"gP_PPM303"
     	BRACKET
     	A	"HMI_Device".PPM307.Config
     	=	"mCIP_Return_PumpRun"
     	A	"mCIP_Return_PumpRun"
     	AN	"HMI_Blender_Parameters".Processor_Options.Blender_OPT._Simulation
     	=	"gOUT_PPM307_Run"
   
  // --- END STL Network 33 ---

  // Network 34: MIX -  PPM307 CIP Pump Run (Original Language: LAD)

  "gOUT_PPM307_Run" := "HMI_Device"."PPM303"."Out" AND "HMI_Device"."AVM362"."Out" AND "gBlenderCIPMode" AND "Procedure_Variables"."Blender_Run"."Latch" AND "HMI_Device"."PPM307"."Config";

  // Network 35: CIP  Pump PPM307 Out (Original Language: LAD)
  //   P7 CIP Return Pump

  "HMI_Device"."PPM307"."Out" := ("gIN_VoltageOk" AND "HMI_Device"."PPM307"."ManOn" AND "HMI_Device"."PPM307"."Alarm") OR ("gIN_VoltageOk" AND "gOUT_PPM307_Run" AND "HMI_Device"."PPM307"."Auto" AND "HMI_Device"."PPM307"."Alarm");

  // Network 36: Syrup Room Water Request (Original Language: LAD)

  "HMI_Device"."SyrupRoom_WaterPump"."Out" := ("Procedure_Variables"."Syr_RunOut"."Latch" AND "gWorkshopTest" AND "gBlenderProdMode") OR ("gSyrupQcoRinse" AND "gWorkshopTest" AND "gBlenderProdMode") OR ("System_RunOut_Variables"."FastChangeOverActivated" AND "gWorkshopTest" AND "Procedure_Variables"."Blender_Run"."Latch" AND "gBlenderRinseMode");

  // Network 37: Syrup Room Water Alarm (Original Language: LAD)

  "mSyrRoomH2OPumpFaultDly"(IN := "gWorkshopTest" AND "HMI_Device"."SyrupRoom_WaterPump"."Out" AND "DI_SyrRoom_WatPumpReady" AND "gSyrupRoomEn" AND "AUX FALSE" AND "gIN_ResetBtn" AND "gBlenderProdMode", PT := S5T#60S); // TODO: Declarar "mSyrRoomH2OPumpFaultDly" : TON;

  "HMI_Device"."SyrupRoom_WaterPump"."Alarm" := "mSyrRoomH2OPumpFaultDly".Q OR ("HMI_Device"."SyrupRoom_WaterPump"."Alarm" AND "gIN_ResetBtn");

  // Network 38: Syrup Room Syrup Pump (Original Language: LAD)

  // Network 38 did not produce printable SCL code.

  // Network 39:  (Original Language: LAD)

  // Network 39 has no logic elements.

END_FUNCTION