PMLeakCheckRoutine.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 Venus_Core;
  7. namespace Venus_RT.Modules.PMs
  8. {
  9. class PMLeakCheckRoutine : 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 int _basePressure = 100;
  20. private int _leakcheckPumpTime = 180;
  21. private int _leakcheckHoldTime = 300;
  22. private double _startPressure = 0;
  23. private double _endPressure = 0;
  24. private double _leakRate = 30.0;
  25. private double _leakCheckBasePressure = 1;
  26. Stopwatch _leakCheckTimer = new Stopwatch();
  27. public PMLeakCheckRoutine(JetPM chamber) : base(chamber)
  28. {
  29. Name = "PM Leakcheck";
  30. }
  31. public RState Start(params object[] objs)
  32. {
  33. if (CheckLidLoadLock() &&
  34. CheckSlitDoor() &&
  35. CheckTurboPump())
  36. {
  37. Reset();
  38. _basePressure = SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  39. _leakcheckPumpTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckPumpingTime");
  40. _leakcheckHoldTime = SC.GetValue<int>($"{Module}.Pump.LeakCheckHoldTime");
  41. _leakRate = SC.GetValue<double>($"{Module}.Pump.LeakRate");
  42. _leakCheckBasePressure = SC.GetValue<double>($"{Module}.Pump.LeakCheckBasePressure");
  43. PreSetValves();
  44. return Runner.Start(Module, Name);
  45. }
  46. return RState.Failed;
  47. }
  48. public RState Monitor()
  49. {
  50. Runner.Wait((int)LeakCheckStep.kPumpToBasePressure, PumpingToBasePressure)
  51. .Run((int)LeakCheckStep.kPumpingDelay, HOFs.WrapAction(_chamber.OpenValve, ValveType.GasFinal, false), PumpingDelay)
  52. .Run((int)LeakCheckStep.kLeakCheckDelay, StartLeakCheck, _leakcheckHoldTime * 1000)
  53. .End((int)LeakCheckStep.kEnd, CalcLeakCheckResult, _delay_50ms);
  54. return Runner.Status;
  55. }
  56. public void Abort()
  57. {
  58. CloseAllValves();
  59. }
  60. private bool PumpingToBasePressure()
  61. {
  62. if (_chamber.ChamberPressure <= _basePressure)
  63. {
  64. _leakCheckTimer.Restart();
  65. return true;
  66. }
  67. else
  68. return false;
  69. }
  70. private bool PumpingDelay()
  71. {
  72. if(_leakCheckTimer.ElapsedMilliseconds >= _leakcheckPumpTime * 1000)
  73. {
  74. if (_chamber.ChamberPressure <= _leakCheckBasePressure)
  75. return true;
  76. else
  77. {
  78. Runner.Stop($"PM Leakcheck失败, 腔体压力 [{_chamber.ChamberPressure}]mTor, 高于LeakCheck Base Pressure: [{_leakCheckBasePressure}] mTor");
  79. }
  80. }
  81. return false;
  82. }
  83. private bool StartLeakCheck()
  84. {
  85. _startPressure = _chamber.ChamberPressure;
  86. Notify($"PM 压力开始值 {_startPressure} mt");
  87. _chamber.TurnPendulumValve(false);
  88. return true;
  89. }
  90. private bool CalcLeakCheckResult()
  91. {
  92. _endPressure = _chamber.ChamberPressure;
  93. LeakRate = (_endPressure - _startPressure) * 60.0 / _leakcheckHoldTime;
  94. if (LeakRate < _leakRate)
  95. {
  96. Notify($"PM Leakcheck完成, 压力结束值: {_startPressure} mt, 漏率:{LeakRate} mt/min");
  97. }
  98. else
  99. {
  100. Stop($"PM Leakcheck失败, 腔体漏率 [{LeakRate}] mt/min, 高于 [{_leakRate}] mt/min");
  101. }
  102. _chamber.OpenValve(ValveType.GasFinal, true);
  103. _chamber.TurnPendulumValve(true);
  104. return true;
  105. }
  106. private void PreSetValves()
  107. {
  108. _chamber.OpenValve(ValveType.FastPump, false);
  109. _chamber.OpenValve(ValveType.SoftPump, false);
  110. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  111. _chamber.OpenValve(ValveType.Guage, true);
  112. _chamber.OpenValve(ValveType.GasFinal, true);
  113. _chamber.TurnPendulumValve(true);
  114. }
  115. }
  116. }