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