PumpDownRoutine.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. using System;
  2. using Aitex.Core.RT.Routine;
  3. using Aitex.Core.RT.SCCore;
  4. using Venus_RT.Devices;
  5. using MECF.Framework.Common.Routine;
  6. using Venus_Core;
  7. using Aitex.Core.RT.Log;
  8. namespace Venus_RT.Modules.PMs
  9. {
  10. class PumpDownRoutine : PMRoutineBase, IRoutine
  11. {
  12. private enum PumpStep
  13. {
  14. kDelay_2s,
  15. kCloseISOValve,
  16. kSoftPump,
  17. kFastPump,
  18. kHe2ExDelay,
  19. kPVHe2,
  20. kISOValve,
  21. kTurboN2Purge,
  22. kVATValve,
  23. kOpenTurboPumpPurgeGasFinal,
  24. kOpenTurboPump,
  25. kGasFinal,
  26. kFinalStep,
  27. kCloseValve,
  28. vFastPump,
  29. kEnd,
  30. }
  31. private enum Kepler2200PumpStep
  32. {
  33. kPrepare,
  34. kCloseISOValve,
  35. kSoftPump,
  36. kFastPump,
  37. kHe2ExDelay,
  38. kPVHe2,
  39. kISOValve,
  40. kTurboN2Purge,
  41. kVATValve,
  42. kOpenTurboPumpPurgeGasFinal,
  43. kOpenTurboPump,
  44. kGasFinal,
  45. kFinalStep,
  46. kCloseValve,
  47. vFastPump,
  48. kEnd,
  49. }
  50. //private int _ventTime;
  51. private int _pump_delay = 5000;
  52. private int _roughPumpPressure = 75000;
  53. private int _vHe2FlowPressure = 200;
  54. private int _forelinePressure = 200;
  55. private int _basePressure = 10;
  56. private JetChamber jetChamber = JetChamber.None;
  57. private int _pumpDownLevel;
  58. //private bool needsoft = true;
  59. public PumpDownRoutine(JetPMBase chamber) : base(chamber)
  60. {
  61. jetChamber = (JetChamber)SC.GetValue<int>($"{chamber.Name}.ChamberType");
  62. Name = "PumpDown";
  63. //if (jetChamber == JetChamber.VenusDE)
  64. //{
  65. // needsoft = false;
  66. //}
  67. }
  68. public RState Start(params object[] objs)
  69. {
  70. if (CheckLid() &&
  71. CheckSlitDoor())
  72. {
  73. Reset();
  74. _chamber.CloseValves();
  75. _roughPumpPressure = SC.GetValue<int>($"{Module}.Pump.PumpCrossingPressure");
  76. _pump_delay = SC.GetValue<int>($"{Module}.Pump.PumpValveDelay") * 1000;
  77. _basePressure = (objs.Length >= 1) ? Convert.ToInt32(objs[0]) : SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  78. //前端压力值高于某个数值
  79. _forelinePressure = SC.GetValue<int>($"{Module}.Pump.ForelinePressure");
  80. if (!_chamber.IsPumpRunning || _chamber.ForelinePressure > _forelinePressure)
  81. {
  82. LOG.Write(eEvent.ERR_PM, Module, $"Cannot start pumpdown, drypump running:{_chamber.IsPumpRunning}, ForelinePressure:{_chamber.ForelinePressure}=>Target:{_forelinePressure}");
  83. return RState.Failed;
  84. }
  85. if (_chamber.ChamberType == JetChamber.VenusSE || _chamber.ChamberType == JetChamber.VenusDE)
  86. {
  87. _chamber.OpenValve(ValveType.TurboPumpPurge, false);
  88. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  89. _chamber.TurnPendulumValve(false);
  90. _vHe2FlowPressure = SC.GetValue<int>($"{Module}.Pump.PumpVHe2FlowPressure");
  91. }
  92. else
  93. {
  94. _vHe2FlowPressure = SC.GetValue<int>($"{Module}.Pump.PumpOpenISOPressure");
  95. if (_chamber.ChamberPressure > _roughPumpPressure)
  96. {
  97. _pumpDownLevel = 0;
  98. }
  99. else if (_chamber.ChamberPressure > _vHe2FlowPressure)
  100. {
  101. _pumpDownLevel = 1;
  102. }
  103. else if (_chamber.ChamberPressure > _basePressure)
  104. {
  105. _pumpDownLevel = 2;
  106. }
  107. else
  108. {
  109. _pumpDownLevel = 3;
  110. }
  111. }
  112. return Runner.Start(Module, Name);
  113. }
  114. return RState.Failed;
  115. }
  116. public RState Monitor()
  117. {
  118. switch (jetChamber)
  119. {
  120. case JetChamber.VenusSE:
  121. Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
  122. .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
  123. .Run(PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
  124. .Run(PumpStep.vFastPump, VenusFastPump, () => { return _chamber.ChamberPressure <= _vHe2FlowPressure; })
  125. .Delay(PumpStep.kHe2ExDelay, 3000)
  126. .Run(PumpStep.kPVHe2, OpenHe2Valve, _delay_2s)
  127. .Run(PumpStep.kISOValve, OpenISOValve, _delay_2s)
  128. .Run(PumpStep.kVATValve, OpenVATValve, _delay_5s)
  129. .Run(PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_3s)
  130. .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  131. .Run(PumpStep.kCloseValve, CloseValve, NullFun)
  132. .End(PumpStep.kEnd, NullFun, _delay_1s);
  133. break;
  134. case JetChamber.Kepler2300:
  135. Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
  136. .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
  137. .Run(PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
  138. .Run(PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
  139. .Run(PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
  140. .Run(PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
  141. .Run(PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_3s)
  142. .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  143. .End(PumpStep.kEnd, NullFun, _delay_1s);
  144. break;
  145. case JetChamber.Kepler2200A:
  146. case JetChamber.Kepler2200B:
  147. switch (_pumpDownLevel)
  148. {
  149. case 0:
  150. Runner.Run(Kepler2200PumpStep.kPrepare, CloseVATValve, VATIsAllClose)
  151. .Run(Kepler2200PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
  152. .Run(Kepler2200PumpStep.kSoftPump, HOFs.WrapAction(_chamber.OpenValve, ValveType.SoftPump, true), CheckToCrossPressure)
  153. .Run(Kepler2200PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
  154. .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
  155. .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
  156. .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_1s)
  157. .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  158. .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
  159. break;
  160. case 1:
  161. Runner
  162. .Run(Kepler2200PumpStep.kPrepare, CloseVATValve, VATIsAllClose)
  163. .Run(Kepler2200PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
  164. .Run(Kepler2200PumpStep.kFastPump, OpenFastPump, () => { return _chamber.ChamberPressure < _vHe2FlowPressure; })
  165. .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve, _delay_2s)
  166. .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
  167. .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve, _delay_1s)
  168. .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  169. .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
  170. break;
  171. case 2:
  172. Runner
  173. .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve)
  174. .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
  175. .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve)
  176. .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  177. .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
  178. break;
  179. case 3:
  180. Runner
  181. .Run(Kepler2200PumpStep.kISOValve, OpenKeplerISOValve)
  182. .Run(Kepler2200PumpStep.kVATValve, OpenVATValve, VATIsAllOpen, _delay_10s)
  183. .Run(Kepler2200PumpStep.kOpenTurboPumpPurgeGasFinal, OpenTurboPumpPurgeGasFinalValve)
  184. .Run(Kepler2200PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  185. .End(Kepler2200PumpStep.kEnd, NullFun, _delay_50ms);
  186. break;
  187. }
  188. break;
  189. case JetChamber.VenusDE:
  190. Runner.Delay(PumpStep.kDelay_2s, _delay_2s)
  191. .Run(PumpStep.kCloseISOValve, HOFs.WrapAction(_chamber.OpenValve, ValveType.TurboPumpPumping, false), _delay_2s)
  192. .Run(PumpStep.kFastPump, OpenDEFastPump, VenusFastPumpOver)
  193. .Delay(PumpStep.kHe2ExDelay, 3000)
  194. .Run(PumpStep.kPVHe2, OpenHe2w4Valve, _delay_2s)
  195. .Run(PumpStep.kISOValve, OpenISOValve, _delay_2s)
  196. .Run(PumpStep.kOpenTurboPump, OpenTurboValve, _delay_3s)
  197. .Run(PumpStep.kVATValve, OpenVATValve, _delay_2s)
  198. .Run(PumpStep.kOpenTurboPump, OpenGuageGasFinalValve, _delay_3s)
  199. .Run(PumpStep.kFinalStep, FinalStep, () => { return _chamber.ChamberPressure < _basePressure; })
  200. .Run(PumpStep.kCloseValve, CloseValve, NullFun)
  201. .End(PumpStep.kEnd, NullFun, _delay_1s);
  202. break;
  203. }
  204. return Runner.Status;
  205. }
  206. private bool CheckToCrossPressure()
  207. {
  208. if (_chamber.ChamberPressure < _roughPumpPressure)
  209. {
  210. _chamber.OpenValve(ValveType.SoftPump, false);
  211. return true;
  212. }
  213. else
  214. return false;
  215. }
  216. private bool CloseValve()
  217. {
  218. _chamber.OpenValve(ValveType.PVN22, false);
  219. return true;
  220. }
  221. private bool OpenTurboPumpPurgeGasFinalValve()
  222. {
  223. _chamber.OpenValve(ValveType.TurboPumpPurge, true);
  224. _chamber.OpenValve(ValveType.GasFinal, true);
  225. return true;
  226. }
  227. private bool OpenTurboValve()
  228. {
  229. _chamber.OpenValve(ValveType.TurboPumpPurge, true);
  230. return true;
  231. }
  232. private bool OpenGuageGasFinalValve()
  233. {
  234. _chamber.OpenValve(ValveType.GasFinal, true);
  235. _chamber.OpenValve(ValveType.Guage, true);
  236. return true;
  237. }
  238. private bool VenusFastPumpOver()
  239. {
  240. if (_chamber.ChamberPressure < _vHe2FlowPressure)
  241. {
  242. _chamber.OpenValve(ValveType.FastPump, false);
  243. return true;
  244. }
  245. else
  246. return false;
  247. }
  248. private bool VenusFastPump()
  249. {
  250. _chamber.OpenValve(ValveType.SoftPump, false);
  251. if (_chamber.ChamberPressure > _vHe2FlowPressure)
  252. {
  253. _chamber.OpenValve(ValveType.FastPump, true);
  254. }
  255. return true;
  256. }
  257. private bool OpenFastPump()
  258. {
  259. _chamber.OpenValve(ValveType.SoftPump, false);
  260. _chamber.OpenValve(ValveType.FastPump, true);
  261. return true;
  262. }
  263. private bool OpenDEFastPump()
  264. {
  265. _chamber.OpenValve(ValveType.PVHe2, false);
  266. //_chamber.OpenValve(ValveType.SoftPump, false);
  267. if (_chamber.ChamberPressure > _vHe2FlowPressure)
  268. {
  269. _chamber.OpenValve(ValveType.FastPump, true);
  270. }
  271. return true;
  272. }
  273. private bool OpenHe2Valve()
  274. {
  275. _chamber.OpenValve(ValveType.FastPump, false);
  276. _chamber.OpenValve(ValveType.PVHe2, true);
  277. return true;
  278. }
  279. private bool OpenHe2w4Valve()
  280. {
  281. _chamber.OpenValve(ValveType.FastPump, false);
  282. _chamber.OpenValve(ValveType.PVHe2, true);
  283. //_chamber.OpenValve(ValveType.PVHe4, true);
  284. return true;
  285. }
  286. private bool OpenISOValve()
  287. {
  288. _chamber.OpenValve(ValveType.FastPump, false);
  289. _chamber.OpenValve(ValveType.PVHe2, false);
  290. // ISO Valve
  291. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  292. return true;
  293. }
  294. private bool OpenKeplerISOValve()
  295. {
  296. _chamber.OpenValve(ValveType.FastPump, false);
  297. // ISO Valve
  298. _chamber.OpenValve(ValveType.TurboPumpPumping, true);
  299. return true;
  300. }
  301. private bool OpenVATValve()
  302. {
  303. return _chamber.TurnPendulumValve(true);
  304. }
  305. private bool VATIsAllOpen()
  306. {
  307. return _chamber.PendulumPosition > 950;
  308. }
  309. private bool CloseVATValve()
  310. {
  311. return _chamber.TurnPendulumValve(false);
  312. }
  313. private bool VATIsAllClose()
  314. {
  315. return _chamber.PendulumPosition < 50;
  316. }
  317. //private bool IsNeedSoftPump()
  318. //{
  319. // return _chamber.ChamberPressure > _roughPumpPressure;
  320. //}
  321. //private bool IsNeedFastPump()
  322. //{
  323. // return _chamber.ChamberPressure > _vHe2FlowPressure;
  324. //}
  325. //private bool IsNeedCloseVAT()
  326. //{
  327. // return _chamber.ChamberPressure > _roughPumpPressure;
  328. //}
  329. private bool FinalStep()
  330. {
  331. //_chamber.OpenValve(ValveType.Guage, true);
  332. //2023/04/25修改
  333. //_chamber.OpenValve(ValveType.TurboPumpPurge, true);
  334. //_chamber.OpenValve(ValveType.GasFinal, true);
  335. return true;
  336. }
  337. public void Abort()
  338. {
  339. CloseAllValves();
  340. }
  341. }
  342. }