PumpDownRoutine.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using Aitex.Core.RT.Event;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using JetVirgoPM.Devices;
  6. using MECF.Framework.Common.Routine;
  7. namespace JetVirgoPM.PMs.Routines
  8. {
  9. class PumpDownRoutine : PMRoutineBase, IStepRoutine
  10. {
  11. private enum PumpSequence
  12. {
  13. kCheckLidSignal,
  14. kCheckSlitDoor,
  15. kCheckDryPumpStatus,
  16. kCloseValves,
  17. kOpenPumpingValve,
  18. kDelay,
  19. kCheckCrossPressure,
  20. kCheckVAC,
  21. kCheckForelinePressure,
  22. kCheckThrottleValveStatus,
  23. kCheckATM,
  24. kOpenSoftPumpValve,
  25. kCloseSoftPumpValve,
  26. kFastPumpValve,
  27. kPumpDelay,
  28. kCloseFastPumpValve,
  29. kCheckChamberPressure,
  30. kCheckVACSignal,
  31. kEnd
  32. }
  33. private int _basePressure;
  34. private int _crossPressure;
  35. private int _pumpValveDelay;
  36. private int _overPumpDelay;
  37. private double _pumpTimeLimit;
  38. private readonly uint FORELINE_TARGET = 500;
  39. public PumpDownRoutine(JetDualPM chamber) : base(chamber)
  40. {
  41. Name = "PumpDown";
  42. bUINotify = true;
  43. }
  44. public void Terminate()
  45. {
  46. }
  47. public RState Start(params object[] objs)
  48. {
  49. // 预检查,必须关盖子
  50. if (CheckLid() == RState.Running &&
  51. CheckSlitDoor1() == RState.Running && CheckSlitDoor2() == RState.Running)
  52. //&& CheckDryPump() == RState.Running)
  53. {
  54. Reset();
  55. //关闭所有阀门
  56. _chamber.CloseValves();
  57. //_PressureTrip1 = SC.GetValue<int>($"{Module}.Pump.PressureTrip1") * 1000;
  58. _basePressure = (objs.Length == 1) ? Convert.ToInt32(objs[0]) : SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  59. _pumpTimeLimit = SC.GetValue<double>($"{Module}.Pump.PumpTimeLimit");
  60. _pumpValveDelay = SC.GetValue<int>($"{Module}.Pump.PumpValveDelay");
  61. _overPumpDelay = SC.GetValue<int>($"{Module}.Pump.OverPumpDelay") * 1000;
  62. _crossPressure = SC.GetValue<int>($"{Module}.Pump.CrossPressure");
  63. return Runner.Start(_chamber.Module.ToString(), Name);
  64. }
  65. return RState.Failed;
  66. }
  67. public RState Monitor()
  68. {
  69. Runner.Run(PumpSequence.kCheckForelinePressure, HOFs.Apply(Foreline, FORELINE_TARGET), HOFs.Apply(CheckForeline, FORELINE_TARGET), 15 * 1000)
  70. .Run(PumpSequence.kOpenSoftPumpValve, OpenSoftPump, CheckSoftPumpIsOn, _delay_1s)
  71. .Run(PumpSequence.kCheckThrottleValveStatus, FullOpenTV, CheckFullOpenTV, _delay_20s)
  72. .Delay(PumpSequence.kDelay, _pumpValveDelay * 1000)
  73. .Wait(PumpSequence.kCheckCrossPressure, CheckCrossPressure)
  74. .Run(PumpSequence.kFastPumpValve, HOFs.Apply(OpenValve, ValveType.FAST_PUMP, true), HOFs.Apply(CheckValve, ValveType.FAST_PUMP, true), _delay_1s)
  75. .Delay(PumpSequence.kPumpDelay, _overPumpDelay)
  76. .Run(PumpSequence.kCloseFastPumpValve, HOFs.Apply(OpenValve, ValveType.SOFT_PUMP, false), HOFs.Apply(CheckValve, ValveType.SOFT_PUMP, false), _delay_1s)
  77. .Run(PumpSequence.kCheckATM, HOFs.Apply(ATM2, false), HOFs.Apply(CheckATM2, false), _delay_30s)
  78. .Run(PumpSequence.kCheckVACSignal, NullFun, CheckVAC, 90 * 1000)
  79. .Run(PumpSequence.kCheckVAC, HOFs.Apply(WaitPressure, _basePressure, false), HOFs.Apply(CheckPressure, _basePressure, false), (int)_pumpTimeLimit * 1000)
  80. .End(PumpSequence.kEnd, EndFunc, _delay_0s);
  81. return Runner.Status;
  82. }
  83. public bool CheckCrossPressure()
  84. {
  85. EV.PostInfoLog(Module,$"Pressure:{_chamber.ChamberPressure} && Cross:{_crossPressure}");
  86. return _chamber.ChamberPressurePressure <= _crossPressure;
  87. }
  88. public bool OpenSoftPump()
  89. {
  90. //if (!_chamber.IsVAC)
  91. // return OpenValve(ValveType.SOFT_PUMP, true);
  92. //else
  93. // return true;
  94. return OpenValve(ValveType.SOFT_PUMP, true);
  95. }
  96. public bool CheckSoftPumpIsOn()
  97. {
  98. //if (!_chamber.IsVAC)
  99. // return CheckValve(ValveType.SOFT_PUMP, true);
  100. //else
  101. // return true;
  102. return CheckValve(ValveType.SOFT_PUMP, true);
  103. }
  104. public override void Abort()
  105. {
  106. _chamber.CloseValves();
  107. }
  108. }
  109. }