JetTM.cs 26 KB

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