Simatic_XML_Parser_to_SCL/BlenderCtrl__Main_simplifie...

386 lines
12 KiB
Plaintext

// Block Name (Original): BlenderCtrl__Main
// Block Number: 2000
// Original Language: LAD
FUNCTION_BLOCK "BlenderCtrl__Main"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR_IN_OUT
END_VAR
VAR_TEMP
All_Auto_RETVAL : Int;
Reset_SP_Word_RETVAL : Int;
mResetWaterTot : Bool;
mResetSyrupTot : Bool;
mResetCO2Tot : Bool;
mResetProductTot : Bool;
Block_Move_Err : Int;
END_VAR
BEGIN
// Network 1: Clock Generation
Clock_Signal();
// Network 2: Machine Init
BlenderCtrl_MachineInit();
// Network 3: Filler Head
// RLO: "AUX FALSE"
// Network 4: Emergency Pressed
// RLO: "gIN_VoltageOk"
// Network 5: Air and CO2 pressure ok and auxiliary ok
// RLO: "gIN_LinePressCO2Ok"
// RLO: "gWorkshopTest"
// RLO: "gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")
// RLO: ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")
// RLO: ("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered"
// RLO: (NOT "Disable_Bit")
// RLO: (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR (NOT "Disable_Bit") AND "gIN_VoltageOk"
"gBlenderSuppliesOk" := (("gIN_LinePressCO2Ok" OR ("gWorkshopTest" AND (NOT "gWorkshop_Co2_Presence")) AND (NOT "gWorkshop_CIP_Signals")) AND "HMI_Digital"."_PAL_S11"."Filtered") OR (NOT "Disable_Bit") AND "gIN_VoltageOk";
// Network 6: Blender State Num
"HMI_Variables_Status"."Procedures"."BlenderStateNum" := 0;
// Network 7: Delay Power On
// RLO: "FirstScan"
// Network 8: Production Mode
// RLO: "HMI_Variables_Status"."System"."Blender_Prod_CIP"
"gBlenderProdMode" := "HMI_Variables_Status"."System"."Blender_Prod_CIP";
// Network 9: CIp Mode
// RLO: (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP")
"gBlenderCIPMode" := (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP");
IF (NOT "HMI_Variables_Status"."System"."Blender_Prod_CIP") THEN
"HMI_Variables_Status"."Procedures"."BlenderStateNum" := 19;
END_IF;
// Network 10: Error Faults
// RLO: (NOT "AUX FALSE")
// Network 11: Filler Bottle Count Used to push Product
// RLO: (NOT "System_RunOut_Variables"."ProdPipeRunOutWaterCount")
"System_RunOut_Variables"."ProdPipeRunOutFillerBott" := (NOT "System_RunOut_Variables"."ProdPipeRunOutWaterCount");
// Network 12: Water Bypass Enable
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass"
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_ByPassDeair"
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_ByPassDeair" AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Deaireation")
// RLO: ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass" OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_ByPassDeair" AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Deaireation"))) AND "Blender_Variables_Pers"."gWaterRecipe"
// RLO: (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass" OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_ByPassDeair" AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Deaireation"))) AND "Blender_Variables_Pers"."gWaterRecipe") AND (NOT "Blender_Variables_Pers"."gCarboStillRecipe")
"gStillWaterByPassEn" := (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass" OR ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_ByPassDeair" AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Deaireation"))) AND "Blender_Variables_Pers"."gWaterRecipe") AND (NOT "Blender_Variables_Pers"."gCarboStillRecipe");
// Network 13: Still Water Bypass
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem"
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass"
// RLO: ("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass") AND "Blender_Variables_Pers"."gWaterRecipe"
// RLO: (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass") AND "Blender_Variables_Pers"."gWaterRecipe") AND (NOT "Blender_Variables_Pers"."gCarboStillRecipe")
"gBlendFiStillWaterByPass" := (("HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_StillWaterByPass") AND "Blender_Variables_Pers"."gWaterRecipe") AND (NOT "Blender_Variables_Pers"."gCarboStillRecipe");
// Network 14: Manual Syrup Drain Valve Open - Operator Alarm
// RLO: "gSyrupRoomEn"
// RLO: "gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")
// RLO: ("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled")
// RLO: ("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done"
// RLO: (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done") AND (NOT "Procedure_Variables"."Syr_RunOut"."Done")
// RLO: "gBlenderCIPMode"
// RLO: "gBlenderCIPMode" AND "gIN_CIP_CIPRunning"
// RLO: ("gBlenderCIPMode" AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running"
"gHVP301_Open" := (("gSyrupRoomEn" AND (NOT "gIN_HVP301_Aux")) AND (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_FastChangeOverEnabled") AND "Procedure_Variables"."FTP302Line_Preparation"."Done") AND (NOT "Procedure_Variables"."Syr_RunOut"."Done") OR (("gBlenderCIPMode" AND "gIN_CIP_CIPRunning") AND "Procedure_Variables"."Blender_Run"."Running");
// Network 15: Manual Syrup Drain Valve Open - Operator Alarm
// RLO: "gIN_HVM302_Aux"
// Network 16: Maselli Control
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BrixMeter"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_MeterType" = 6 THEN
Maselli_PA_Control();
END_IF;
// Network 17: mPDS Control
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BrixMeter"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_MeterType" = 5 THEN
mPDS_PA_Control();
END_IF;
// Network 18: mPDS Syrup Control
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_SyrBrixMeter"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_SyrBrixMeter" THEN
mPDS_SYR_PA_Control();
END_IF;
// Network 19: Co2 Analog Input
// GetProdBrixCO2_FromAnalogIn
// CALL "GetProdBrixCO2_FromAn"
// NOP 0
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BrixMeter"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_MeterType" = 3 THEN
GetProdBrixCO2_Anal_Inpt();
END_IF;
// Network 20: Quality
ProductQuality();
// Network 21: Input Data
// ERROR: FB Call Input sin instancia
// Network 22: Sel Brix Source Check
SelCheckBrixSource();
// Network 23: Check Water Cooling System Temperature
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterRecirPumpPPM306"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_InverterRecirPumpPPM306" THEN
CTRLCoolingSystem();
END_IF;
// Network 24: Tank Level
TankLevel();
// Network 25: Production ONS
// RLO: "gBlenderProdMode"
// // PBox 26 - Passing memory bit: "M19001"
// RLO: "M19001" AND (NOT "mDelayPowerOnTmr")
"gProductionONS" := "M19001" AND (NOT "mDelayPowerOnTmr");
// Network 26: Blender Prod Mode Init
// RLO: "gProductionONS"
// RLO: "Procedure_Variables"."Blender_Rinse"."ONS_Done"
// RLO: ("gProductionONS" OR "Procedure_Variables"."Blender_Rinse"."ONS_Done") AND (NOT "Blender_Variables_Pers"."gBlenderStarted")
IF ("gProductionONS" OR "Procedure_Variables"."Blender_Rinse"."ONS_Done") AND (NOT "Blender_Variables_Pers"."gBlenderStarted") THEN
BlenderCtrl_ProdModeInit();
END_IF;
// Network 27: Rinse ONS
// RLO: "HMI_Variables_Status"."System"."Blender_Prod_CIP"
// // PBox 26 - Passing memory bit: "M19002"
// RLO: "M19002" AND (NOT "mDelayPowerOnTmr")
"gRinseONS" := "M19002" AND (NOT "mDelayPowerOnTmr");
// Network 28: CIP ONS
// RLO: "gBlenderCIPMode"
// // PBox 26 - Passing memory bit: "M19003"
// RLO: "M19003" AND (NOT "mDelayPowerOnTmr")
"gCIPONS" := "M19003" AND (NOT "mDelayPowerOnTmr");
// Network 29: CIp Mode Init
// RLO: "gCIPONS"
IF "gCIPONS" THEN
BlenderCtrl_CIPModeInit();
END_IF;
// Network 30: Reset SPWords
BlenderCtrl_ResetSPWord();
// Network 31: Blender Run Control
BlenderRun__Control();
// Network 32: Tank Pressure Control
Prod_Tank_PressCtrl();
// Network 33: Balaiage
Baialage();
// Network 34: First Production
// ERROR: FB Call ProcedureFirstProduction sin instancia
// Network 35: CIP MAIN Calling
CIPMain();
// Network 36: Blender Rinse
BlenderRinse();
// Network 37: Safeties
Safeties();
// Network 38: Instrument Scanner
Instrument_Scanner();
// Network 39: Vacuum Control
VacuumCtrl();
// Network 40: Syrup Room Control
SyrupRoomCtrl();
// Network 41: Blend Procedure Data
// RLO: (NOT "mDelayPowerOnTmr")
// ERROR: FB Call Procedure sin instancia
// Network 42: Pneumatic Valve Control
Pneumatic_Valve_Ctrl();
// Network 43: Pumps Control
PumpsControl();
// Network 44: Prod Report Manager
// RLO: "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Report"
IF "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Report" THEN
ProdReportManager();
END_IF;
// Network 45: Outputs
Output();
// Network 46: SLIM BLOCK
SLIM_Block();
// Network 47: Interlocking Panel 1
Interlocking_Panel_1();
// Network 48: Filler Control
FillerControl();
// Network 49: Blender Ctrl Update PWORD
BlenderCtrl_UpdatePWord();
// Network 50: ResetTotalizer
// RLO: "gBlendResetTotalizer"
// Network 51: ResetWaterTot
// RLO: "gFTN301_ResetTot"
// RLO: "mResetTotalizerTmr"
// Network 52: Water VFM Reset Totalizer
// RLO: "gFTN301_ResetTot"
// Network 53: ResetCO2Tot
// RLO: "gFTP302_ResetTot"
// RLO: "mResetTotalizerTmr"
// Network 54: Syrup MFM Reset Totalizer
// RLO: "gFTP302_ResetTot"
// Network 55: ResetProductTot
// RLO: "gFTM303_ResetTot"
// RLO: "mResetTotalizerTmr"
// Network 56: CO2 MFM Reset Tot
// RLO: "gFTM303_ResetTot"
// Network 57: ResetCO2Tot
// RLO: "gProductMFMResetTot"
// RLO: "mResetTotalizerTmr"
// Network 58: Reset Totalizer
// RLO: "gProductMFMResetTot"
// Network 59: Reset Totalizer
// RLO: "gBlendResetTotalizer"
// Network 60: Blender Ctrl Command
// RLO: (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation")
IF (NOT "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_Simulation") THEN
BlenderCtrl_MFM_Command();
END_IF;
// Network 61: DP Global Diag
CPU_DP_Global_Diag();
// Network 62: Profibus
Profibus_Network();
// Network 63: Valve Fault
ModValveFault();
// Network 64: All Auto
// RLO: "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command"
// RLO: "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Command" AND "HMI_Variables_Cmd"."Commands_From_HMI"."F7_DeviceControl"."Enable"
// Network 65: Ctrl HMI Manual Active
BlenderCtrl_ManualActive();
// Network 66: Mod Copy Recipe
// RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page"
// RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" AND (NOT "mFP_Recip_Main_Page")
"mAux_FP_M700_1" := "HMI_Variables_Cmd"."Recipe"."Main_Page" AND (NOT "mFP_Recip_Main_Page");
// RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page"
// RLO: "HMI_Variables_Cmd"."Recipe"."Main_Page" AND "HMI_Variables_Cmd"."Recipe"."Edit"
// RLO: "mAux_FP_M700_1"
// Network 67: to HMI - Recipe Management
// RLO: "AUX TRUE"
// ERROR: FB Call RecipeManagement___Prod sin instancia
// Network 68: Recipe Calculation
RecipeCalculation();
END_FUNCTION_BLOCK