PumpDownRoutine.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Diagnostics;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Routine;
  5. using Aitex.Core.RT.SCCore;
  6. using VirgoRT.Devices;
  7. namespace VirgoRT.Modules.PMs
  8. {
  9. class PumpDownRoutine : PMRoutineBase, IRoutine
  10. {
  11. private enum PumpSequence
  12. {
  13. kCheckLidSignal,
  14. kCheckSlitDoor,
  15. kCheckDryPumpStatus,
  16. kCloseValves,
  17. kOpenPumpingValve,
  18. kDelay,
  19. kCheckVAC,
  20. kCheckForelinePressure,
  21. kCheckThrottleValveStatus,
  22. kCheckATM,
  23. kOpenSoftPumpValve,
  24. kCloseSoftPumpValve,
  25. kFastPumpValve,
  26. kCloseFastPumpValve,
  27. kCheckChamberPressure,
  28. kCheckVACSignal,
  29. kEnd
  30. }
  31. private int _basePressure;
  32. private int _pumpValveDelay;
  33. private double _pumpTimeLimit;
  34. private readonly uint FORELINE_TARGET = 500;
  35. private Stopwatch _pumpDownStopwatch = new Stopwatch();
  36. public double PumpDownOnTime => _pumpDownStopwatch.Elapsed.TotalSeconds;
  37. public PumpDownRoutine(JetPM chamber) : base(chamber)
  38. {
  39. Name = "PumpDown";
  40. bUINotify = true;
  41. }
  42. public void Terminate()
  43. {
  44. }
  45. public Result Start(params object[] objs)
  46. {
  47. // 预检查,必须关盖子
  48. if (CheckLid() == Result.RUN &&
  49. CheckSlitDoor() == Result.RUN)
  50. //&& CheckDryPump() == Result.RUN)
  51. {
  52. Reset();
  53. //关闭所有阀门
  54. _chamber.CloseValves();
  55. //_PressureTrip1 = SC.GetValue<int>($"{Module}.Pump.PressureTrip1") * 1000;
  56. _basePressure = (objs.Length == 1) ? Convert.ToInt32(objs[0]) : SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  57. _pumpTimeLimit = SC.GetValue<double>($"{Module}.Pump.PumpTimeLimit");
  58. _pumpValveDelay = SC.GetValue<int>($"{Module}.Pump.PumpValveDelay");
  59. _pumpDownStopwatch.Restart();
  60. Notify("开始");
  61. return Result.RUN;
  62. }
  63. return Result.FAIL;
  64. }
  65. public Result Monitor()
  66. {
  67. try
  68. {
  69. CheckForeline((int)PumpSequence.kCheckForelinePressure, FORELINE_TARGET, 15);
  70. CheckThrottleValveFullOpen((int)PumpSequence.kCheckThrottleValveStatus);
  71. // open pumping valve
  72. SetValve((int)PumpSequence.kOpenSoftPumpValve, ValveType.SOFT_PUMP, true);
  73. TimeDelay((int)PumpSequence.kDelay, _pumpValveDelay);
  74. SetValve((int)PumpSequence.kFastPumpValve, ValveType.FAST_PUMP, true);
  75. SetValve((int)PumpSequence.kCloseFastPumpValve, ValveType.SOFT_PUMP, false);
  76. CheckATM2((int)PumpSequence.kCheckATM, false, 30);
  77. //CheckPressure((int)PumpSequence.kCheckChamberPressure, _PressureTrip1, false, 50);
  78. //OpenValve((int)PumpSequence.kCloseSoftPumpValve, ValveType.SOFT_PUMP, false);
  79. //检查VAC
  80. CheckVAC((int)PumpSequence.kCheckVACSignal, 90);
  81. CheckPressure((int)PumpSequence.kCheckVAC, _basePressure, false, (int)_pumpTimeLimit);
  82. End((int)PumpSequence.kEnd);
  83. }
  84. catch (RoutineBreakException)
  85. {
  86. return Result.RUN;
  87. }
  88. catch (RoutineFaildException)
  89. {
  90. Stop("出错");
  91. return Result.FAIL;
  92. }
  93. catch (Exception ex)
  94. {
  95. Stop(ex.Message);
  96. return Result.FAIL;
  97. }
  98. _pumpDownStopwatch.Stop();
  99. Notify("结束");
  100. return Result.DONE;
  101. }
  102. public override void Abort()
  103. {
  104. _chamber.CloseValves();
  105. }
  106. }
  107. }