HongHuTM.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Device.Unit;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.Util;
  9. using MECF.Framework.Common.Device.Bases;
  10. using MECF.Framework.Common.Equipment;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
  12. using System;
  13. using IoMfc = Venus_RT.Devices.IODevices.IoMfc;
  14. using IoPressureMeter = Venus_RT.Devices.IODevices.IoPressureMeter;
  15. using Venus_Core;
  16. using Venus_RT.Modules;
  17. namespace Venus_RT.Devices
  18. {
  19. public class HongHuTM : TM
  20. {
  21. /// <summary>
  22. /// 针对VenusSE设计
  23. /// </summary>
  24. #region io 信号抽象
  25. //控制阀信号
  26. private readonly IoValve _TMFastPumpValve;
  27. private readonly IoValve _TMSoftPumpValve;
  28. private readonly IoValve _VCESoftPumpValve;
  29. private readonly IoValve _VCEFastPumpValve;
  30. private readonly IoValve _TMFastVentValve;
  31. private readonly IoValve _TMSoftVentValve;
  32. private readonly IoValve _VCESoftVentValve;
  33. private readonly IoValve _VCEFastVentValve;
  34. //判断信号
  35. private readonly IoSensor _VCESlitDoorOpenEnable;
  36. private readonly IoSensor _PMASlitDoorOpenEnable;
  37. private readonly IoSensor _PMBSlitDoorOpenEnable;
  38. private readonly IoSensor _PMCSlitDoorOpenEnable;
  39. private readonly IoSensor _VCESlitDoorCloseEnable;
  40. private readonly IoSensor _PMASlitDoorCloseEnable;
  41. private readonly IoSensor _PMBSlitDoorCloseEnable;
  42. private readonly IoSensor _PMCSlitDoorCloseEnable;
  43. private readonly IoSensor _TMExtendVCEEnable;
  44. private readonly IoSensor _TMExtendPMAEnable;
  45. private readonly IoSensor _TMExtendPMBEnable;
  46. private readonly IoSensor _TMExtendPMCEnable;
  47. private readonly IoSensor _TMVACSensor;
  48. private readonly IoSensor _VCEVACSensor;
  49. private readonly IoSensor _VCEATMSensor;
  50. private readonly IoSensor _TMATMSensor;
  51. //控制门信号
  52. private readonly IoCylinder _VCESlitDoor;
  53. private readonly IoCylinder _PMASlitDoor;
  54. private readonly IoCylinder _PMBSlitDoor;
  55. private readonly IoCylinder _PMCSlitDoor;
  56. private readonly IoMfc _TMMfc;
  57. private readonly IoPressureMeter _TMPressure;
  58. //private readonly IoPressureMeter _TMPiplinePressure;
  59. private readonly IoPressureMeter _VCEPressure;
  60. //private readonly IoPressureMeter _VCEPiplinePressure;
  61. private readonly PumpBase _TMPump;
  62. //控压
  63. //安装的module
  64. private string _allInstalledModules { get { return SC.GetStringValue("System.InstalledModules").ToString(); } }
  65. private double TMATMTargetPressure;
  66. private double TMVACTargetPressure;
  67. private double VCEATMTargetPressure;
  68. private double VCEVACTargetPressure;
  69. #endregion
  70. #region 暴露变量
  71. //ATM VAC信号
  72. public bool IsTMATM => _TMATMSensor.Value && _TMPressure.Value >= TMATMTargetPressure;
  73. public bool IsVCEATM => _VCEATMSensor.Value &&_VCEPressure.Value >= VCEATMTargetPressure;
  74. public bool IsTMVAC => _TMVACSensor.Value || _TMPressure.Value <= TMVACTargetPressure;
  75. public bool IsVCEVAC => _VCEVACSensor.Value || _VCEPressure.Value <= VCEVACTargetPressure;
  76. public bool? IsTMPumpRunning => _TMPump?.IsRunning;
  77. //valve开关状态
  78. public bool IsTMFastPumpOpen => _TMFastPumpValve.Status;
  79. public bool IsTMSoftPumpOpen => _TMSoftPumpValve.Status;
  80. public bool IsTMFastVentOpen => _TMFastVentValve.Status;
  81. public bool IsTMSoftVentOpen => _TMSoftVentValve.Status;
  82. public bool IsVCEFastPumpOpen => _VCEFastPumpValve.Status;
  83. public bool IsVCESoftPumpOpen => _VCESoftPumpValve.Status;
  84. public bool IsVCEFastVentOpen => _VCEFastVentValve.Status;
  85. public bool IsVCESoftVentOpen => _VCESoftVentValve.Status;
  86. public bool IsTMVentValveOpen => IsTMFastVentOpen && IsTMSoftVentOpen;
  87. public bool IsVCEVentValveOpen => IsVCEFastVentOpen && IsVCESoftVentOpen;
  88. //SlitDoor
  89. public bool VCESlitDoorClosed => _VCESlitDoor.State == CylinderState.Close;
  90. public bool PMASlitDoorClosed
  91. {
  92. get
  93. {
  94. if (_allInstalledModules.Contains("PMA"))
  95. return _PMASlitDoor.State == CylinderState.Close;
  96. else
  97. return false;
  98. }
  99. }
  100. public bool PMBSlitDoorClosed
  101. {
  102. get
  103. {
  104. if (_allInstalledModules.Contains("PMB"))
  105. return _PMBSlitDoor.State == CylinderState.Close;
  106. else
  107. return false;
  108. }
  109. }
  110. public bool PMCSlitDoorClosed
  111. {
  112. get
  113. {
  114. if (_allInstalledModules.Contains("PMC"))
  115. return _PMCSlitDoor.State == CylinderState.Close;
  116. else
  117. return false;
  118. }
  119. }
  120. public bool VCESlitDoorOpen => _VCESlitDoor.State == CylinderState.Open;
  121. public bool PMASlitDoorOpen
  122. {
  123. get
  124. {
  125. if (_allInstalledModules.Contains("PMA"))
  126. return _PMASlitDoor.State == CylinderState.Open;
  127. else
  128. return false;
  129. }
  130. }
  131. public bool PMBSlitDoorOpen
  132. {
  133. get
  134. {
  135. if (_allInstalledModules.Contains("PMB"))
  136. return _PMBSlitDoor.State == CylinderState.Open;
  137. else
  138. return false;
  139. }
  140. }
  141. public bool PMCSlitDoorOpen
  142. {
  143. get
  144. {
  145. if (_allInstalledModules.Contains("PMC"))
  146. return _PMCSlitDoor.State == CylinderState.Open;
  147. else
  148. return false;
  149. }
  150. }
  151. public bool AllPMSlitDoorClosed
  152. {
  153. get
  154. {
  155. bool PMAFlag = true;
  156. bool PMBFlag = true;
  157. bool PMCFlag = true;
  158. if (_allInstalledModules.Contains("PMA"))
  159. PMAFlag = PMASlitDoorClosed;
  160. if (_allInstalledModules.Contains("PMB"))
  161. PMBFlag = PMBSlitDoorClosed;
  162. if (_allInstalledModules.Contains("PMC"))
  163. PMCFlag = PMCSlitDoorClosed;
  164. if (PMAFlag && PMBFlag && PMCFlag)
  165. return true;
  166. else
  167. return false;
  168. }
  169. }
  170. public bool VCESlitDoorOpenEnable => _VCESlitDoorOpenEnable.Value;
  171. public bool PMASlitDoorOpenEnable => _PMASlitDoorOpenEnable.Value;
  172. public bool PMBSlitDoorOpenEnable => _PMBSlitDoorOpenEnable.Value;
  173. public bool PMCSlitDoorOpenEnable => _PMCSlitDoorOpenEnable.Value;
  174. public bool VCESlitDoorCloseEnable => _VCESlitDoorCloseEnable.Value;
  175. public bool PMASlitDoorCloseEnable => _PMASlitDoorCloseEnable.Value;
  176. public bool PMBSlitDoorCloseEnable => _PMBSlitDoorCloseEnable.Value;
  177. public bool PMCSlitDoorCloseEnable => _PMCSlitDoorCloseEnable.Value;
  178. //Robot动作
  179. public bool TMExtendVCEEnable => _TMExtendVCEEnable.Value;
  180. public bool TMExtendPMAEnable => _TMExtendPMAEnable.Value;
  181. public bool TMExtendPMBEnable => _TMExtendPMBEnable.Value;
  182. public bool TMExtendPMCEnable => _TMExtendPMCEnable.Value;
  183. public double TMPressure => _TMPressure.Value;
  184. public double VCEPressure => _VCEPressure.Value;
  185. enum PumpState
  186. {
  187. Idle,
  188. TMUsing,
  189. VCEUsing,
  190. }
  191. PumpState _PumpingState = PumpState.Idle;
  192. #endregion
  193. public HongHuTM() : base(ModuleName.SETM.ToString())
  194. {
  195. TMATMTargetPressure = SC.GetValue<double>($"SETM.ATMTargetPressure");
  196. TMVACTargetPressure = SC.GetValue<double>($"SETM.VACTargetPressure");
  197. VCEATMTargetPressure = SC.GetValue<double>($"VCE1.ATMTargetPressure");
  198. VCEVACTargetPressure = SC.GetValue<double>($"VCE1.VACTargetPressure");
  199. Module = ModuleName.SETM.ToString();
  200. _TMFastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.TMFastPumpValve}");
  201. _TMSoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.TMSoftPumpValve}");
  202. _VCESoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.VCESoftPumpValve}");
  203. _VCEFastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.VCEFastPumpValve}");
  204. _TMFastVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.TMFastVentValve}");
  205. _TMSoftVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.TMSoftVentValve}");
  206. _VCESoftVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.VCESoftVentValve}");
  207. _VCEFastVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.VCEFastVentValve}");
  208. _VCESlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.VCESlitDoorOpenEnable}");
  209. _PMASlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMASlitDoorOpenEnable}");
  210. _PMBSlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMBSlitDoorOpenEnable}");
  211. _VCESlitDoorCloseEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.VCESlitDoorCloseEnable}");
  212. _PMASlitDoorCloseEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMASlitDoorCloseEnable}");
  213. _PMBSlitDoorCloseEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMBSlitDoorCloseEnable}");
  214. _TMVACSensor = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.TMVACSensor}");
  215. _VCEVACSensor = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.VCEVACSensor}");
  216. _TMATMSensor = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.TMATMSensor}");
  217. _VCEATMSensor = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.VCEATMSensor}");
  218. _VCESlitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.VCESlitDoor}");
  219. _PMASlitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.PMASlitDoor}");
  220. _PMBSlitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.PMBSlitDoor}");
  221. if (_allInstalledModules.Contains("PMC"))
  222. {
  223. _PMCSlitDoorOpenEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMCSlitDoorOpenEnable}");
  224. _PMCSlitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.PMCSlitDoor}");
  225. _PMCSlitDoorCloseEnable = DEVICE.GetDevice<IoSensor>($"{Module}.{VenusDevice.PMCSlitDoorCloseEnable}");
  226. }
  227. _TMMfc = DEVICE.GetDevice<IoMfc>($"{Module}.TM_MFC1");
  228. _TMPressure = DEVICE.GetDevice<IoPressureMeter>($"{Module}.TMPressure");
  229. //_TMPiplinePressure = DEVICE.GetDevice<IoPressureMeter>($"{Module}.TMPipelinePressure");
  230. _VCEPressure = DEVICE.GetDevice<IoPressureMeter>($"{Module}.VCEPressure");
  231. if (SC.GetValue<int>($"{Module}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  232. {
  233. if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  234. {
  235. _TMPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");
  236. }
  237. else if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  238. {
  239. _TMPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VenusDevice.MainPump}");
  240. }
  241. }
  242. DATA.Subscribe($"{Module}.VCESlitDoorClosed", () => VCESlitDoorClosed);
  243. DATA.Subscribe($"{Module}.PMASlitDoorClosed", () => PMASlitDoorClosed);
  244. DATA.Subscribe($"{Module}.PMBSlitDoorClosed", () => PMBSlitDoorClosed);
  245. DATA.Subscribe($"{Module}.PMCSlitDoorClosed", () => PMCSlitDoorClosed);
  246. DATA.Subscribe($"{Module}.PumpIsRunning", () => IsTMPumpRunning, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  247. DATA.Subscribe($"{Module}.TMIsATM", ()=> IsTMATM);
  248. DATA.Subscribe($"{Module}.VCEIsATM", ()=> IsVCEATM);
  249. OP.Subscribe($"{Module}.ControlPump", (cmd, args) =>
  250. {
  251. _TMPump.SetPumpOnOff((bool)args[0]);
  252. return true;
  253. });
  254. OP.Subscribe($"{Module}.SetSlitDoor", (cmd, args) =>
  255. {
  256. var module = (ModuleName)Enum.Parse(typeof(ModuleName), args[0].ToString());
  257. return TurnSlitDoor(module, (bool)args[1]);
  258. });
  259. }
  260. #region IO控制方法
  261. //slitdoor
  262. //2023/11/1 增加两边压差比较
  263. public bool TurnSlitDoor(ModuleName mod, bool bOn)
  264. {
  265. double MaxPressureDifference = SC.GetValue<double>("System.PMTMMaxPressureDifference");
  266. switch (mod)
  267. {
  268. case ModuleName.VCE1:
  269. if (bOn && IsVCEATM && IsTMATM)
  270. {
  271. LOG.Write(eEvent.INFO_TM, ModuleName.SETM, $"open door without Pressure, TM Pressure:{_TMPressure.Value} and VCE Pressure:{_VCEPressure.Value}");
  272. return _VCESlitDoor.SetCylinder(bOn, out _);
  273. }
  274. if (bOn && Math.Abs(_TMPressure.Value - _VCEPressure.Value)> MaxPressureDifference)
  275. {
  276. LOG.Write(eEvent.ERR_TM, ModuleName.SETM, $"cannot open door cause pressure, TM Pressure:{_TMPressure.Value} and VCE Pressure:{_VCEPressure.Value}");
  277. return false;
  278. }
  279. return _VCESlitDoor.SetCylinder(bOn, out _);
  280. case ModuleName.PMA:
  281. if (bOn && Singleton<RouteManager>.Instance.PMA.IsAtm && IsTMATM)
  282. return _PMASlitDoor.SetCylinder(bOn, out _);
  283. if (bOn && !CanOpenSlitDoor(mod, MaxPressureDifference))
  284. return false;
  285. return _PMASlitDoor.SetCylinder(bOn, out _);
  286. case ModuleName.PMB:
  287. if (bOn && Singleton<RouteManager>.Instance.PMB.IsAtm && IsTMATM)
  288. return _PMBSlitDoor.SetCylinder(bOn, out _);
  289. if (bOn && !CanOpenSlitDoor(mod, MaxPressureDifference))
  290. return false;
  291. return _PMBSlitDoor.SetCylinder(bOn, out _);
  292. case ModuleName.PMC:
  293. if (bOn && Singleton<RouteManager>.Instance.PMC.IsAtm && IsTMATM)
  294. return _PMCSlitDoor.SetCylinder(bOn, out _);
  295. if (bOn && !CanOpenSlitDoor(mod, MaxPressureDifference))
  296. return false;
  297. return _PMCSlitDoor.SetCylinder(bOn, out _);
  298. }
  299. return false;
  300. }
  301. //valve
  302. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  303. {
  304. switch (mod)
  305. {
  306. case ModuleName.SETM:
  307. _TMFastPumpValve.TurnValve(bOn, out string _);
  308. break;
  309. case ModuleName.VCE1:
  310. _VCEFastPumpValve.TurnValve(bOn, out string _);
  311. break;
  312. }
  313. }
  314. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  315. {
  316. switch (mod)
  317. {
  318. case ModuleName.SETM:
  319. _TMSoftPumpValve.TurnValve(bOn, out string _);
  320. break;
  321. case ModuleName.VCE1:
  322. _VCESoftPumpValve.TurnValve(bOn, out string _);
  323. break;
  324. }
  325. }
  326. public void TurnFastVentValve(ModuleName mod, bool bOn)
  327. {
  328. switch (mod)
  329. {
  330. case ModuleName.SETM:
  331. _TMFastVentValve.TurnValve(bOn, out string _);
  332. break;
  333. case ModuleName.VCE1:
  334. _VCEFastVentValve.TurnValve(bOn, out string _);
  335. break;
  336. }
  337. }
  338. public void TurnSoftVentValve(ModuleName mod, bool bOn)
  339. {
  340. switch (mod)
  341. {
  342. case ModuleName.SETM:
  343. _TMSoftVentValve.TurnValve(bOn, out string _);
  344. break;
  345. case ModuleName.VCE1:
  346. _VCESoftVentValve.TurnValve(bOn, out string _);
  347. break;
  348. }
  349. }
  350. public bool CloseAllSlitDoor()
  351. {
  352. TurnSlitDoor(ModuleName.VCE1, false);
  353. if (_allInstalledModules.Contains("PMA"))
  354. TurnSlitDoor(ModuleName.PMA,false);
  355. if (_allInstalledModules.Contains("PMB"))
  356. TurnSlitDoor(ModuleName.PMB, false);
  357. if (_allInstalledModules.Contains("PMC"))
  358. TurnSlitDoor(ModuleName.PMC, false);
  359. return true;
  360. }
  361. public void HomeVceSlitDoor()
  362. {
  363. //由SlitDoor的状态对其下发同样的指令
  364. if (VCESlitDoorClosed == true)
  365. TurnSlitDoor(ModuleName.VCE1, false);
  366. else
  367. TurnSlitDoor(ModuleName.VCE1, true);
  368. }
  369. public void CloseVentValve()
  370. {
  371. _TMSoftVentValve.TurnValve(false, out _);
  372. _TMFastVentValve.TurnValve(false, out _);
  373. _VCESoftVentValve.TurnValve(false, out _);
  374. _VCEFastVentValve.TurnValve(false, out _);
  375. }
  376. public override bool CheckSlitValveOpen(ModuleName mod)
  377. {
  378. switch (mod)
  379. {
  380. case ModuleName.VCE1:
  381. return VCESlitDoorOpen;
  382. case ModuleName.PMA:
  383. return PMASlitDoorOpen;
  384. case ModuleName.PMB:
  385. return PMBSlitDoorOpen;
  386. case ModuleName.PMC:
  387. return PMCSlitDoorOpen;
  388. }
  389. return false;
  390. }
  391. public override bool CheckSlitValveClose(ModuleName mod)
  392. {
  393. switch (mod)
  394. {
  395. case ModuleName.VCE1:
  396. return VCESlitDoorClosed;
  397. case ModuleName.PMA:
  398. return PMASlitDoorClosed;
  399. case ModuleName.PMB:
  400. return PMBSlitDoorClosed;
  401. case ModuleName.PMC:
  402. return PMCSlitDoorClosed;
  403. }
  404. return false;
  405. }
  406. public bool CheckPumpValveClosed(ModuleName mod)
  407. {
  408. switch (mod)
  409. {
  410. case ModuleName.SETM:
  411. return !IsTMFastPumpOpen && !IsTMSoftPumpOpen;
  412. case ModuleName.VCE1:
  413. return !IsVCEFastPumpOpen && !IsVCESoftPumpOpen;
  414. }
  415. return true;
  416. }
  417. public bool CheckVentValveClosed(ModuleName mod)
  418. {
  419. switch (mod)
  420. {
  421. case ModuleName.SETM:
  422. if (IsTMVentValveOpen)
  423. {
  424. LOG.Write(eEvent.ERR_TM, ModuleName.SETM, "TM Vent Valve not closed");
  425. return false;
  426. }
  427. break;
  428. case ModuleName.VCE1:
  429. if (IsVCEVentValveOpen)
  430. {
  431. LOG.Write(eEvent.ERR_TM, ModuleName.VCE1, "VCE1 Vent Valve not closed");
  432. return false;
  433. }
  434. break;
  435. }
  436. return true;
  437. }
  438. public void SetTMFlow(int flowValue)
  439. {
  440. _TMMfc.SetPoint = (flowValue);
  441. }
  442. public double GetModulePressure(ModuleName mod)
  443. {
  444. switch (mod)
  445. {
  446. case ModuleName.SETM:
  447. return TMPressure;
  448. case ModuleName.VCE1:
  449. return VCEPressure;
  450. }
  451. return 0.0;
  452. }
  453. public bool TryGetPump(ModuleName mod)
  454. {
  455. //Self
  456. if ((mod == ModuleName.VCE1 && _PumpingState == PumpState.VCEUsing) || (mod == ModuleName.SETM && _PumpingState == PumpState.TMUsing))
  457. return true;
  458. //Idle
  459. if (mod == ModuleName.SETM && !IsTMFastPumpOpen && !IsTMSoftPumpOpen && _PumpingState == PumpState.Idle)
  460. {
  461. _PumpingState = PumpState.TMUsing;
  462. return true;
  463. }
  464. if (mod == ModuleName.VCE1 && !IsVCEFastPumpOpen && !IsVCESoftPumpOpen && _PumpingState == PumpState.Idle)
  465. {
  466. _PumpingState = PumpState.VCEUsing;
  467. return true;
  468. }
  469. LOG.Write(eEvent.WARN_DEFAULT_WARN, mod, "无法打开,另一个泵正在用!");
  470. //locked
  471. return false;
  472. }
  473. public void ReleasePump(ModuleName Module)
  474. {
  475. //release pump (must do it by user)
  476. if ((Module == ModuleName.SETM && _PumpingState == PumpState.TMUsing) || (Module == ModuleName.VCE1 && _PumpingState == PumpState.VCEUsing))
  477. _PumpingState = PumpState.Idle;
  478. }
  479. #endregion
  480. #region 工具方法
  481. private bool CanOpenSlitDoor(ModuleName mod,double MaxPressureDifference)
  482. {
  483. if (Singleton<RouteManager>.Instance.GetPM(mod) == null || RouteManager.IsATMMode)
  484. return true;
  485. else
  486. {
  487. double PMPressure = Singleton<RouteManager>.Instance.GetPM(mod).ChamberPressure;
  488. if (Math.Abs(_TMPressure.Value - PMPressure) <= MaxPressureDifference || (Singleton<RouteManager>.Instance.GetPM(mod).IsAtm && IsTMATM))
  489. {
  490. return true;
  491. }
  492. else
  493. {
  494. LOG.Write(eEvent.ERR_TM, ModuleName.SETM, $"cannot open door cause pressure, TM Pressure:{_TMPressure.Value} and {mod} pressure:{PMPressure}");
  495. return false;
  496. }
  497. }
  498. }
  499. private double mbar2mtorrConvert(double mbar) => mbar * 0.75 * 1000;
  500. #endregion
  501. }
  502. }