JetTM.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  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. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
  22. using IoMfc = Venus_RT.Devices.IODevices.IoMfc;
  23. namespace Venus_RT.Devices
  24. {
  25. class JetTM : TM
  26. {
  27. private readonly IoLid _TMLid;
  28. private readonly IoLid _LLALid;
  29. private readonly IoLid _LLBLid;
  30. private readonly IoCylinder _LLATSlitDoor;
  31. private readonly IoCylinder _LLBTSlitDoor;
  32. private readonly IoCylinder _LLAESlitDoor;
  33. private readonly IoCylinder _LLBESlitDoor;
  34. private readonly IoValve _TMN2Valve;
  35. private readonly IoValve _TMSoftPumpValve;
  36. private readonly IoValve _TMFastPumpValve;
  37. private readonly IoValve _TMPurgeValve;
  38. private readonly IoValve _TMVentValve;
  39. //private readonly IoValve _TMSoftVentValve;
  40. //private readonly IoValve _TMFastVentValve;
  41. private readonly IoValve _LLASoftPumpValve;
  42. private readonly IoValve _LLAFastPumpValve;
  43. private readonly IoValve _LLAPurgeValve;
  44. private readonly IoValve _LLAVentValve;
  45. private readonly IoValve _LLASoftVentValve;
  46. private readonly IoValve _LLAFastVentValve;
  47. private readonly IoValve _LLBSoftVentValve;
  48. private readonly IoValve _LLBFastVentValve;
  49. private readonly IoValve _LLBSoftPumpValve;
  50. private readonly IoValve _LLBFastPumpValve;
  51. private readonly IoValve _LLBPurgeValve;
  52. private readonly IoValve _LLBVentValve;
  53. private readonly IoValve _WaferRelayValve;
  54. private readonly IoValve _TMVacAtmMode;
  55. private readonly IoSensor _TMPowerOn;
  56. private readonly IoSensor _TMInSafty;
  57. private readonly IoSensor _WaferLeakSensor;
  58. private readonly IoSensor _EFEMSideDoorClosed;
  59. private readonly IoSensor _TMPCWFlowSwitch;
  60. private readonly IoSensor _LLAPCWFlowSwitch;
  61. private readonly IoSensor _LLBPCWFlowSwitch;
  62. private readonly IoSensor _TMLidClosed;
  63. private readonly IoSensor _CDAPressureSwitch;
  64. private readonly IoSensor _VaccumPressureSwitch;
  65. private readonly IoSensor _N2PressureSwitch;
  66. private readonly IoSensor _TMRobotNotExtendPMA;
  67. private readonly IoSensor _TMRobotNotExtendPMB;
  68. private readonly IoSensor _TMRobotNotExtendPMC;
  69. private readonly IoSensor _TMRobotNotExtendPMD;
  70. private readonly IoSensor _TMRobotNotExtendLLA;
  71. private readonly IoSensor _TMRobotNotExtendLLB;
  72. private readonly IoSensor _EfemRobotNotExtendLLA;
  73. private readonly IoSensor _EfemRobotNotExtendLLB;
  74. private readonly IoSensor _TMVacSwitch;
  75. private readonly IoSensor _LLAVacSwitch;
  76. private readonly IoSensor _LLBVacSwitch;
  77. private readonly IoSensor _TMATMSwitch;
  78. private readonly IoSensor _LLAATMSwitch;
  79. private readonly IoSensor _LLBATMSwitch;
  80. private readonly IoSwitch _LLAWaferSizeCheck;
  81. private readonly IoSwitch _LLBWaferSizeCheck;
  82. private readonly IoSwitch _PMAWaferSizeCheck;
  83. private readonly IoSwitch _PMBWaferSizeCheck;
  84. private readonly IoSwitch _PMCWaferSizeCheck;
  85. private readonly IoSwitch _PMDWaferSizeCheck;
  86. private readonly IoSwitch _PressureMode_Switch;
  87. private readonly IoMfc _TMMfc;
  88. private readonly PumpBase _TMPump;
  89. private readonly PumpBase _LLPump;
  90. private readonly IoTMPressureCtrl _presureCtrl;
  91. private readonly bool _isATMMode;
  92. public bool TMLidClosed => _TMLid.OFFFeedback;
  93. public bool LLALidClosed => _LLALid.OFFFeedback;
  94. public bool LLBLidClosed => _LLBLid.OFFFeedback;
  95. public bool IsLLASlitDoorClosed => _LLATSlitDoor.State == CylinderState.Close;
  96. public bool IsLLASlitDoorOpen => _LLATSlitDoor.State == CylinderState.Open;
  97. public bool IsLLAESlitDoorClosed => _LLAESlitDoor.State == CylinderState.Close;
  98. public bool IsLLAESlitDoorOpen => _LLAESlitDoor.State == CylinderState.Open;
  99. public bool IsLLBSlitDoorClosed => _LLBTSlitDoor.State == CylinderState.Close;
  100. public bool IsLLBSlitDoorOpen => _LLBTSlitDoor.State == CylinderState.Open;
  101. public bool IsLLBESlitDoorClosed => _LLBESlitDoor.State == CylinderState.Close;
  102. public bool IsLLBESlitDoorOpen => _LLBESlitDoor.State == CylinderState.Open;
  103. public bool IsTMVac => _TMVacSwitch.Value;
  104. public bool IsLLAVac => _LLAVacSwitch.Value;
  105. public bool IsLLBVac => _LLBVacSwitch.Value;
  106. public bool IsTMATM => _TMATMSwitch.Value;
  107. public bool IsLLAATM => _LLAATMSwitch.Value;
  108. public bool IsLLBATM => _LLBATMSwitch.Value;
  109. public bool IsTMPowerOn => _TMPowerOn.Value;
  110. public bool IsTMInSafty => _TMInSafty.Value;
  111. public bool IsLLAFastPumpOpen => _LLAFastPumpValve.Status;
  112. public bool IsLLASoftPumpOpen => _LLASoftPumpValve.Status;
  113. public bool IsLLBFastPumpOpen => _LLBFastPumpValve.Status;
  114. public bool IsLLBSoftPumpOpen => _LLBSoftPumpValve.Status;
  115. public bool IsLLAVentValveOpen => _LLAVentValve.Status;
  116. public bool IsLLAPurgeValveOpen => _LLAPurgeValve.Status;
  117. public bool IsLLBVentValveOpen => _LLBVentValve.Status;
  118. public bool IsLLBPurgeValveOpen => _LLBPurgeValve.Status;
  119. public bool IsTMVentValveOpen => _TMVentValve.Status;
  120. // public bool IsTMFastVentValveOpen => _TMFastVentValve.Status;
  121. public bool IsTMPurgeValveOpen => _TMPurgeValve.Status;
  122. public bool IsTMFastPumpOpen => _TMFastPumpValve.Status;
  123. public bool IsTMSoftPumpOpen => _TMSoftPumpValve.Status;
  124. public bool TMRobotNotExtendToPMA => _TMRobotNotExtendPMA.Value;
  125. public bool TMRobotNotExtendToPMB => _TMRobotNotExtendPMB.Value;
  126. public bool TMRobotNotExtendToPMC => _TMRobotNotExtendPMC.Value;
  127. public bool TMRobotNotExtendToPMD => _TMRobotNotExtendPMD.Value;
  128. public bool TMRobotNotExtendToLLA => _TMRobotNotExtendLLA.Value;
  129. public bool TMRobotNotExtendToLLB => _TMRobotNotExtendLLB.Value;
  130. public bool EfemRobotNotExtendToLLA => _EfemRobotNotExtendLLA.Value;
  131. public bool EfemRobotNotExtendToLLB => _EfemRobotNotExtendLLB.Value;
  132. public double TMPressure => _presureCtrl.TMPressureGauge.Value;
  133. public double LLAPressure => _presureCtrl.LLAPressureGauge.Value;
  134. public double LLBPressure => _presureCtrl.LLBPressureGauge.Value;
  135. public double TMForelinePressure => _presureCtrl.MFForelineGauge.Value;
  136. public double LoadlockForelinePressure => _presureCtrl.LLForelineGauge.Value;
  137. public bool? TMPumpIsRunning => _TMPump?.IsRunning;
  138. public bool? LLPumpIsRunning => _LLPump?.IsRunning;
  139. private string _allInstalledModules { get { return SC.GetStringValue("System.InstalledModules").ToString(); } }
  140. public bool PMASlitDoorClosed
  141. {
  142. get
  143. {
  144. if (_allInstalledModules.Contains("PMA"))
  145. {
  146. return DATA.Poll<bool>("PMA", "IsSlitDoorClosed");
  147. }
  148. else
  149. {
  150. return true;
  151. }
  152. }
  153. }
  154. public bool PMBSlitDoorClosed
  155. {
  156. get
  157. {
  158. if (_allInstalledModules.Contains("PMB"))
  159. {
  160. return DATA.Poll<bool>("PMB", "IsSlitDoorClosed");
  161. }
  162. else
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. public bool PMCSlitDoorClosed
  169. {
  170. get
  171. {
  172. if (_allInstalledModules.Contains("PMC"))
  173. {
  174. return DATA.Poll<bool>("PMC", "IsSlitDoorClosed");
  175. }
  176. else
  177. {
  178. return true;
  179. }
  180. }
  181. }
  182. public bool PMDSlitDoorClosed
  183. {
  184. get
  185. {
  186. if (_allInstalledModules.Contains("PMD"))
  187. {
  188. return DATA.Poll<bool>("PMD", "IsSlitDoorClosed");
  189. }
  190. else
  191. {
  192. return true;
  193. }
  194. }
  195. }
  196. public bool AllPMSlitDoorClosed
  197. {
  198. get
  199. {
  200. if (PMASlitDoorClosed == true && PMBSlitDoorClosed == true && PMCSlitDoorClosed == true && PMDSlitDoorClosed == true)
  201. {
  202. return true;
  203. }
  204. else
  205. {
  206. return false;
  207. }
  208. }
  209. }
  210. public JetTM() : base("TM")
  211. {
  212. _TMLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.TMLid}");
  213. _LLALid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLALid}");
  214. _LLBLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLBLid}");
  215. _LLATSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLATSlitDoor}");
  216. _LLBTSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBTSlitDoor}");
  217. _LLAESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLAESlitDoor}");
  218. _LLBESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBESlitDoor}");
  219. _TMN2Valve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMValveN2}");
  220. _TMSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftPumpValve}");
  221. _TMFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastPumpValve}");
  222. _TMPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMPurgeValve}");
  223. _TMVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMVentValve}");
  224. //_TMSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftVentValve}");
  225. //_TMFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastVentValve}");
  226. _LLASoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLASoftPumpValve}");
  227. _LLAFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAFastPumpValve}");
  228. _LLAPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAPurgeValve}");
  229. _LLAVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAVentValve}");
  230. _LLASoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLASoftVentValve}");
  231. _LLAFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAFastVentValve}");
  232. _LLBSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBSoftVentValve}");
  233. _LLBFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBFastVentValve}");
  234. _TMVacAtmMode = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMVacAtmMode}");
  235. _LLBSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBSoftPumpValve}");
  236. _LLBFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBFastPumpValve}");
  237. _LLBPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBPurgeValve}");
  238. _LLBVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBVentValve}");
  239. _WaferRelayValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.ValveWaterRelay}");
  240. _TMPowerOn = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPowerOn}");
  241. _TMInSafty = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMInSafty}");
  242. _WaferLeakSensor = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.WaferLeakSensor}");
  243. _EFEMSideDoorClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EFEMSideDoorClosed}");
  244. _TMPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPCWFlowSwitch}");
  245. _LLAPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAPCWFlowSwitch}");
  246. _LLBPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBPCWFlowSwitch}");
  247. _TMLidClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMLidClosed}");
  248. _CDAPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.CDAPressureSwitch}");
  249. _VaccumPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.VaccumPressureSwitch}");
  250. _N2PressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.N2PressureSwitch}");
  251. _TMRobotNotExtendPMA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMA}");
  252. _TMRobotNotExtendPMB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMB}");
  253. _TMRobotNotExtendPMC = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMC}");
  254. _TMRobotNotExtendPMD = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMD}");
  255. _TMRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLA}");
  256. _TMRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLB}");
  257. _EfemRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLA}");
  258. _EfemRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLB}");
  259. _TMVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMVacSwitch}");
  260. _LLAVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAVacSwitch}");
  261. _LLBVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBVacSwitch}");
  262. _TMATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMATMSwitch}");
  263. _LLAATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAATMSwitch}");
  264. _LLBATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBATMSwitch}");
  265. _LLAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLAWaferSizeCheckSwitch}");
  266. _LLBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLBWaferSizeCheckSwitch}");
  267. _PMAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMAWaferSizeCheckSwitch}");
  268. _PMBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMBWaferSizeCheckSwitch}");
  269. _PMCWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMCWaferSizeCheckSwitch}");
  270. _PMDWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMDWaferSizeCheckSwitch}");
  271. _PressureMode_Switch = DEVICE.GetDevice<IoSwitch>("TM.PressureModeSwitch");
  272. _TMMfc = DEVICE.GetDevice<IoMfc>($"{Module}.TM_MFC1");
  273. _presureCtrl = DEVICE.GetDevice<IoTMPressureCtrl>($"TM.{VenusDevice.TMPressureCtrl}");
  274. if (SC.GetValue<int>($"TM.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  275. {
  276. if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.SKY)
  277. {
  278. _TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  279. }
  280. else if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  281. {
  282. _TMPump = DEVICE.GetDevice<EdwardsPump>($"TM.{VenusDevice.MainPump}");
  283. }
  284. }
  285. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  286. {
  287. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  288. {
  289. _LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  290. }
  291. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  292. {
  293. _LLPump = DEVICE.GetDevice<EdwardsPump>($"LLA.{VenusDevice.MainPump}");
  294. }
  295. }
  296. //_LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  297. //_TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  298. DATA.Subscribe("TM.PumpIsRunning", () => TMPumpIsRunning);
  299. OP.Subscribe("TM.ControlPump", (cmd, args) =>
  300. {
  301. _TMPump.SetPumpOnOff((bool)args[0]);
  302. return true;
  303. });
  304. DATA.Subscribe("LL.PumpIsRunning", () => LLPumpIsRunning);
  305. OP.Subscribe("LL.ControlPump", (cmd, args) =>
  306. {
  307. _LLPump.SetPumpOnOff((bool)args[0]);
  308. return true;
  309. });
  310. OP.Subscribe("TM.SetChamberPressure", (cmd, args) =>
  311. {
  312. _presureCtrl.SetTMPressure((int)(args[0]));
  313. return true;
  314. });
  315. OP.Subscribe("TM.SetChamberFlow", (cmd, args) =>
  316. {
  317. _TMMfc.SetPoint = (int)(args[0]);
  318. return true;
  319. });
  320. _isATMMode = SC.GetValue<bool>("System.IsATMMode");
  321. _TMVacAtmMode.TurnValve(_isATMMode, out string _);
  322. }
  323. public override void Monitor()
  324. {
  325. _WaferRelayValve.TurnValve(_WaferLeakSensor.Value, out string _);
  326. }
  327. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  328. {
  329. switch(mod)
  330. {
  331. case ModuleName.TM:
  332. _TMSoftPumpValve.TurnValve(bOn, out string _);
  333. break;
  334. case ModuleName.LLA:
  335. _LLASoftPumpValve.TurnValve(bOn, out string _);
  336. break;
  337. case ModuleName.LLB:
  338. _LLBSoftPumpValve.TurnValve(bOn, out string _);
  339. break;
  340. }
  341. }
  342. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  343. {
  344. switch(mod)
  345. {
  346. case ModuleName.TM:
  347. _TMFastPumpValve.TurnValve(bOn, out string _);
  348. break;
  349. case ModuleName.LLA:
  350. _LLAFastPumpValve.TurnValve(bOn, out string _);
  351. break;
  352. case ModuleName.LLB:
  353. _LLBFastPumpValve.TurnValve(bOn, out string _);
  354. break;
  355. }
  356. }
  357. public void TurnVentValve(ModuleName mod, bool bOn)
  358. {
  359. switch (mod)
  360. {
  361. case ModuleName.TM:
  362. _TMVentValve.TurnValve(bOn, out string _);
  363. break;
  364. case ModuleName.LLA:
  365. _LLAVentValve.TurnValve(bOn, out string _);
  366. break;
  367. case ModuleName.LLB:
  368. _LLBVentValve.TurnValve(bOn, out string _);
  369. break;
  370. }
  371. }
  372. public void TurnPurgeValve(ModuleName mod, bool bOn)
  373. {
  374. switch(mod)
  375. {
  376. case ModuleName.TM:
  377. _TMPurgeValve.TurnValve(bOn, out string _);
  378. break;
  379. case ModuleName.LLA:
  380. _LLAPurgeValve.TurnValve(bOn, out string _);
  381. break;
  382. case ModuleName.LLB:
  383. _LLBPurgeValve.TurnValve(bOn, out string _);
  384. break;
  385. }
  386. }
  387. public void TurnN2Valve(bool bOn)
  388. {
  389. _TMN2Valve.TurnValve(bOn, out string _);
  390. }
  391. public void CloseModuleAllValves(ModuleName mod)
  392. {
  393. TurnFastPumpValve(mod, false);
  394. TurnSoftPumpValve(mod, false);
  395. TurnVentValve(mod, false);
  396. TurnPurgeValve(mod, false);
  397. if (mod == ModuleName.TM)
  398. TurnN2Valve(false);
  399. }
  400. public double GetModulePressure(ModuleName mod)
  401. {
  402. switch (mod)
  403. {
  404. case ModuleName.TM:
  405. return TMPressure;
  406. case ModuleName.LLA:
  407. return LLAPressure;
  408. case ModuleName.LLB:
  409. return LLBPressure;
  410. }
  411. return 0;
  412. }
  413. public bool IsModuleATM(ModuleName mod)
  414. {
  415. switch (mod)
  416. {
  417. case ModuleName.TM:
  418. return IsTMATM;
  419. case ModuleName.LLA:
  420. return IsLLAATM;
  421. case ModuleName.LLB:
  422. return IsLLBATM;
  423. }
  424. return false;
  425. }
  426. public bool IsModuleVaccum(ModuleName mod)
  427. {
  428. switch (mod)
  429. {
  430. case ModuleName.TM:
  431. return IsTMVac;
  432. case ModuleName.LLA:
  433. return IsLLAVac;
  434. case ModuleName.LLB:
  435. return IsLLBVac;
  436. }
  437. return false;
  438. }
  439. public bool CheckLidClosed(ModuleName mod)
  440. {
  441. switch (mod)
  442. {
  443. case ModuleName.TM:
  444. if(!TMLidClosed)
  445. {
  446. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Lid not closed");
  447. return false;
  448. }
  449. break;
  450. case ModuleName.LLA:
  451. if(!LLALidClosed)
  452. {
  453. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Lid not closed");
  454. return false;
  455. }
  456. break;
  457. case ModuleName.LLB:
  458. if (!LLBLidClosed)
  459. {
  460. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Lid not closed");
  461. return false;
  462. }
  463. break;
  464. }
  465. return true;
  466. }
  467. public bool CheckVentValveClosed(ModuleName mod)
  468. {
  469. switch (mod)
  470. {
  471. case ModuleName.TM:
  472. if (IsTMVentValveOpen)
  473. {
  474. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Vent Valve not closed");
  475. return false;
  476. }
  477. break;
  478. case ModuleName.LLA:
  479. if (IsLLAVentValveOpen)
  480. {
  481. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Vent Valve not closed");
  482. return false;
  483. }
  484. break;
  485. case ModuleName.LLB:
  486. if (IsLLBVentValveOpen)
  487. {
  488. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Vent Valve not closed");
  489. return false;
  490. }
  491. break;
  492. }
  493. return true;
  494. }
  495. public bool CheckPurgeValveClosed(ModuleName mod)
  496. {
  497. switch (mod)
  498. {
  499. case ModuleName.TM:
  500. if (IsTMPurgeValveOpen)
  501. {
  502. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Purge Valve not closed");
  503. return false;
  504. }
  505. break;
  506. case ModuleName.LLA:
  507. if (IsLLAPurgeValveOpen)
  508. {
  509. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Purge Valve not closed");
  510. return false;
  511. }
  512. break;
  513. case ModuleName.LLB:
  514. if (IsLLBPurgeValveOpen)
  515. {
  516. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Purge Valve not closed");
  517. return false;
  518. }
  519. break;
  520. }
  521. return true;
  522. }
  523. public bool CheckPumpValveClosed(ModuleName mod)
  524. {
  525. switch (mod)
  526. {
  527. case ModuleName.TM:
  528. if (IsTMFastPumpOpen)
  529. {
  530. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Fast Pump Valve not closed");
  531. return false;
  532. }
  533. else if(IsTMSoftPumpOpen)
  534. {
  535. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Soft Pump Valve not closed");
  536. return false;
  537. }
  538. break;
  539. case ModuleName.LLA:
  540. if (IsLLAFastPumpOpen)
  541. {
  542. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Fast Pump Valve not closed");
  543. return false;
  544. }
  545. else if(IsLLASoftPumpOpen)
  546. {
  547. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Soft Pump Valve not closed");
  548. return false;
  549. }
  550. break;
  551. case ModuleName.LLB:
  552. if (IsLLBFastPumpOpen)
  553. {
  554. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Fast Pump Valve not closed");
  555. return false;
  556. }
  557. else if(IsLLBSoftPumpOpen)
  558. {
  559. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Soft Pump Valve not closed");
  560. return false;
  561. }
  562. break;
  563. }
  564. return true;
  565. }
  566. private bool CheckRobotNotExtendSensor(ModuleName ll, bool open, bool bTMDoor, out string reason)
  567. {
  568. string action = open ? "Open" : "Close";
  569. string doorName = bTMDoor ? "TM" : "EFEM";
  570. if (ll == ModuleName.LLA)
  571. {
  572. if (!_TMRobotNotExtendLLA.Value)
  573. {
  574. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  575. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  576. return false;
  577. }
  578. if (!_EfemRobotNotExtendLLA.Value)
  579. {
  580. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  581. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  582. return false;
  583. }
  584. }
  585. else
  586. {
  587. if (!_TMRobotNotExtendLLB.Value)
  588. {
  589. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  590. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  591. return false;
  592. }
  593. if (!_EfemRobotNotExtendLLB.Value)
  594. {
  595. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  596. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  597. return false;
  598. }
  599. }
  600. reason = "";
  601. return true;
  602. }
  603. public bool TurnMFSlitDoor(ModuleName loadlock, bool open, out string reason)
  604. {
  605. if (!CheckRobotNotExtendSensor(loadlock, open, true, out reason))
  606. return false;
  607. if (open)
  608. {
  609. if (_isATMMode)
  610. {
  611. if (!IsTMATM)
  612. {
  613. reason = $"TM is not ATM, can not open slit door";
  614. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  615. return false;
  616. }
  617. if (!IsModuleATM(loadlock))
  618. {
  619. reason = $"{loadlock} is not ATM, can not open slit door";
  620. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  621. return false;
  622. }
  623. }
  624. else
  625. {
  626. if(!IsModuleVaccum(loadlock))
  627. {
  628. reason = $"{loadlock} is notVacuum, can not open slit door";
  629. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  630. return false;
  631. }
  632. double maxPressureDifference = SC.GetValue<double>("System.TMLLMaxPressureDifference");
  633. if (Math.Abs(GetModulePressure(loadlock) - GetModulePressure(ModuleName.TM)) > maxPressureDifference)
  634. {
  635. reason = $"{loadlock} and TM pressure difference exceeds the max limit {maxPressureDifference}";
  636. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  637. return false;
  638. }
  639. }
  640. }
  641. switch(loadlock)
  642. {
  643. case ModuleName.LLA:
  644. return _LLATSlitDoor.SetCylinder(open, out reason);
  645. case ModuleName.LLB:
  646. return _LLBTSlitDoor.SetCylinder(open, out reason);
  647. }
  648. reason = $"Invalid module {loadlock}";
  649. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  650. return false;
  651. }
  652. public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason)
  653. {
  654. if (!CheckRobotNotExtendSensor(loadlock, open, false, out reason))
  655. return false;
  656. if (open && !IsModuleATM(loadlock))
  657. {
  658. reason = $"{loadlock} is not ATM, can not open EFEM side slit door";
  659. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  660. return false;
  661. }
  662. switch (loadlock)
  663. {
  664. case ModuleName.LLA:
  665. return _LLAESlitDoor.SetCylinder(open, out reason);
  666. case ModuleName.LLB:
  667. return _LLBESlitDoor.SetCylinder(open, out reason);
  668. }
  669. reason = $"Invalid module {loadlock}";
  670. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  671. return false;
  672. }
  673. //public bool ControlTMPump(bool ison)
  674. //{
  675. // _TMPump.SetPumpOnOff(ison);
  676. // return true;
  677. //}
  678. public void SwitchTMPressureMode(bool isPressureMode)
  679. {
  680. if (isPressureMode==true)
  681. {
  682. _PressureMode_Switch.TurnOn();
  683. }
  684. else
  685. {
  686. _PressureMode_Switch.TurnOff();
  687. }
  688. }
  689. public void SetTMPressure(int pressureValue)
  690. {
  691. _presureCtrl.SetTMPressure(pressureValue);
  692. }
  693. public void SetTMFlow(int flowValue)
  694. {
  695. _TMMfc.SetPoint = (flowValue);
  696. }
  697. public bool CloseAllSlitDoor()
  698. {
  699. _LLATSlitDoor.SetCylinder(false, out _);
  700. _LLBTSlitDoor.SetCylinder(false, out _);
  701. if (_allInstalledModules.Contains("PMA"))
  702. {
  703. OP.DoOperation("PMA.SetSlitDoor", false);
  704. }
  705. if (_allInstalledModules.Contains("PMB"))
  706. {
  707. OP.DoOperation("PMB.SetSlitDoor", false);
  708. }
  709. if (_allInstalledModules.Contains("PMC"))
  710. {
  711. OP.DoOperation("PMC.SetSlitDoor", false);
  712. }
  713. if (_allInstalledModules.Contains("PMD"))
  714. {
  715. OP.DoOperation("PMD.SetSlitDoor", false);
  716. }
  717. return true;
  718. }
  719. public bool TurnTMPump(bool ison)
  720. {
  721. _TMPump.SetPumpOnOff(ison);
  722. return true;
  723. }
  724. }
  725. }