JetTM.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.Util;
  5. using Aitex.Core.RT.SCCore;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Sorter.Common;
  8. using MECF.Framework.Common.Device.Bases;
  9. using MECF.Framework.Common.Equipment;
  10. using System;
  11. using System.Collections.Generic;
  12. using Venus_Core;
  13. using Venus_RT.Modules;
  14. using Venus_RT.Modules.PMs;
  15. using Venus_RT.Devices.IODevices;
  16. using Venus_RT.Devices.EPD;
  17. using Aitex.Core.RT.DataCenter;
  18. using Aitex.Core.RT.OperationCenter;
  19. using MECF.Framework.Common.SubstrateTrackings;
  20. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
  21. namespace Venus_RT.Devices
  22. {
  23. class JetTM : TM
  24. {
  25. private readonly IoLid _TMLid;
  26. private readonly IoLid _LLALid;
  27. private readonly IoLid _LLBLid;
  28. private readonly IoCylinder _LLATSlitDoor;
  29. private readonly IoCylinder _LLBTSlitDoor;
  30. private readonly IoCylinder _LLAESlitDoor;
  31. private readonly IoCylinder _LLBESlitDoor;
  32. private readonly IoValve _TMN2Valve;
  33. private readonly IoValve _TMSoftPumpValve;
  34. private readonly IoValve _TMFastPumpValve;
  35. private readonly IoValve _TMPurgeValve;
  36. //private readonly IoValve _TMVentValve;
  37. private readonly IoValve _TMSoftVentValve;
  38. private readonly IoValve _TMFastVentValve;
  39. private readonly IoValve _LLASoftPumpValve;
  40. private readonly IoValve _LLAFastPumpValve;
  41. private readonly IoValve _LLAPurgeValve;
  42. private readonly IoValve _LLAVentValve;
  43. private readonly IoValve _LLBSoftPumpValve;
  44. private readonly IoValve _LLBFastPumpValve;
  45. private readonly IoValve _LLBPurgeValve;
  46. private readonly IoValve _LLBVentValve;
  47. private readonly IoValve _WaferRelayValve;
  48. private readonly IoSensor _TMPowerOn;
  49. private readonly IoSensor _TMInSafty;
  50. private readonly IoSensor _WaferLeakSensor;
  51. private readonly IoSensor _EFEMSideDoorClosed;
  52. private readonly IoSensor _TMPCWFlowSwitch;
  53. private readonly IoSensor _LLAPCWFlowSwitch;
  54. private readonly IoSensor _LLBPCWFlowSwitch;
  55. private readonly IoSensor _TMLidClosed;
  56. private readonly IoSensor _CDAPressureSwitch;
  57. private readonly IoSensor _VaccumPressureSwitch;
  58. private readonly IoSensor _N2PressureSwitch;
  59. private readonly IoSensor _TMRobotNotExtendPMA;
  60. private readonly IoSensor _TMRobotNotExtendPMB;
  61. private readonly IoSensor _TMRobotNotExtendPMC;
  62. private readonly IoSensor _TMRobotNotExtendPMD;
  63. private readonly IoSensor _TMRobotNotExtendLLA;
  64. private readonly IoSensor _TMRobotNotExtendLLB;
  65. private readonly IoSensor _EfemRobotNotExtendLLA;
  66. private readonly IoSensor _EfemRobotNotExtendLLB;
  67. private readonly IoSensor _TMVacSwitch;
  68. private readonly IoSensor _LLAVacSwitch;
  69. private readonly IoSensor _LLBVacSwitch;
  70. private readonly IoSensor _TMATMSwitch;
  71. private readonly IoSensor _LLAATMSwitch;
  72. private readonly IoSensor _LLBATMSwitch;
  73. private readonly IoSwitch _LLAWaferSizeCheck;
  74. private readonly IoSwitch _LLBWaferSizeCheck;
  75. private readonly IoSwitch _PMAWaferSizeCheck;
  76. private readonly IoSwitch _PMBWaferSizeCheck;
  77. private readonly IoSwitch _PMCWaferSizeCheck;
  78. private readonly IoSwitch _PMDWaferSizeCheck;
  79. private readonly PumpBase _TMPump;
  80. private readonly PumpBase _LLPump;
  81. private readonly IoTMPressureCtrl _presureCtrl;
  82. public bool TMLidClosed => _TMLid.OFFFeedback;
  83. public bool LLALidClosed => _LLALid.OFFFeedback;
  84. public bool LLBLidClosed => _LLBLid.OFFFeedback;
  85. public bool IsLLASlitDoorClosed => _LLATSlitDoor.State == CylinderState.Close;
  86. public bool IsLLASlitDoorOpen => _LLATSlitDoor.State == CylinderState.Open;
  87. public bool IsLLAESlitDoorClosed => _LLAESlitDoor.State == CylinderState.Close;
  88. public bool IsLLAESlitDoorOpen => _LLAESlitDoor.State == CylinderState.Open;
  89. public bool IsLLBSlitDoorClosed => _LLBTSlitDoor.State == CylinderState.Close;
  90. public bool IsLLBSlitDoorOpen => _LLBTSlitDoor.State == CylinderState.Open;
  91. public bool IsLLBESlitDoorClosed => _LLBESlitDoor.State == CylinderState.Close;
  92. public bool IsLLBESlitDoorOpen => _LLBESlitDoor.State == CylinderState.Open;
  93. public bool IsTMVac => _TMVacSwitch.Value;
  94. public bool IsLLAVac => _LLAVacSwitch.Value;
  95. public bool IsLLBVac => _LLBVacSwitch.Value;
  96. public bool IsTMATM => _TMATMSwitch.Value;
  97. public bool IsLLAATM => _LLAATMSwitch.Value;
  98. public bool IsLLBATM => _LLBATMSwitch.Value;
  99. public bool IsTMPowerOn => _TMPowerOn.Value;
  100. public bool IsTMInSafty => _TMInSafty.Value;
  101. public bool IsLLAFastPumpOpen => _LLAFastPumpValve.Status;
  102. public bool IsLLASoftPumpOpen => _LLASoftPumpValve.Status;
  103. public bool IsLLBFastPumpOpen => _LLBFastPumpValve.Status;
  104. public bool IsLLBSoftPumpOpen => _LLBSoftPumpValve.Status;
  105. public bool IsLLAVentValveOpen => _LLAVentValve.Status;
  106. public bool IsLLAPurgeValveOpen => _LLAPurgeValve.Status;
  107. public bool IsLLBVentValveOpen => _LLBVentValve.Status;
  108. public bool IsLLBPurgeValveOpen => _LLBPurgeValve.Status;
  109. public bool IsTMSoftVentValveOpen => _TMSoftVentValve.Status;
  110. public bool IsTMFastVentValveOpen => _TMFastVentValve.Status;
  111. public bool IsTMPurgeValveOpen => _TMPurgeValve.Status;
  112. public bool IsTMFastPumpOpen => _TMFastPumpValve.Status;
  113. public bool IsTMSoftPumpOpen => _TMSoftPumpValve.Status;
  114. public bool TMRobotNotExtendToPMA => _TMRobotNotExtendPMA.Value;
  115. public bool TMRobotNotExtendToPMB => _TMRobotNotExtendPMB.Value;
  116. public bool TMRobotNotExtendToPMC => _TMRobotNotExtendPMC.Value;
  117. public bool TMRobotNotExtendToPMD => _TMRobotNotExtendPMD.Value;
  118. public bool TMRobotNotExtendToLLA => _TMRobotNotExtendLLA.Value;
  119. public bool TMRobotNotExtendToLLB => _TMRobotNotExtendLLB.Value;
  120. public bool EfemRobotNotExtendToLLA => _EfemRobotNotExtendLLA.Value;
  121. public bool EfemRobotNotExtendToLLB => _EfemRobotNotExtendLLB.Value;
  122. public double TMPressure => _presureCtrl.TMPressureGauge.Value;
  123. public double LLAPressure => _presureCtrl.LLAPressureGauge.Value;
  124. public double LLBPressure => _presureCtrl.LLBPressureGauge.Value;
  125. public double TMForelinePressure => _presureCtrl.MFForelineGauge.Value;
  126. public double LoadlockForelinePressure => _presureCtrl.LLForelineGauge.Value;
  127. public bool? TMPumpIsRunning => _TMPump?.IsRunning;
  128. public bool? LLPumpIsRunning => _LLPump?.IsRunning;
  129. public JetTM() : base("TM")
  130. {
  131. _TMLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.TMLid}");
  132. _LLALid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLALid}");
  133. _LLBLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLBLid}");
  134. _LLATSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLATSlitDoor}");
  135. _LLBTSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBTSlitDoor}");
  136. _LLAESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLAESlitDoor}");
  137. _LLBESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBESlitDoor}");
  138. _TMN2Valve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMValveN2}");
  139. _TMSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftPumpValve}");
  140. _TMFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastPumpValve}");
  141. _TMPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMPurgeValve}");
  142. //_TMVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMVentValve}");
  143. _TMSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftVentValve}");
  144. _TMFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastVentValve}");
  145. _LLASoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLASoftPumpValve}");
  146. _LLAFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAFastPumpValve}");
  147. _LLAPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAPurgeValve}");
  148. _LLAVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAVentValve}");
  149. _LLBSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBSoftPumpValve}");
  150. _LLBFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBFastPumpValve}");
  151. _LLBPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBPurgeValve}");
  152. _LLBVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBVentValve}");
  153. _WaferRelayValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.ValveWaterRelay}");
  154. _TMPowerOn = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPowerOn}");
  155. _TMInSafty = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMInSafty}");
  156. _WaferLeakSensor = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.WaferLeakSensor}");
  157. _EFEMSideDoorClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EFEMSideDoorClosed}");
  158. _TMPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPCWFlowSwitch}");
  159. _LLAPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAPCWFlowSwitch}");
  160. _LLBPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBPCWFlowSwitch}");
  161. _TMLidClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMLidClosed}");
  162. _CDAPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.CDAPressureSwitch}");
  163. _VaccumPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.VaccumPressureSwitch}");
  164. _N2PressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.N2PressureSwitch}");
  165. _TMRobotNotExtendPMA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMA}");
  166. _TMRobotNotExtendPMB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMB}");
  167. _TMRobotNotExtendPMC = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMC}");
  168. _TMRobotNotExtendPMD = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMD}");
  169. _TMRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLA}");
  170. _TMRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLB}");
  171. _EfemRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLA}");
  172. _EfemRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLB}");
  173. _TMVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMVacSwitch}");
  174. _LLAVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAVacSwitch}");
  175. _LLBVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBVacSwitch}");
  176. _TMATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMATMSwitch}");
  177. _LLAATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAATMSwitch}");
  178. _LLBATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBATMSwitch}");
  179. _LLAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLAWaferSizeCheckSwitch}");
  180. _LLBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLBWaferSizeCheckSwitch}");
  181. _PMAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMAWaferSizeCheckSwitch}");
  182. _PMBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMBWaferSizeCheckSwitch}");
  183. _PMCWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMCWaferSizeCheckSwitch}");
  184. _PMDWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMDWaferSizeCheckSwitch}");
  185. _presureCtrl = DEVICE.GetDevice<IoTMPressureCtrl>($"TM.{VenusDevice.TMPressureCtrl}");
  186. if (SC.GetValue<int>($"TM.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  187. {
  188. if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.SKY)
  189. {
  190. _TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  191. }
  192. else if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  193. {
  194. _TMPump = DEVICE.GetDevice<EdwardsPump>($"TM.{VenusDevice.MainPump}");
  195. }
  196. }
  197. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  198. {
  199. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  200. {
  201. _LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  202. }
  203. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  204. {
  205. _LLPump = DEVICE.GetDevice<EdwardsPump>($"LLA.{VenusDevice.MainPump}");
  206. }
  207. }
  208. //_LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  209. //_TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  210. DATA.Subscribe("TM.PumpIsRunning", () => TMPumpIsRunning);
  211. OP.Subscribe("TM.ControlPump", (cmd, args) =>
  212. {
  213. _TMPump.SetPumpOnOff((bool)args[0]);
  214. return true;
  215. });
  216. DATA.Subscribe("LL.PumpIsRunning", () => LLPumpIsRunning);
  217. OP.Subscribe("LL.ControlPump", (cmd, args) =>
  218. {
  219. _LLPump.SetPumpOnOff((bool)args[0]);
  220. return true;
  221. });
  222. }
  223. public override void Monitor()
  224. {
  225. _WaferRelayValve.TurnValve(_WaferLeakSensor.Value, out string _);
  226. }
  227. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  228. {
  229. switch(mod)
  230. {
  231. case ModuleName.TM:
  232. _TMSoftPumpValve.TurnValve(bOn, out string _);
  233. break;
  234. case ModuleName.LLA:
  235. _LLASoftPumpValve.TurnValve(bOn, out string _);
  236. break;
  237. case ModuleName.LLB:
  238. _LLBSoftPumpValve.TurnValve(bOn, out string _);
  239. break;
  240. }
  241. }
  242. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  243. {
  244. switch(mod)
  245. {
  246. case ModuleName.TM:
  247. _TMFastPumpValve.TurnValve(bOn, out string _);
  248. break;
  249. case ModuleName.LLA:
  250. _LLAFastPumpValve.TurnValve(bOn, out string _);
  251. break;
  252. case ModuleName.LLB:
  253. _LLBFastPumpValve.TurnValve(bOn, out string _);
  254. break;
  255. }
  256. }
  257. public void TurnVentValve(ModuleName mod, bool bOn)
  258. {
  259. switch(mod)
  260. {
  261. case ModuleName.TM:
  262. _TMSoftVentValve.TurnValve(bOn, out string _);
  263. break;
  264. case ModuleName.LLA:
  265. _LLAVentValve.TurnValve(bOn, out string _);
  266. break;
  267. case ModuleName.LLB:
  268. _LLBVentValve.TurnValve(bOn, out string _);
  269. break;
  270. }
  271. }
  272. public void TurnPurgeValve(ModuleName mod, bool bOn)
  273. {
  274. switch(mod)
  275. {
  276. case ModuleName.TM:
  277. _TMPurgeValve.TurnValve(bOn, out string _);
  278. break;
  279. case ModuleName.LLA:
  280. _LLAPurgeValve.TurnValve(bOn, out string _);
  281. break;
  282. case ModuleName.LLB:
  283. _LLBPurgeValve.TurnValve(bOn, out string _);
  284. break;
  285. }
  286. }
  287. public void TurnN2Valve(bool bOn)
  288. {
  289. _TMN2Valve.TurnValve(bOn, out string _);
  290. }
  291. public void CloseModuleAllValves(ModuleName mod)
  292. {
  293. TurnFastPumpValve(mod, false);
  294. TurnSoftPumpValve(mod, false);
  295. TurnVentValve(mod, false);
  296. TurnPurgeValve(mod, false);
  297. if (mod == ModuleName.TM)
  298. TurnN2Valve(false);
  299. }
  300. public double GetModulePressure(ModuleName mod)
  301. {
  302. switch (mod)
  303. {
  304. case ModuleName.TM:
  305. return TMPressure;
  306. case ModuleName.LLA:
  307. return LLAPressure;
  308. case ModuleName.LLB:
  309. return LLBPressure;
  310. }
  311. return 0;
  312. }
  313. public bool IsModuleATM(ModuleName mod)
  314. {
  315. switch (mod)
  316. {
  317. case ModuleName.TM:
  318. return IsTMATM;
  319. case ModuleName.LLA:
  320. return IsLLAATM;
  321. case ModuleName.LLB:
  322. return IsLLBATM;
  323. }
  324. return false;
  325. }
  326. public bool IsModuleVaccum(ModuleName mod)
  327. {
  328. switch (mod)
  329. {
  330. case ModuleName.TM:
  331. return IsTMVac;
  332. case ModuleName.LLA:
  333. return IsLLAVac;
  334. case ModuleName.LLB:
  335. return IsLLBVac;
  336. }
  337. return false;
  338. }
  339. public bool CheckLidClosed(ModuleName mod)
  340. {
  341. switch (mod)
  342. {
  343. case ModuleName.TM:
  344. if(!TMLidClosed)
  345. {
  346. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Lid not closed");
  347. return false;
  348. }
  349. break;
  350. case ModuleName.LLA:
  351. if(!LLALidClosed)
  352. {
  353. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Lid not closed");
  354. return false;
  355. }
  356. break;
  357. case ModuleName.LLB:
  358. if (!LLBLidClosed)
  359. {
  360. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Lid not closed");
  361. return false;
  362. }
  363. break;
  364. }
  365. return true;
  366. }
  367. public bool CheckVentValveClosed(ModuleName mod)
  368. {
  369. switch (mod)
  370. {
  371. case ModuleName.TM:
  372. if (IsTMSoftVentValveOpen)
  373. {
  374. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Vent Valve not closed");
  375. return false;
  376. }
  377. break;
  378. case ModuleName.LLA:
  379. if (IsLLAVentValveOpen)
  380. {
  381. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Vent Valve not closed");
  382. return false;
  383. }
  384. break;
  385. case ModuleName.LLB:
  386. if (IsLLBVentValveOpen)
  387. {
  388. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Vent Valve not closed");
  389. return false;
  390. }
  391. break;
  392. }
  393. return true;
  394. }
  395. public bool CheckPurgeValveClosed(ModuleName mod)
  396. {
  397. switch (mod)
  398. {
  399. case ModuleName.TM:
  400. if (IsTMPurgeValveOpen)
  401. {
  402. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Purge Valve not closed");
  403. return false;
  404. }
  405. break;
  406. case ModuleName.LLA:
  407. if (IsLLAPurgeValveOpen)
  408. {
  409. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Purge Valve not closed");
  410. return false;
  411. }
  412. break;
  413. case ModuleName.LLB:
  414. if (IsLLBPurgeValveOpen)
  415. {
  416. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Purge Valve not closed");
  417. return false;
  418. }
  419. break;
  420. }
  421. return true;
  422. }
  423. public bool CheckPumpValveClosed(ModuleName mod)
  424. {
  425. switch (mod)
  426. {
  427. case ModuleName.TM:
  428. if (IsTMFastPumpOpen)
  429. {
  430. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Fast Pump Valve not closed");
  431. return false;
  432. }
  433. else if(IsTMSoftPumpOpen)
  434. {
  435. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Soft Pump Valve not closed");
  436. return false;
  437. }
  438. break;
  439. case ModuleName.LLA:
  440. if (IsLLAFastPumpOpen)
  441. {
  442. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Fast Pump Valve not closed");
  443. return false;
  444. }
  445. else if(IsLLASoftPumpOpen)
  446. {
  447. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Soft Pump Valve not closed");
  448. return false;
  449. }
  450. break;
  451. case ModuleName.LLB:
  452. if (IsLLBFastPumpOpen)
  453. {
  454. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Fast Pump Valve not closed");
  455. return false;
  456. }
  457. else if(IsLLBSoftPumpOpen)
  458. {
  459. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Soft Pump Valve not closed");
  460. return false;
  461. }
  462. break;
  463. }
  464. return true;
  465. }
  466. public bool TurnMFSlitDoor(ModuleName loadlock, bool open, out string reason)
  467. {
  468. if (open)
  469. {
  470. bool _isATMMode = SC.GetValue<bool>("System.IsATMMode");
  471. if (_isATMMode)
  472. {
  473. if (!IsTMATM)
  474. {
  475. reason = $"TM is not ATM, can not open slit door";
  476. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  477. return false;
  478. }
  479. if (!IsModuleATM(loadlock))
  480. {
  481. reason = $"{loadlock} is not ATM, can not open slit door";
  482. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  483. return false;
  484. }
  485. }
  486. else
  487. {
  488. double maxPressureDifference = SC.GetValue<double>("System.TMLLMaxPressureDifference");
  489. if (Math.Abs(GetModulePressure(loadlock) - GetModulePressure(ModuleName.TM)) > maxPressureDifference)
  490. {
  491. reason = $"{loadlock} and TM pressure difference exceeds the max limit {maxPressureDifference}";
  492. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  493. return false;
  494. }
  495. }
  496. }
  497. switch(loadlock)
  498. {
  499. case ModuleName.LLA:
  500. return _LLATSlitDoor.SetCylinder(open, out reason);
  501. case ModuleName.LLB:
  502. return _LLBTSlitDoor.SetCylinder(open, out reason);
  503. }
  504. reason = $"Invalid module {loadlock}";
  505. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  506. return false;
  507. }
  508. public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason)
  509. {
  510. if(open && !IsModuleATM(loadlock))
  511. {
  512. reason = $"{loadlock} is not ATM, can not open EFEM side slit door";
  513. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  514. return false;
  515. }
  516. switch (loadlock)
  517. {
  518. case ModuleName.LLA:
  519. return _LLAESlitDoor.SetCylinder(open, out reason);
  520. case ModuleName.LLB:
  521. return _LLBESlitDoor.SetCylinder(open, out reason);
  522. }
  523. reason = $"Invalid module {loadlock}";
  524. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  525. return false;
  526. }
  527. //public bool ControlTMPump(bool ison)
  528. //{
  529. // _TMPump.SetPumpOnOff(ison);
  530. // return true;
  531. //}
  532. }
  533. }