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

4.3 KiB

// Block Type: FC
// Block Number: 2021
// Original Network Languages: STL, LAD
// Block Comment:
//   TASK2

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

VAR_TEMP
  gR_CO2_SP_Real : Real;
  gR_CO2_SP_Int : Word;
  gR_CO2_SP_DInt : DInt;
  gR_CO2_Max : Int;
  gR_CO2_Min : Int;
  mAux : Bool;
  mSel : Bool;
  mAuxCalc : Real;
  mAuxDInt : DInt;
  mCO2InjOffset : Real;
  mCO2TestReq : Bool;
END_VAR

BEGIN

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

  "gR_CO2_SP_Real" := "Blender_Variables"."gCarboCO2Error" * "Blender_Variables"."gK_RecCarboCO2Error";

  "gR_CO2_SP_Real" := "HMI_PID"."RMM303"."Sp" - "gR_CO2_SP_Real";

  LIMIT_R(IN := "gR_CO2_SP_Real", MN := "HMI_Blender_Parameters"."ProcessSetup"."_InjCO2Press_MinFlow", MX := "HMI_Blender_Parameters"."ProcessSetup"."_InjCO2Press_MaxFlow");

  // Network 2: Max Value (Original Language: LAD)

  // Network 2 did not produce printable SCL code.

  // Network 3: Min Value (Original Language: LAD)

  // Network 3 did not produce printable SCL code.

  // Network 4: Offset (Original Language: LAD)

  "HMI_Instrument"."PCM306_Offset"."Zero" := "HMI_Blender_Parameters"."ProcessSetup"."_InjCO2Press_Offset";

  // Network 5: Scaling (Original Language: LAD)

  ReadAnalogIn(ANALOG := "HMI_Instrument"."PCM306_Offset", MAX_Analog_Value := "gR_CO2_Max", MIN_Analog_Value := "gR_CO2_Min", PEW := "gR_CO2_SP_Int");

  // Network 6: Test (Original Language: STL)

  // --- BEGIN STL Network 6 ---
   
     	A	"gWorkshopTest"
     	AN	"Procedure_Variables".Blender_Run.Running
     	A	"HMI_Service".Workshop_Test.CO2TestRequest
     	=	"mCO2TestReq"
     	A	"mCO2TestReq"
     	JNB	_007
     	L	"HMI_PID".RVM301.Pv
     	L	2.0
     	ADD_R
     	T	"HMI_PID".PCM306.Sp
     _007:   		NOP_0
   
  // --- END STL Network 6 ---

  // Network 7: Injection Offset (Original Language: LAD)

  IF "mCO2TestReq" THEN
    LIMIT_R(IN := "HMI_Instrument"."PCM306_Offset"."PV", MN := 0.0, MX := "HMI_Instrument"."PCM306_Offset"."Zero");
  END_IF;

  // Network 8: PCM306 - Carbo Co2 Pressure (Original Language: LAD)

  IF ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM341"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "Procedure_Variables"."CarboWaterLine"."Latch" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") OR ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM342"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "Procedure_Variables"."CarboWaterLine"."Latch" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") THEN
    "HMI_PID"."PCM306"."Sp" := "HMI_Blender_Parameters"."ProcessSetup"."_CarboCO2Pressure" - "mCO2InjOffset";
  END_IF;

  IF ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM341"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "Procedure_Variables"."CarboWaterLine"."Latch") OR ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM342"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "Procedure_Variables"."CarboWaterLine"."Latch") THEN
    "HMI_PID"."PCM306"."Sp" := 11.0;
  END_IF;

  IF ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM341"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") OR ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM342"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") THEN
    "HMI_PID"."PCM306"."Sp" := "HMI_Blender_Parameters"."ProcessSetup"."_GAS2InjectionPress";
  END_IF;

  IF ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM341"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") OR ("mCO2TestReq" AND "mPCM306_Reset" AND "HMI_Device"."AVM342"."Out" AND "gBlenderCIPMode" AND "Blender_Variables_Pers"."gCarboStillRecipe" AND "HMI_Blender_Parameters"."Actual_Recipe_Parameters"."_GAS2_Injection") THEN
    "HMI_PID"."PCM306"."Sp" := 2.0;
  END_IF;

  // Network 9: PCM306 High Pressure - Supplies Alarm (Original Language: LAD)

  "gPCM306HighPress" := "HMI_Instrument"."PTM308"."PVFiltered" >= 18.0;

END_FUNCTION