VentRountine.cs 3.5 KB

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