PMRoutineBase.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System.Diagnostics;
  2. using Venus_RT.Devices;
  3. using Aitex.Core.RT.Log;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.Routine;
  6. namespace Venus_RT.Modules.PMs
  7. {
  8. class PMRoutineBase
  9. {
  10. public ModuleName Module { get; set; }
  11. public string Name { get; set; }
  12. public bool NullFun() => true;
  13. protected readonly JetPM _chamber;
  14. protected Stopwatch _timer = new Stopwatch();
  15. protected RoutineRunner Runner = new RoutineRunner();
  16. protected readonly int _delay_50ms = 50;
  17. protected readonly int _delay_1s = 1000;
  18. protected readonly int _delay_2s = 2000;
  19. protected readonly int _delay_3s = 3000;
  20. protected readonly int _delay_4s = 4000;
  21. protected readonly int _delay_5s = 5000;
  22. protected readonly int _delay_10s = 10000;
  23. public PMRoutineBase(JetPM chamber)
  24. {
  25. Module = chamber.Module;
  26. _chamber = chamber;
  27. Runner.Reset();
  28. }
  29. protected void Notify(string message)
  30. {
  31. LOG.Write(eEvent.EV_ROUTINE_NOTIFY, Module, Name, message);
  32. }
  33. protected void Stop(string failReason)
  34. {
  35. LOG.Write(eEvent.ERR_ROUTINE_FAILED, Module, Name, failReason);
  36. }
  37. public void Reset()
  38. {
  39. Runner.Reset();
  40. _timer.Reset();
  41. }
  42. public bool CheckLid()
  43. {
  44. if (!_chamber.IsLidClosed)
  45. {
  46. this.Stop("Chamber 盖子必须关");
  47. return false;
  48. }
  49. return true;
  50. }
  51. public bool CheckLidLoadLock()
  52. {
  53. if (!_chamber.IsLidLoadlockClosed)
  54. {
  55. this.Stop("LoadLock 盖子必须关");
  56. return false;
  57. }
  58. return true;
  59. }
  60. protected bool CheckSlitDoor()
  61. {
  62. if (!_chamber.IsSlitDoorClosed)
  63. {
  64. Stop("传送门必须关");
  65. return false;
  66. }
  67. return true;
  68. }
  69. protected bool CheckDryPump()
  70. {
  71. if (!_chamber.IsPumpRunning)
  72. {
  73. Stop("干泵没有启动");
  74. return false;
  75. }
  76. if (_chamber.HasPumpError)
  77. {
  78. Stop("干泵状态有错误");
  79. return false;
  80. }
  81. return true;
  82. }
  83. protected bool CheckTurboPump()
  84. {
  85. if (!_chamber.IsTurboPumpRunning)
  86. {
  87. Stop("分子泵没有启动");
  88. return false;
  89. }
  90. if (_chamber.HasTurboPumpError)
  91. {
  92. Stop("分子泵状态有错误");
  93. return false;
  94. }
  95. return true;
  96. }
  97. protected bool CheckCDA()
  98. {
  99. if (!_chamber.IsCDA_OK)
  100. {
  101. Stop("CDA 压力信号不正确");
  102. return false;
  103. }
  104. return true;
  105. }
  106. public bool CheckATM()
  107. {
  108. if (_chamber.IsATM)
  109. {
  110. this.Stop("Chamber 是ATM状态");
  111. return false;
  112. }
  113. return true;
  114. }
  115. protected bool CloseAllValves()
  116. {
  117. Notify("关闭所有的阀门");
  118. _chamber.CloseValves();
  119. return true;
  120. }
  121. protected bool TurnValve(ValveType vlv, bool bOpen)
  122. {
  123. _chamber.OpenValve(vlv, bOpen);
  124. Notify($"{(bOpen ? "打开" : "关闭")} {vlv} 阀");
  125. return true;
  126. }
  127. protected bool CheckValve(ValveType vlv, bool bOpen)
  128. {
  129. if (vlv == ValveType.FastPump)
  130. return _chamber.IsFastPumpOpened == bOpen;
  131. else if (vlv == ValveType.SoftPump)
  132. return _chamber.IsSoftPumpOpened == bOpen;
  133. return true;
  134. }
  135. }
  136. }