VentRountine.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using JetVirgoPM.Devices;
  4. using MECF.Framework.Common.Routine;
  5. namespace JetVirgoPM.PMs.Routines
  6. {
  7. class VentRoutine : PMRoutineBase, IStepRoutine
  8. {
  9. private enum VentSequence
  10. {
  11. kCloseValves,
  12. kOpenSoftVentValve,
  13. kOpenFastVentValve,
  14. kOpenGasFinal,
  15. kVentToPrecision,
  16. kVentDelay,
  17. kCloseVentValve,
  18. kEnd,
  19. kCheckLidSignal,
  20. kCheckSlitDoor,
  21. kCheckThrottleValveStatus,
  22. kCheckN2,
  23. kOpenProcessValve,
  24. kOpenN2Supply,
  25. kCheckChamberPressure,
  26. kCheckATM
  27. }
  28. private int _ventTime;
  29. private int _ventTimeDelay = 1; //执行Vent程序时(自动或手动Vent),先关闭PV2,延时2秒后打开PV3。
  30. private int _checkATMTimeout = 90;
  31. public VentRoutine(JetDualPM chamber) : base(chamber)
  32. {
  33. Name = "vent";
  34. bUINotify = true;
  35. }
  36. public RState Start(params object[] objs)
  37. {
  38. // 预检查
  39. if (!SC.IsATMMode && _chamber.IsSlitDoor1Closed && _chamber.IsSlitDoor2Closed && _chamber.CheckAtm())
  40. {
  41. Notify($"ATM 信号 ON,{_chamber.IsATM},此时腔体压力{_chamber.ChamberPressurePressure}");
  42. return RState.End;
  43. }
  44. if (CheckLid() == RState.Running &&
  45. CheckSlitDoor1() == RState.Running && CheckSlitDoor2() == RState.Running)
  46. {
  47. Reset();
  48. _chamber.CloseValves();
  49. //_PressureTrip1 = SC.GetValue<int>($"{Module}.Pump.PressureTrip1") * 1000;
  50. _ventTime = (int)SC.GetValue<double>($"{Module}.VentTime");
  51. _checkATMTimeout = SC.GetValue<int>($"{Module}.CheckATMTimeout");
  52. _ventTimeDelay = SC.GetValue<int>($"{Module}.VentTimeDelay");
  53. return Runner.Start(_chamber.Module.ToString(), Name);
  54. }
  55. return RState.Failed;
  56. }
  57. public RState Monitor()
  58. {
  59. Runner.Run(VentSequence.kOpenN2Supply, HOFs.Apply(OpenValve, ValveType.N2, true), HOFs.Apply(CheckValve, ValveType.N2, true), 500)
  60. .Run(VentSequence.kOpenFastVentValve, HOFs.Apply(OpenValve, ValveType.FAST_VENT, true), HOFs.Apply(CheckValve, ValveType.FAST_VENT, true), 500)
  61. .Run(VentSequence.kOpenGasFinal, OpenGasFinal, CheckGasFinal, 500)
  62. .Run(VentSequence.kCheckATM, HOFs.Apply(ATM2, true), HOFs.Apply(CheckATM2, true), _checkATMTimeout * 1000)
  63. .Delay(VentSequence.kVentDelay, _ventTimeDelay * 1000)
  64. .Wait(VentSequence.kCloseValves, CloseAllValve, _delay_50ms)
  65. .End(VentSequence.kEnd, EndFunc, _delay_0s);
  66. if (Runner.Status == RState.Failed)
  67. {
  68. _chamber.OpenValve(ValveType.FAST_VENT, false);
  69. _chamber.OpenValve(ValveType.PURGE, false);
  70. _chamber.OpenValve(ValveType.PROCESS, false);
  71. _chamber.OpenValve(ValveType.N2, false);
  72. Notify("出错");
  73. }
  74. return Runner.Status;
  75. }
  76. public bool OpenGasFinal()
  77. {
  78. if (_chamber.IsPlus)
  79. {
  80. return OpenValve(ValveType.PROCESS, true);
  81. }
  82. return true;
  83. }
  84. public bool CheckGasFinal()
  85. {
  86. if (_chamber.IsPlus)
  87. {
  88. return CheckValve(ValveType.PROCESS, true);
  89. }
  90. return true;
  91. }
  92. public override void Abort()
  93. {
  94. _chamber.CloseValves();
  95. }
  96. }
  97. }