GasBoxLeakCheckRoutine.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using Venus_RT.Devices;
  4. using MECF.Framework.Common.Routine;
  5. using System.Diagnostics;
  6. using System.Collections.Generic;
  7. using Venus_Core;
  8. namespace Venus_RT.Modules.PMs
  9. {
  10. class GasBoxLeakCheckRoutine : PMRoutineBase, IRoutine
  11. {
  12. private enum LeakCheckStep
  13. {
  14. kPumpToBasePressure,
  15. kPumpingDelay,
  16. kLeakCheckDelay,
  17. kEnd,
  18. }
  19. public double LeakRate { get; private set; }
  20. private readonly double _GasFlow = 1.0;
  21. private int _basePressure = 100;
  22. private int _leakcheckPumpTime = 180;
  23. private int _leakcheckHoldTime = 300;
  24. private double _startPressure = 0;
  25. private double _endPressure = 0;
  26. private double _leakRate = 30.0;
  27. private double _leakCheckBasePressure = 1;
  28. private List<int> _gasLineNums = new List<int>();
  29. Stopwatch _leakCheckTimer = new Stopwatch();
  30. public GasBoxLeakCheckRoutine(JetPM chamber) : base(chamber)
  31. {
  32. Name = "GasBox Leakcheck";
  33. }
  34. public RState Start(params object[] objs)
  35. {
  36. if (CheckLidLoadLock() &&
  37. CheckSlitDoor() &&
  38. CheckTurboPump())
  39. {
  40. Reset();
  41. _basePressure = SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  42. _leakcheckPumpTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckPumpingTime");
  43. _leakcheckHoldTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckHoldTime");
  44. _leakRate = SC.GetValue<double>($"{Module}.Pump.LeakRate");
  45. _leakCheckBasePressure = SC.GetValue<double>($"{Module}.Pump.LeakCheckBasePressure");
  46. // Extract line numbers which need do Leakcheck from config file
  47. _gasLineNums.Clear();
  48. var lineNums = SC.GetStringValue($"{Module}.Pump.LeakCheckGasLineNums").Split(',');
  49. int nNum;
  50. foreach(string num in lineNums)
  51. {
  52. if(int.TryParse(num, out nNum))
  53. {
  54. if(nNum > 0 && nNum <= 8 && !_gasLineNums.Contains(nNum))
  55. {
  56. _gasLineNums.Add(nNum);
  57. }
  58. }
  59. }
  60. if(_gasLineNums.Count == 0)
  61. {
  62. Stop($"No Gasline need do LeakCheck, please check the config item{Module}.Pump.LeakCheckGasLineNums");
  63. return RState.Failed;
  64. }
  65. PreSetValves();
  66. return Runner.Start(Module, Name);
  67. }
  68. return RState.Failed;
  69. }
  70. public RState Monitor()
  71. {
  72. Runner.Wait((int)LeakCheckStep.kPumpToBasePressure, ()=> { return _chamber.ChamberPressure <= _basePressure; })
  73. .Run((int)LeakCheckStep.kPumpingDelay, LeakCheckPumping, PumpingDelay)
  74. .Run((int)LeakCheckStep.kLeakCheckDelay, StartLeakCheck, _leakcheckHoldTime * 1000)
  75. .End((int)LeakCheckStep.kEnd, CalcLeakCheckResult, _delay_50ms);
  76. return Runner.Status;
  77. }
  78. public void Abort()
  79. {
  80. CloseAllValves();
  81. }
  82. private bool LeakCheckPumping()
  83. {
  84. foreach(var num in _gasLineNums)
  85. {
  86. _chamber.FlowGas(num, _GasFlow);
  87. }
  88. _chamber.OpenValve(ValveType.PV11, true);
  89. _chamber.OpenValve(ValveType.PV21, true);
  90. _chamber.OpenValve(ValveType.PV31, true);
  91. _chamber.OpenValve(ValveType.PV41, true);
  92. _leakCheckTimer.Restart();
  93. return true;
  94. }
  95. private bool PumpingDelay()
  96. {
  97. if (_leakCheckTimer.ElapsedMilliseconds >= _leakcheckPumpTime * 1000)
  98. {
  99. if (_chamber.ChamberPressure <= _leakCheckBasePressure)
  100. return true;
  101. else
  102. {
  103. Runner.Stop($"GasBox Leakcheck失败, 腔体压力 [{_chamber.ChamberPressure}]mTor, 高于LeakCheck Base Pressure: [{_leakCheckBasePressure}] mTor");
  104. }
  105. }
  106. return false;
  107. }
  108. private bool StartLeakCheck()
  109. {
  110. _startPressure = _chamber.ChamberPressure;
  111. Notify($"PM 压力开始值 {_startPressure} mt");
  112. _chamber.TurnPendulumValve(false);
  113. return true;
  114. }
  115. private bool CalcLeakCheckResult()
  116. {
  117. _endPressure = _chamber.ChamberPressure;
  118. LeakRate = (_endPressure - _startPressure) * 60.0 / _leakcheckHoldTime;
  119. if (LeakRate < _leakRate)
  120. {
  121. Notify($"GasBox Leakcheck完成, 压力结束值: {_startPressure} mt, 漏率:{LeakRate} mt/min");
  122. }
  123. else
  124. {
  125. Stop($"GasBox Leakcheck失败, 腔体漏率 [{LeakRate}] mt/min, 高于 [{_leakRate}] mt/min");
  126. }
  127. _chamber.StopAllGases();
  128. _chamber.TurnPendulumValve(true);
  129. _chamber.OpenValve(ValveType.PV11, false);
  130. _chamber.OpenValve(ValveType.PV21, false);
  131. _chamber.OpenValve(ValveType.PV31, false);
  132. _chamber.OpenValve(ValveType.PV41, false);
  133. return true;
  134. }
  135. private void PreSetValves()
  136. {
  137. _chamber.OpenValve(ValveType.FastPump, false);
  138. _chamber.OpenValve(ValveType.SoftPump, false);
  139. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  140. _chamber.OpenValve(ValveType.Guage, true);
  141. _chamber.OpenValve(ValveType.GasFinal, true);
  142. _chamber.TurnPendulumValve(true);
  143. _chamber.StopAllGases();
  144. _chamber.OpenValve(ValveType.PV11, false);
  145. _chamber.OpenValve(ValveType.PV21, false);
  146. _chamber.OpenValve(ValveType.PV31, false);
  147. _chamber.OpenValve(ValveType.PV41, false);
  148. }
  149. }
  150. }