VentRountine.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using System.Diagnostics;
  4. using VirgoRT.Devices;
  5. namespace VirgoRT.Modules.PMs
  6. {
  7. class VentRoutine : PMRoutineBase, IRoutine
  8. {
  9. private enum VentSequence
  10. {
  11. kCloseValves,
  12. kOpenSoftVentValve,
  13. kOpenFastVentValve,
  14. kVentToPrecision,
  15. kVentDelay,
  16. kCloseVentValve,
  17. kEnd,
  18. kCheckLidSignal,
  19. kCheckSlitDoor,
  20. kCheckThrottleValveStatus,
  21. kCheckN2,
  22. kOpenProcessValve,
  23. kOpenN2Supply,
  24. kCheckChamberPressure,
  25. kCheckATM
  26. }
  27. private int _ventTime;
  28. private int _ventTimeDelay = 1; //执行Vent程序时(自动或手动Vent),先关闭PV2,延时2秒后打开PV3。
  29. private int _checkATMTimeout = 90;
  30. private Stopwatch _ventStopwatch = new Stopwatch();
  31. public double VentOnTime => _ventStopwatch.Elapsed.TotalSeconds;
  32. public VentRoutine(JetPM chamber) : base(chamber)
  33. {
  34. Name = "vent";
  35. bUINotify = true;
  36. }
  37. public Result Start(params object[] objs)
  38. {
  39. // 预检查
  40. if (CheckLid() == Result.RUN &&
  41. CheckSlitDoor() == Result.RUN &&
  42. CheckCDA() == Result.RUN)
  43. {
  44. Reset();
  45. _chamber.CloseValves();
  46. //_PressureTrip1 = SC.GetValue<int>($"{Module}.Pump.PressureTrip1") * 1000;
  47. _ventTime = (int)SC.GetValue<double>($"{Module}.VentTime");
  48. _checkATMTimeout = SC.GetValue<int>($"{Module}.CheckATMTimeout");
  49. _ventTimeDelay = SC.GetValue<int>($"{Module}.VentTimeDelay");
  50. _ventStopwatch.Restart();
  51. Notify("开始");
  52. return Result.RUN;
  53. }
  54. return Result.FAIL;
  55. }
  56. public Result Monitor()
  57. {
  58. try
  59. {
  60. CheckThrottleValveFullOpen((int)VentSequence.kCheckThrottleValveStatus);
  61. // 开阀
  62. //OpenValve((int)VentSequence.kOpenSoftVentValve, ValveType.PURGE, true);
  63. SetValve((int)VentSequence.kOpenProcessValve, ValveType.PROCESS, true);
  64. // 监控压力
  65. //CheckPressure((int)VentSequence.kCheckChamberPressure, _PressureTrip1, true, 30);
  66. // 开阀
  67. SetValve((int)VentSequence.kOpenFastVentValve, ValveType.FAST_VENT, true);
  68. CheckATM2((int)VentSequence.kCheckATM, true, _checkATMTimeout);
  69. // delay 3 seconds
  70. TimeDelay((int)VentSequence.kVentDelay, _ventTimeDelay);
  71. // 结束并关闭所有阀
  72. CloseAllValve((int)VentSequence.kCloseValves, 0);
  73. End((int)VentSequence.kEnd);
  74. }
  75. catch (RoutineBreakException)
  76. {
  77. return Result.RUN;
  78. }
  79. catch (RoutineFaildException)
  80. {
  81. //_chamber.OpenValve(ValveType.N2_SUPPLY, false);
  82. _chamber.SetValveOnOff(ValveType.FAST_VENT, false);
  83. _chamber.SetValveOnOff(ValveType.PURGE, false);
  84. _chamber.SetValveOnOff(ValveType.PROCESS, false);
  85. Notify("出错");
  86. return Result.FAIL;
  87. }
  88. catch (System.Exception ex)
  89. {
  90. Stop(ex.Message);
  91. return Result.FAIL;
  92. }
  93. _ventStopwatch.Stop();
  94. Notify("结束");
  95. return Result.DONE;
  96. }
  97. public override void Abort()
  98. {
  99. _chamber.CloseValves();
  100. }
  101. }
  102. }