PMRoutineBase.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. using System;
  7. namespace Venus_RT.Modules.PMs
  8. {
  9. class PMRoutineBase
  10. {
  11. public ModuleName Module { get; set; }
  12. public string Name { get; set; }
  13. public bool NullFun() => true;
  14. protected readonly JetPM _chamber;
  15. protected Stopwatch _timer = new Stopwatch();
  16. protected RoutineRunner Runner = new RoutineRunner();
  17. protected readonly int _delay_50ms = 50;
  18. protected readonly int _delay_1s = 1000;
  19. protected readonly int _delay_2s = 2000;
  20. protected readonly int _delay_3s = 3000;
  21. protected readonly int _delay_4s = 4000;
  22. protected readonly int _delay_5s = 5000;
  23. protected readonly int _delay_10s = 10000;
  24. public PMRoutineBase(JetPM chamber)
  25. {
  26. Module = chamber.Module;
  27. _chamber = chamber;
  28. Runner.Reset();
  29. }
  30. protected void Notify(string message)
  31. {
  32. LOG.Write(eEvent.EV_ROUTINE_NOTIFY, Module, Name, message);
  33. }
  34. protected void Stop(string failReason)
  35. {
  36. LOG.Write(eEvent.ERR_ROUTINE_FAILED, Module, Name, failReason);
  37. }
  38. public void Reset()
  39. {
  40. Runner.Reset();
  41. _timer.Reset();
  42. }
  43. public bool CheckLid()
  44. {
  45. if (!_chamber.IsLidClosed)
  46. {
  47. this.Stop("Chamber 盖子必须关");
  48. return false;
  49. }
  50. return true;
  51. }
  52. public bool CheckLidLoadLock()
  53. {
  54. if (!_chamber.IsLidLoadlockClosed)
  55. {
  56. this.Stop("LoadLock 盖子必须关");
  57. return false;
  58. }
  59. return true;
  60. }
  61. protected bool CheckSlitDoor()
  62. {
  63. if (!_chamber.IsSlitDoorClosed)
  64. {
  65. Stop("传送门必须关");
  66. return false;
  67. }
  68. return true;
  69. }
  70. protected bool CheckDryPump()
  71. {
  72. if (!_chamber.IsPumpRunning)
  73. {
  74. Stop("干泵没有启动");
  75. return false;
  76. }
  77. if (_chamber.HasPumpError)
  78. {
  79. Stop("干泵状态有错误");
  80. return false;
  81. }
  82. return true;
  83. }
  84. protected bool CheckTurboPump()
  85. {
  86. if (!_chamber.IsTurboPumpRunning)
  87. {
  88. Stop("分子泵没有启动");
  89. return false;
  90. }
  91. if (_chamber.HasTurboPumpError)
  92. {
  93. Stop("分子泵状态有错误");
  94. return false;
  95. }
  96. return true;
  97. }
  98. protected bool CheckCDA()
  99. {
  100. if (!_chamber.IsCDA_OK)
  101. {
  102. Stop("CDA 压力信号不正确");
  103. return false;
  104. }
  105. return true;
  106. }
  107. public bool CheckATM()
  108. {
  109. if (_chamber.IsATM)
  110. {
  111. this.Stop("Chamber 是ATM状态");
  112. return false;
  113. }
  114. return true;
  115. }
  116. protected bool CloseAllValves()
  117. {
  118. Notify("关闭所有的阀门");
  119. _chamber.CloseValves();
  120. return true;
  121. }
  122. protected bool TurnValve(ValveType vlv, bool bOpen)
  123. {
  124. _chamber.OpenValve(vlv, bOpen);
  125. Notify($"{(bOpen ? "打开" : "关闭")} {vlv} 阀");
  126. return true;
  127. }
  128. protected bool CheckValve(ValveType vlv, bool bOpen)
  129. {
  130. if (vlv == ValveType.FastPump)
  131. return _chamber.IsFastPumpOpened == bOpen;
  132. else if (vlv == ValveType.SoftPump)
  133. return _chamber.IsSoftPumpOpened == bOpen;
  134. return true;
  135. }
  136. protected bool SetCoolantTemp(double target, double offset)
  137. {
  138. if (!_chamber.CheckChillerStatus())
  139. {
  140. Stop("Chiller status error");
  141. return false;
  142. }
  143. if (_chamber.CoolantOutletTempFB > target)
  144. {
  145. Notify($"水冷当前温度{_chamber.CoolantOutletTempFB} ℃, 大于目标 {target.ToString()} ℃");
  146. }
  147. _chamber.HeatChiller(target, offset);
  148. Notify($"检查水冷温度值,当前温度{_chamber.CoolantOutletTempFB} ℃, 目标 {target.ToString()} ℃");
  149. return true;
  150. }
  151. protected bool CheckCoolantTemp(double target, double tolerance)
  152. {
  153. return Math.Abs(_chamber.CoolantOutletTempFB - target) <= tolerance;
  154. }
  155. }
  156. }