8.3 KiB
8.3 KiB
FUNCTION_BLOCK "BlenderPID_ActualRecipe"
{ S7_Optimized_Access := 'FALSE' }
AUTHOR : 'Author'
FAMILY : TASK1
NAME : 'Name'
VERSION : 1.0
VAR
mPrevRecipeName : String[32];
END_VAR
BEGIN
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._BrixMeter AND (("HMI_Blender_Parameters".Processor_Options.Blender_OPT._MeterType <>3 OR "HMI_Blender_Parameters".Processor_Options.Blender_OPT._MeterType <>4
AND "Blender_Variables".gProductRecipeNum <> "HMI_Blender_Parameters".Actual_Recipe_Parameters._ProdMeterRecipeNum)
OR "HMI_Blender_Parameters".Processor_Options.Blender_OPT._MeterType = 4) AND NOT "gBlenderCIPMode" AND NOT "mPDS_PA_Data".Input_From_mPDS.gPAmPDS_ReceiveOnly THEN
"gProdMeterTransferRecipe" := TRUE ;
END_IF ;
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._Promass = 1 THEN
"HMI_Blender_Parameters".Actual_Recipe_Parameters._Type := 1 ;
"HMI_Blender_Parameters".Actual_Recipe_Parameters._Ratio := 20 ;
END_IF ;
CASE "HMI_Blender_Parameters".Actual_Recipe_Parameters._Type OF
1: // Recipe Diet Type
"Blender_Variables_Pers".gSugarBeverage := FALSE ;
"gNotARecipe_Fault" := FALSE ;
2: // Recipe Regular Type
"Blender_Variables_Pers".gSugarBeverage := TRUE ;
"gNotARecipe_Fault" := FALSE ;
3: // Recipe Ratio Type
"Blender_Variables_Pers".gSugarBeverage := TRUE ;
"gNotARecipe_Fault" := FALSE ;
ELSE:
"gNotARecipe_Fault" := TRUE ;
"Blender_Variables_Pers".gSugarBeverage := FALSE ;
END_CASE;
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._CoolerPresent AND ("HMI_Blender_Parameters".Processor_Options.Blender_OPT._CoolerControl >= 1) AND "HMI_Blender_Parameters".Actual_Recipe_Parameters._EnProdTemp THEN
"Blender_Variables_Pers".gCoolerEnabled := TRUE ;
ELSE
"Blender_Variables_Pers".gCoolerEnabled := FALSE ;
END_IF;
IF NOT "HMI_Blender_Parameters".Processor_Options.Blender_OPT._CarboPresent THEN
(* classic code: "HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols := 0.0 ;*)
"HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols := REAL#0.0 ;
END_IF;
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._CO2_GAS2_Injection AND ("HMI_Blender_Parameters".Processor_Options.Blender_OPT._VacuumPump >= 1) THEN
(* classic code: IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > 0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > 0.1 ) AND NOT "HMI_Blender_Parameters".Actual_Recipe_Parameters._GAS2_Injection THEN*)
IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > REAL#0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > REAL#0.1 ) AND NOT "HMI_Blender_Parameters".Actual_Recipe_Parameters._GAS2_Injection THEN
"Blender_Variables_Pers".gCarboStillRecipe := TRUE ;
ELSE
"Blender_Variables_Pers".gCarboStillRecipe := FALSE ;
END_IF;
ELSE
IF #mPrevRecipeName <> "HMI_Blender_Parameters".Actual_Recipe_Parameters._Name THEN
(* classic code: IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > 0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > 0.1 ) THEN*)
IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > REAL#0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > REAL#0.1 ) THEN
"Blender_Variables_Pers".gCarboStillRecipe := TRUE ;
ELSE
"Blender_Variables_Pers".gCarboStillRecipe := FALSE ;
END_IF;
END_IF;
END_IF;
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._CO2_GAS2_Injection AND "HMI_Blender_Parameters".Actual_Recipe_Parameters._GAS2_Injection THEN
// IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > 0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > 0.1 ) THEN
// "Blender_Variables_Pers".gCarboStillProduct := TRUE ;
// ELSE
"Blender_Variables_Pers".gCarboStillProduct := FALSE ;
(* classic code: "HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols := 0.0 ;*)
"HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols := REAL#0.0 ;
(* classic code: "HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact := 0.0 ;*)
"HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact := REAL#0.0 ;
// END_IF;
ELSE
(* classic code: IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > 0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > 0.1 ) THEN*)
IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > REAL#0.1) AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Fact > REAL#0.1 ) THEN
"Blender_Variables_Pers".gCarboStillProduct := TRUE ;
ELSE
"Blender_Variables_Pers".gCarboStillProduct := FALSE ;
END_IF;
END_IF;
//IF NOT "HMI_Blender_Parameters".Processor_Options.Blender_OPT._CO2_GAS2_Injection AND ("HMI_Blender_Parameters".Actual_Recipe_Parameters._CO2Vols > 0.1) THEN
// "HMI_Blender_Parameters".Actual_Recipe_Parameters._GAS2_Injection := true;
//END_IF;
"gActualSP_RatioVol" := "HMI_Blender_Parameters".Actual_Recipe_Parameters._Ratio ;
IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._Ratio > 19) THEN
"Blender_Variables_Pers".gWaterRecipe := TRUE ;
"Blender_Variables_Pers".gSugarBeverage := FALSE ;
ELSE
"Blender_Variables_Pers".gWaterRecipe := FALSE ;
END_IF;
IF ("HMI_Blender_Parameters".Processor_Options.Blender_OPT._ByPassDeair AND NOT "HMI_Blender_Parameters".Actual_Recipe_Parameters._EnDeaireation) OR
("HMI_Blender_Parameters".Processor_Options.Blender_OPT._StillWaterByPass AND "Blender_Variables_Pers".gWaterRecipe AND
NOT "Blender_Variables_Pers".gCarboStillRecipe) THEN
"Blender_Variables_Pers".gSkipDeaireation := TRUE ;
ELSE
"Blender_Variables_Pers".gSkipDeaireation := FALSE ;
END_IF;
IF ("HMI_Blender_Parameters".Actual_Recipe_Parameters._ProductionRate > "Blender_Variables".gMinProduction) AND NOT "HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem THEN
"Blender_Variables".gProdTankStartLvl := "Blender_Constants".gStartLvl_NormalSpeed ;
ELSE
"Blender_Variables".gProdTankStartLvl := "Blender_Constants".gStartLvl_VeryLowSpeed ;
END_IF ;
IF "HMI_Blender_Parameters".Processor_Options.Blender_OPT._BlendFillSystem THEN
(* "Blender_Variables".gProdTankStopLvl := "Blender_Constants".gStopLvl_BlendFill ;
"Blender_Variables".gProdTankTargetLvl := "Blender_Constants".gTargetLvl_BlendFill ;*)
(* classic code: "Blender_Variables".gProdTankStopLvl := ((("HMI_Blender_Parameters".ProcessSetup._FillingValveHeight + "HMI_Blender_Parameters".Actual_Recipe_Parameters._FillingValveHead_SP) -
"HMI_Blender_Parameters".ProcessSetup._TM301Height_0) / "Blender_Variables".gBufferTankProbeHeight) * 100.0 ;*)
"Blender_Variables".gProdTankStopLvl := ((("HMI_Blender_Parameters".ProcessSetup._FillingValveHeight + "HMI_Blender_Parameters".Actual_Recipe_Parameters._FillingValveHead_SP) -
"HMI_Blender_Parameters".ProcessSetup._TM301Height_0) / "Blender_Variables".gBufferTankProbeHeight) * REAL#100.0;
(* classic code: "Blender_Variables".gProdTankStopLvl := LIMIT(MN:= 30.0, IN:= "Blender_Variables".gProdTankStopLvl, MX:= 80.0);*)
"Blender_Variables".gProdTankStopLvl := LIMIT(MN := REAL#30.0, IN := "Blender_Variables".gProdTankStopLvl, MX := REAL#50);//80.0);
(* classic code: "Blender_Variables".gProdTankTargetLvl := "Blender_Variables".gProdTankStopLvl - 15.0 ;*)
"Blender_Variables".gProdTankTargetLvl := "Blender_Variables".gProdTankStopLvl - REAL#15.0;
(* classic code: "Blender_Variables".gProdTankStartLvl := 10.0 ;*)
"Blender_Variables".gProdTankStartLvl := REAL#20.0;
ELSE
"Blender_Variables".gProdTankStopLvl := "Blender_Constants".gStopLvl_OnlyBlend;
"Blender_Variables".gProdTankTargetLvl := "Blender_Constants".gTargetLvl_OnlyBlend;
END_IF;
IF "HMI_Blender_Parameters".Actual_Recipe_Parameters._PrdTankMinLevel > "Blender_Variables".gProdTankTargetLvl THEN
"Blender_Variables".gProdTankTargetLvl := "HMI_Blender_Parameters".Actual_Recipe_Parameters._PrdTankMinLevel ;
END_IF;
#mPrevRecipeName := "HMI_Blender_Parameters".Actual_Recipe_Parameters._Name ;
END_FUNCTION_BLOCK