175 lines
8.9 KiB
Markdown
175 lines
8.9 KiB
Markdown
```pascal
|
|
// Block Type: FB
|
|
// Block Number: 1808
|
|
// Original Network Languages: LAD
|
|
|
|
FUNCTION_BLOCK "ProcedureProdTankRunOut"
|
|
{ S7_Optimized_Access := 'TRUE' }
|
|
VERSION : 0.1
|
|
|
|
VAR_STAT
|
|
mStepNum : Int;
|
|
mTimeStep : Int;
|
|
mTransition : Bool;
|
|
mPrdTnkMinLvl : Bool;
|
|
mAuxONS : Bool;
|
|
mAuxONS1 : Bool;
|
|
mPrdTank_RunOutTPON : Bool;
|
|
mPrdTank_RunOutTP0ON : Bool;
|
|
mPrdTank_RunOutTP1ON : Bool;
|
|
mToFllrStartPipeRunOutON : Bool;
|
|
mPrdTank_RunOutTP : "TP_TIME:v1.0";
|
|
mPrdTank_RunOutTP0 : "TP_TIME:v1.0";
|
|
mPrdTank_RunOutTP1 : "TP_TIME:v1.0";
|
|
mToFllrStartPipeRunOut : "TP_TIME:v1.0";
|
|
END_VAR
|
|
|
|
VAR_TEMP
|
|
mProdTankRanOut : Bool;
|
|
mAuxCalc1 : Real;
|
|
mAuxCalc2 : Real;
|
|
mProcSlctd : Bool;
|
|
mAuxCalcInt : Int;
|
|
mAuxCalcDInt : DInt;
|
|
mAuxCalcReal : Real;
|
|
END_VAR
|
|
|
|
BEGIN
|
|
|
|
// Network 1: Qualifier (Original Language: LAD)
|
|
|
|
"Procedure_Variables"."TM301_RunOut"."Qualifier" := ("System_RunOut_Variables"."FastChangeOverActivated" AND "Procedure_Variables"."TM301_Drain"."Latch" AND "Procedure_Variables"."First_Production"."Done" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem") OR ("gBlenderProdMode" AND "gBlenderSuppliesOk" AND "Procedure_Variables"."TM301_Drain"."Latch" AND "Procedure_Variables"."First_Production"."Done" AND "HMI_Blender_Parameters"."Processor_Options"."Blender_OPT"."_BlendFillSystem");
|
|
|
|
// Network 2: ProductTempRunOut (Original Language: LAD)
|
|
|
|
// Edge Logic handled by Coil 68
|
|
"ProdTankRunOutReq" := "Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND ("Procedure_Variables"."Syr_RunOut"."Latch" OR "Blender_Variables_Pers"."gWaterRecipe"); // P_TRIG("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND ("Procedure_Variables"."Syr_RunOut"."Latch" OR "Blender_Variables_Pers"."gWaterRecipe")) - Mem: "ProdTankRunOutReq"
|
|
|
|
"ProdTankRunOutReq_ONS" := ("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."Syr_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND NOT "ProdTankRunOutReq") OR ("Procedure_Variables"."TM301_RunOut"."Latch" AND "Blender_Variables_Pers"."gWaterRecipe" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND NOT "ProdTankRunOutReq");
|
|
"ProdTankRunOutReq" := "Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND ("Procedure_Variables"."Syr_RunOut"."Latch" OR "Blender_Variables_Pers"."gWaterRecipe"); // P_TRIG("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Done" AND "HMI_Variables_Cmd"."Commands_From_HMI"."CMD_TM301RunOutReq" AND ("Procedure_Variables"."Syr_RunOut"."Latch" OR "Blender_Variables_Pers"."gWaterRecipe")) - Mem: "ProdTankRunOutReq"
|
|
|
|
// Network 3: Reset (Original Language: LAD)
|
|
|
|
// PBox SymPy processed, logic in consumer
|
|
"ProdTankRunOutReset" := "Procedure_Variables"."TM301_RunOut"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated"; // P_TRIG("Procedure_Variables"."TM301_RunOut"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated") - Mem: "ProdTankRunOutReset"
|
|
|
|
"Procedure_Variables"."TM301_RunOut"."Reset" := ("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated" AND NOT "ProdTankRunOutReset") OR ("Procedure_Variables"."TM301_RunOut"."Request" AND "System_RunOut_Variables"."FastChangeOverActivated" AND "Procedure_Variables"."TM301_RunOut"."Done" AND NOT "ProdTankRunOutReset");
|
|
|
|
// Network 4: Wait (Original Language: LAD)
|
|
|
|
"Procedure_Variables"."TM301_RunOut"."Wait" := "gPTM304_OkToRun" OR "gIN_LinePressCO2Ok";
|
|
|
|
// Network 5: Reset (Original Language: LAD)
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Reset" THEN
|
|
"mStepNum" := 0;
|
|
END_IF;
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Reset" THEN
|
|
"Procedure_Variables"."TM301_RunOut"."Done" := FALSE;
|
|
END_IF;
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Reset" THEN
|
|
"System_RunOut_Variables"."ChillerPushDone" := FALSE;
|
|
END_IF;
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Reset" THEN
|
|
"gRinseClose_RMM301" := FALSE;
|
|
END_IF;
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Reset" THEN
|
|
"gRinseClose_RMP302" := FALSE;
|
|
END_IF;
|
|
|
|
// Network 6: Totalizer (Original Language: LAD)
|
|
|
|
SEL_R(G := "System_RunOut_Variables"."RMM301_OV_ProdPipeRunOut" > 0.0, IN0 := 0.0, IN1 := "Profibus_Variables"."gFTN301_Tot");
|
|
|
|
SEL_R(G := "System_RunOut_Variables"."RMP302_OV_ProdPipeRunOut" > 0.0, IN0 := 0.0, IN1 := "Profibus_Variables"."gFTP302_Tot");
|
|
|
|
"System_RunOut_Variables"."TM301_RunOut2"."Totalizer" := "mAuxCalc1" + "mAuxCalc2";
|
|
|
|
// Network 7: Counter (Original Language: LAD)
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Latch" AND "System_RunOut_Variables"."ChillerPushDone" AND "Procedure_Variables"."TM301_RunOut"."Done" THEN
|
|
"System_RunOut_Variables"."TM301_RunOut2"."Push_Count_Init" := "System_RunOut_Variables"."TM301_RunOut2"."Totalizer";
|
|
END_IF;
|
|
|
|
// Network 8: Counter Done (Original Language: LAD)
|
|
|
|
IF ("System_RunOut_Variables"."TM301_RunOut2"."Push_Count" > "System_RunOut_Variables"."TM301RunOutChillerAm") OR ("Procedure_Variables"."TM301_RunOut"."Latch" AND "System_RunOut_Variables"."ChillerPushDone" AND "gProductChillerEn") THEN
|
|
"System_RunOut_Variables"."ChillerPushDone" := TRUE;
|
|
END_IF;
|
|
|
|
// Network 9: Counter (Original Language: LAD)
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Latch" AND "System_RunOut_Variables"."ChillerPushDone" THEN
|
|
"System_RunOut_Variables"."TM301_RunOut2"."Push_Count" := "System_RunOut_Variables"."TM301_RunOut2"."Totalizer" - "System_RunOut_Variables"."TM301_RunOut2"."Push_Count_Init";
|
|
END_IF;
|
|
|
|
// Network 10: Counter Init (Original Language: LAD)
|
|
|
|
IF "HMI_Instrument"."LTM302"."PVFiltered" > 2.0 THEN
|
|
"System_RunOut_Variables"."TM301_RunOut2"."Push_Count_Init" := "System_RunOut_Variables"."FillerBottleCount" * "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_BottleSize";
|
|
END_IF;
|
|
|
|
// Network 11: Run Out (Original Language: LAD)
|
|
|
|
IF "System_RunOut_Variables"."ChillerPushDone" THEN
|
|
"mAuxCalc1" := "Blender_Variables"."gMinProduction" / 12.0;
|
|
END_IF;
|
|
|
|
IF "System_RunOut_Variables"."ChillerPushDone" THEN
|
|
"mAuxCalc1" := "Blender_Variables"."gProdTankBottomVol" - "mAuxCalc1";
|
|
END_IF;
|
|
|
|
"mProdTankRanOut" := "System_RunOut_Variables"."TM301_RunOut2"."Push_Count" > "mAuxCalc1";
|
|
|
|
// Network 12: Counter (Original Language: LAD)
|
|
|
|
IF "System_RunOut_Variables"."ChillerPushDone" THEN
|
|
"mAuxCalc1" := "System_RunOut_Variables"."FillerBottleCount" * "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_BottleSize";
|
|
END_IF;
|
|
|
|
IF "System_RunOut_Variables"."ChillerPushDone" THEN
|
|
"System_RunOut_Variables"."TM301_RunOut2"."Push_Count" := "mAuxCalc1" - "System_RunOut_Variables"."TM301_RunOut2"."Push_Count_Init";
|
|
END_IF;
|
|
|
|
// Network 13: Latch (Original Language: LAD)
|
|
|
|
"mProcSlctd" := "Procedure_Variables"."TM301_RunOut"."Latch";
|
|
|
|
// Network 14: Latch (Original Language: LAD)
|
|
|
|
"Procedure_Variables"."TM301_RunOut"."Latch" := ("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Reset" AND "FirstScan" AND "Procedure_Variables"."TM301_RunOut"."Done") OR ("Procedure_Variables"."TM301_RunOut"."Request" AND "Procedure_Variables"."TM301_RunOut"."Reset" AND "FirstScan" AND "Procedure_Variables"."TM301_RunOut"."Done");
|
|
|
|
IF ("Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Reset" AND "FirstScan" AND "Procedure_Variables"."TM301_RunOut"."Done") OR ("Procedure_Variables"."TM301_RunOut"."Request" AND "Procedure_Variables"."TM301_RunOut"."Reset" AND "FirstScan" AND "Procedure_Variables"."TM301_RunOut"."Done") THEN
|
|
"HMI_Variables_Status"."Procedures"."BlenderStateNum" := 8;
|
|
END_IF;
|
|
|
|
// Network 15: Running (Original Language: LAD)
|
|
|
|
"Procedure_Variables"."TM301_RunOut"."Running" := "Procedure_Variables"."TM301_RunOut"."Latch" AND "Procedure_Variables"."TM301_RunOut"."Wait";
|
|
|
|
// Network 16: Product Tank Run Out Running (Original Language: LAD)
|
|
|
|
"HMI_Alarms"."gH_Status" := "Procedure_Variables"."TM301_RunOut"."Latch";
|
|
|
|
"HMI_Variables_Status"."Procedures"."TM301RunOutRun" := "Procedure_Variables"."TM301_RunOut"."Latch";
|
|
|
|
IF "Procedure_Variables"."TM301_RunOut"."Latch" THEN
|
|
Prod_Tank_RunOut_Seq(ProdTankRanOut := "mProdTankRanOut", mPrdTnkMinLvl := "mPrdTnkMinLvl", mStep := "mStepNum", mTime := "mTimeStep", mTransition := "mTransition");
|
|
END_IF;
|
|
|
|
// Network 17: MIX - ProdTank_RunOut (Original Language: LAD)
|
|
|
|
// Network 17 did not produce printable SCL code.
|
|
|
|
// Network 18: Run Out (Original Language: LAD)
|
|
|
|
"HMI_Variables_Status"."System_Run_Out"."TM301RunOutDone" := "Procedure_Variables"."TM301_RunOut"."Done";
|
|
|
|
END_FUNCTION_BLOCK
|
|
|
|
```
|