JetTM.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  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. enum LLPumpState
  140. {
  141. Idle,
  142. LLAUsing,
  143. LLBUsing,
  144. }
  145. LLPumpState _llPumpingState = LLPumpState.Idle;
  146. private string _allInstalledModules { get { return SC.GetStringValue("System.InstalledModules").ToString(); } }
  147. public bool PMASlitDoorClosed
  148. {
  149. get
  150. {
  151. if (_allInstalledModules.Contains("PMA"))
  152. {
  153. return DATA.Poll<bool>("PMA", "IsSlitDoorClosed");
  154. }
  155. else
  156. {
  157. return true;
  158. }
  159. }
  160. }
  161. public bool PMBSlitDoorClosed
  162. {
  163. get
  164. {
  165. if (_allInstalledModules.Contains("PMB"))
  166. {
  167. return DATA.Poll<bool>("PMB", "IsSlitDoorClosed");
  168. }
  169. else
  170. {
  171. return true;
  172. }
  173. }
  174. }
  175. public bool PMCSlitDoorClosed
  176. {
  177. get
  178. {
  179. if (_allInstalledModules.Contains("PMC"))
  180. {
  181. return DATA.Poll<bool>("PMC", "IsSlitDoorClosed");
  182. }
  183. else
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. public bool PMDSlitDoorClosed
  190. {
  191. get
  192. {
  193. if (_allInstalledModules.Contains("PMD"))
  194. {
  195. return DATA.Poll<bool>("PMD", "IsSlitDoorClosed");
  196. }
  197. else
  198. {
  199. return true;
  200. }
  201. }
  202. }
  203. public bool AllPMSlitDoorClosed
  204. {
  205. get
  206. {
  207. if (PMASlitDoorClosed == true && PMBSlitDoorClosed == true && PMCSlitDoorClosed == true && PMDSlitDoorClosed == true)
  208. {
  209. return true;
  210. }
  211. else
  212. {
  213. return false;
  214. }
  215. }
  216. }
  217. public JetTM() : base("TM")
  218. {
  219. _TMLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.TMLid}");
  220. _LLALid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLALid}");
  221. _LLBLid = DEVICE.GetDevice<IoLid>($"TM.{VenusDevice.LLBLid}");
  222. _LLATSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLATSlitDoor}");
  223. _LLBTSlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBTSlitDoor}");
  224. _LLAESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLAESlitDoor}");
  225. _LLBESlitDoor = DEVICE.GetDevice<IoCylinder>($"TM.{VenusDevice.LLBESlitDoor}");
  226. _TMN2Valve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMValveN2}");
  227. _TMSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftPumpValve}");
  228. _TMFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastPumpValve}");
  229. _TMPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMPurgeValve}");
  230. _TMVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMVentValve}");
  231. //_TMSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMSoftVentValve}");
  232. //_TMFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMFastVentValve}");
  233. _LLASoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLASoftPumpValve}");
  234. _LLAFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAFastPumpValve}");
  235. _LLAPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAPurgeValve}");
  236. _LLAVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAVentValve}");
  237. _LLASoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLASoftVentValve}");
  238. _LLAFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLAFastVentValve}");
  239. _LLBSoftVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBSoftVentValve}");
  240. _LLBFastVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBFastVentValve}");
  241. _TMVacAtmMode = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.TMVacAtmMode}");
  242. _LLBSoftPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBSoftPumpValve}");
  243. _LLBFastPumpValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBFastPumpValve}");
  244. _LLBPurgeValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBPurgeValve}");
  245. _LLBVentValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.LLBVentValve}");
  246. _WaferRelayValve = DEVICE.GetDevice<IoValve>($"TM.{VenusDevice.ValveWaterRelay}");
  247. _TMPowerOn = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPowerOn}");
  248. _TMInSafty = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMInSafty}");
  249. _WaferLeakSensor = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.WaferLeakSensor}");
  250. _EFEMSideDoorClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EFEMSideDoorClosed}");
  251. _TMPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMPCWFlowSwitch}");
  252. _LLAPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAPCWFlowSwitch}");
  253. _LLBPCWFlowSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBPCWFlowSwitch}");
  254. _TMLidClosed = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMLidClosed}");
  255. _CDAPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.CDAPressureSwitch}");
  256. _VaccumPressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.VaccumPressureSwitch}");
  257. _N2PressureSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.N2PressureSwitch}");
  258. _TMRobotNotExtendPMA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMA}");
  259. _TMRobotNotExtendPMB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMB}");
  260. _TMRobotNotExtendPMC = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMC}");
  261. _TMRobotNotExtendPMD = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendPMD}");
  262. _TMRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLA}");
  263. _TMRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMRobotNotExtendLLB}");
  264. _EfemRobotNotExtendLLA = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLA}");
  265. _EfemRobotNotExtendLLB = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.EfemRobotNotExtendLLB}");
  266. _TMVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMVacSwitch}");
  267. _LLAVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAVacSwitch}");
  268. _LLBVacSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBVacSwitch}");
  269. _TMATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.TMATMSwitch}");
  270. _LLAATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLAATMSwitch}");
  271. _LLBATMSwitch = DEVICE.GetDevice<IoSensor>($"TM.{VenusDevice.LLBATMSwitch}");
  272. _LLAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLAWaferSizeCheckSwitch}");
  273. _LLBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.LLBWaferSizeCheckSwitch}");
  274. _PMAWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMAWaferSizeCheckSwitch}");
  275. _PMBWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMBWaferSizeCheckSwitch}");
  276. _PMCWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMCWaferSizeCheckSwitch}");
  277. _PMDWaferSizeCheck = DEVICE.GetDevice<IoSwitch>($"TM.{VenusDevice.PMDWaferSizeCheckSwitch}");
  278. _PressureMode_Switch = DEVICE.GetDevice<IoSwitch>("TM.PressureModeSwitch");
  279. _TMMfc = DEVICE.GetDevice<IoMfc>($"{Module}.TM_MFC1");
  280. _presureCtrl = DEVICE.GetDevice<IoTMPressureCtrl>($"TM.{VenusDevice.TMPressureCtrl}");
  281. if (SC.GetValue<int>($"TM.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  282. {
  283. if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.SKY)
  284. {
  285. _TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  286. }
  287. else if (SC.GetValue<int>($"TM.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  288. {
  289. _TMPump = DEVICE.GetDevice<EdwardsPump>($"TM.{VenusDevice.MainPump}");
  290. }
  291. }
  292. if (SC.GetValue<int>($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  293. {
  294. if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY)
  295. {
  296. _LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  297. }
  298. else if (SC.GetValue<int>($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  299. {
  300. _LLPump = DEVICE.GetDevice<EdwardsPump>($"LLA.{VenusDevice.MainPump}");
  301. }
  302. }
  303. //_LLPump = DEVICE.GetDevice<SkyPump>($"LLA.{VenusDevice.MainPump}");
  304. //_TMPump = DEVICE.GetDevice<SkyPump>($"TM.{VenusDevice.MainPump}");
  305. DATA.Subscribe("TM.PumpIsRunning", () => TMPumpIsRunning);
  306. OP.Subscribe("TM.ControlPump", (cmd, args) =>
  307. {
  308. _TMPump.SetPumpOnOff((bool)args[0]);
  309. return true;
  310. });
  311. DATA.Subscribe("LL.PumpIsRunning", () => LLPumpIsRunning);
  312. OP.Subscribe("LL.ControlPump", (cmd, args) =>
  313. {
  314. _LLPump.SetPumpOnOff((bool)args[0]);
  315. return true;
  316. });
  317. OP.Subscribe("TM.SetChamberPressure", (cmd, args) =>
  318. {
  319. _presureCtrl.SetTMPressure((int)(args[0]));
  320. return true;
  321. });
  322. OP.Subscribe("TM.SetChamberFlow", (cmd, args) =>
  323. {
  324. _TMMfc.SetPoint = (int)(args[0]);
  325. return true;
  326. });
  327. OP.Subscribe($"TM.SetMFSlitDoor", (cmd, args) =>
  328. {
  329. var module = (ModuleName)Enum.Parse(typeof(ModuleName), args[0].ToString());
  330. TurnMFSlitDoor(module, (bool)args[1], out _);
  331. return true;
  332. });
  333. _isATMMode = SC.GetValue<bool>("System.IsATMMode");
  334. _TMVacAtmMode.TurnValve(_isATMMode, out string _);
  335. }
  336. public override void Monitor()
  337. {
  338. _WaferRelayValve.TurnValve(_WaferLeakSensor.Value, out string _);
  339. }
  340. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  341. {
  342. switch(mod)
  343. {
  344. case ModuleName.TM:
  345. _TMSoftPumpValve.TurnValve(bOn, out string _);
  346. break;
  347. case ModuleName.LLA:
  348. _LLASoftPumpValve.TurnValve(bOn, out string _);
  349. break;
  350. case ModuleName.LLB:
  351. _LLBSoftPumpValve.TurnValve(bOn, out string _);
  352. break;
  353. }
  354. }
  355. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  356. {
  357. switch(mod)
  358. {
  359. case ModuleName.TM:
  360. _TMFastPumpValve.TurnValve(bOn, out string _);
  361. break;
  362. case ModuleName.LLA:
  363. _LLAFastPumpValve.TurnValve(bOn, out string _);
  364. break;
  365. case ModuleName.LLB:
  366. _LLBFastPumpValve.TurnValve(bOn, out string _);
  367. break;
  368. }
  369. }
  370. public void TurnVentValve(ModuleName mod, bool bOn)
  371. {
  372. switch (mod)
  373. {
  374. case ModuleName.TM:
  375. _TMVentValve.TurnValve(bOn, out string _);
  376. break;
  377. case ModuleName.LLA:
  378. _LLAVentValve.TurnValve(bOn, out string _);
  379. break;
  380. case ModuleName.LLB:
  381. _LLBVentValve.TurnValve(bOn, out string _);
  382. break;
  383. }
  384. }
  385. public void TurnPurgeValve(ModuleName mod, bool bOn)
  386. {
  387. switch(mod)
  388. {
  389. case ModuleName.TM:
  390. _TMPurgeValve.TurnValve(bOn, out string _);
  391. break;
  392. case ModuleName.LLA:
  393. _LLAPurgeValve.TurnValve(bOn, out string _);
  394. break;
  395. case ModuleName.LLB:
  396. _LLBPurgeValve.TurnValve(bOn, out string _);
  397. break;
  398. }
  399. }
  400. public void TurnN2Valve(bool bOn)
  401. {
  402. _TMN2Valve.TurnValve(bOn, out string _);
  403. }
  404. public void CloseModuleAllValves(ModuleName mod)
  405. {
  406. TurnFastPumpValve(mod, false);
  407. TurnSoftPumpValve(mod, false);
  408. TurnVentValve(mod, false);
  409. TurnPurgeValve(mod, false);
  410. if (mod == ModuleName.TM)
  411. TurnN2Valve(false);
  412. }
  413. public double GetModulePressure(ModuleName mod)
  414. {
  415. switch (mod)
  416. {
  417. case ModuleName.TM:
  418. return TMPressure;
  419. case ModuleName.LLA:
  420. return LLAPressure;
  421. case ModuleName.LLB:
  422. return LLBPressure;
  423. }
  424. return 0;
  425. }
  426. public bool IsModuleATM(ModuleName mod)
  427. {
  428. switch (mod)
  429. {
  430. case ModuleName.TM:
  431. return IsTMATM;
  432. case ModuleName.LLA:
  433. return IsLLAATM;
  434. case ModuleName.LLB:
  435. return IsLLBATM;
  436. }
  437. return false;
  438. }
  439. public bool IsModuleVaccum(ModuleName mod)
  440. {
  441. switch (mod)
  442. {
  443. case ModuleName.TM:
  444. return IsTMVac;
  445. case ModuleName.LLA:
  446. return IsLLAVac;
  447. case ModuleName.LLB:
  448. return IsLLBVac;
  449. }
  450. return false;
  451. }
  452. public bool CheckLidClosed(ModuleName mod)
  453. {
  454. switch (mod)
  455. {
  456. case ModuleName.TM:
  457. if(!TMLidClosed)
  458. {
  459. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Lid not closed");
  460. return false;
  461. }
  462. break;
  463. case ModuleName.LLA:
  464. if(!LLALidClosed)
  465. {
  466. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Lid not closed");
  467. return false;
  468. }
  469. break;
  470. case ModuleName.LLB:
  471. if (!LLBLidClosed)
  472. {
  473. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Lid not closed");
  474. return false;
  475. }
  476. break;
  477. }
  478. return true;
  479. }
  480. public bool CheckVentValveClosed(ModuleName mod)
  481. {
  482. switch (mod)
  483. {
  484. case ModuleName.TM:
  485. if (IsTMVentValveOpen)
  486. {
  487. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Vent Valve not closed");
  488. return false;
  489. }
  490. break;
  491. case ModuleName.LLA:
  492. if (IsLLAVentValveOpen)
  493. {
  494. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Vent Valve not closed");
  495. return false;
  496. }
  497. break;
  498. case ModuleName.LLB:
  499. if (IsLLBVentValveOpen)
  500. {
  501. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Vent Valve not closed");
  502. return false;
  503. }
  504. break;
  505. }
  506. return true;
  507. }
  508. public bool CheckPurgeValveClosed(ModuleName mod)
  509. {
  510. switch (mod)
  511. {
  512. case ModuleName.TM:
  513. if (IsTMPurgeValveOpen)
  514. {
  515. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Purge Valve not closed");
  516. return false;
  517. }
  518. break;
  519. case ModuleName.LLA:
  520. if (IsLLAPurgeValveOpen)
  521. {
  522. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Purge Valve not closed");
  523. return false;
  524. }
  525. break;
  526. case ModuleName.LLB:
  527. if (IsLLBPurgeValveOpen)
  528. {
  529. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Purge Valve not closed");
  530. return false;
  531. }
  532. break;
  533. }
  534. return true;
  535. }
  536. public bool CheckPumpValveClosed(ModuleName mod)
  537. {
  538. switch (mod)
  539. {
  540. case ModuleName.TM:
  541. if (IsTMFastPumpOpen)
  542. {
  543. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Fast Pump Valve not closed");
  544. return false;
  545. }
  546. else if(IsTMSoftPumpOpen)
  547. {
  548. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Soft Pump Valve not closed");
  549. return false;
  550. }
  551. break;
  552. case ModuleName.LLA:
  553. if (IsLLAFastPumpOpen)
  554. {
  555. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Fast Pump Valve not closed");
  556. return false;
  557. }
  558. else if(IsLLASoftPumpOpen)
  559. {
  560. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Soft Pump Valve not closed");
  561. return false;
  562. }
  563. break;
  564. case ModuleName.LLB:
  565. if (IsLLBFastPumpOpen)
  566. {
  567. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Fast Pump Valve not closed");
  568. return false;
  569. }
  570. else if(IsLLBSoftPumpOpen)
  571. {
  572. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Soft Pump Valve not closed");
  573. return false;
  574. }
  575. break;
  576. }
  577. return true;
  578. }
  579. private bool CheckRobotNotExtendSensor(ModuleName ll, bool open, bool bTMDoor, out string reason)
  580. {
  581. string action = open ? "Open" : "Close";
  582. string doorName = bTMDoor ? "TM" : "EFEM";
  583. if (ll == ModuleName.LLA)
  584. {
  585. if (!_TMRobotNotExtendLLA.Value)
  586. {
  587. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  588. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  589. return false;
  590. }
  591. if (!_EfemRobotNotExtendLLA.Value)
  592. {
  593. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  594. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  595. return false;
  596. }
  597. }
  598. else
  599. {
  600. if (!_TMRobotNotExtendLLB.Value)
  601. {
  602. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  603. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  604. return false;
  605. }
  606. if (!_EfemRobotNotExtendLLB.Value)
  607. {
  608. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  609. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  610. return false;
  611. }
  612. }
  613. reason = "";
  614. return true;
  615. }
  616. public bool TurnMFSlitDoor(ModuleName loadlock, bool open, out string reason)
  617. {
  618. if (!CheckRobotNotExtendSensor(loadlock, open, true, out reason))
  619. return false;
  620. if (open)
  621. {
  622. if (_isATMMode)
  623. {
  624. if (!IsTMATM)
  625. {
  626. reason = $"TM is not ATM, can not open slit door";
  627. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  628. return false;
  629. }
  630. if (!IsModuleATM(loadlock))
  631. {
  632. reason = $"{loadlock} is not ATM, can not open slit door";
  633. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  634. return false;
  635. }
  636. }
  637. else
  638. {
  639. if(!IsModuleVaccum(loadlock))
  640. {
  641. reason = $"{loadlock} is notVacuum, can not open slit door";
  642. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  643. return false;
  644. }
  645. double maxPressureDifference = SC.GetValue<double>("System.TMLLMaxPressureDifference");
  646. if (Math.Abs(GetModulePressure(loadlock) - GetModulePressure(ModuleName.TM)) > maxPressureDifference)
  647. {
  648. reason = $"{loadlock} and TM pressure difference exceeds the max limit {maxPressureDifference}";
  649. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  650. return false;
  651. }
  652. }
  653. }
  654. switch(loadlock)
  655. {
  656. case ModuleName.LLA:
  657. return _LLATSlitDoor.SetCylinder(open, out reason);
  658. case ModuleName.LLB:
  659. return _LLBTSlitDoor.SetCylinder(open, out reason);
  660. }
  661. reason = $"Invalid module {loadlock}";
  662. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  663. return false;
  664. }
  665. public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason)
  666. {
  667. if (!CheckRobotNotExtendSensor(loadlock, open, false, out reason))
  668. return false;
  669. if (open && !IsModuleATM(loadlock))
  670. {
  671. reason = $"{loadlock} is not ATM, can not open EFEM side slit door";
  672. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  673. return false;
  674. }
  675. switch (loadlock)
  676. {
  677. case ModuleName.LLA:
  678. return _LLAESlitDoor.SetCylinder(open, out reason);
  679. case ModuleName.LLB:
  680. return _LLBESlitDoor.SetCylinder(open, out reason);
  681. }
  682. reason = $"Invalid module {loadlock}";
  683. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  684. return false;
  685. }
  686. //public bool ControlTMPump(bool ison)
  687. //{
  688. // _TMPump.SetPumpOnOff(ison);
  689. // return true;
  690. //}
  691. public void SwitchTMPressureMode(bool isPressureMode)
  692. {
  693. if (isPressureMode==true)
  694. {
  695. _PressureMode_Switch.TurnOn();
  696. }
  697. else
  698. {
  699. _PressureMode_Switch.TurnOff();
  700. }
  701. }
  702. public void SetTMPressure(int pressureValue)
  703. {
  704. _presureCtrl.SetTMPressure(pressureValue);
  705. }
  706. public void SetTMFlow(int flowValue)
  707. {
  708. _TMMfc.SetPoint = (flowValue);
  709. }
  710. public bool CloseAllSlitDoor()
  711. {
  712. _LLATSlitDoor.SetCylinder(false, out _);
  713. _LLBTSlitDoor.SetCylinder(false, out _);
  714. if (_allInstalledModules.Contains("PMA"))
  715. {
  716. OP.DoOperation("PMA.SetSlitDoor", false);
  717. }
  718. if (_allInstalledModules.Contains("PMB"))
  719. {
  720. OP.DoOperation("PMB.SetSlitDoor", false);
  721. }
  722. if (_allInstalledModules.Contains("PMC"))
  723. {
  724. OP.DoOperation("PMC.SetSlitDoor", false);
  725. }
  726. if (_allInstalledModules.Contains("PMD"))
  727. {
  728. OP.DoOperation("PMD.SetSlitDoor", false);
  729. }
  730. return true;
  731. }
  732. public bool TurnTMPump(bool ison)
  733. {
  734. _TMPump.SetPumpOnOff(ison);
  735. return true;
  736. }
  737. public bool TryGetLLPump(ModuleName LLname)
  738. {
  739. //Self
  740. if ((LLname == ModuleName.LLA && _llPumpingState == LLPumpState.LLAUsing) || (LLname == ModuleName.LLB && _llPumpingState == LLPumpState.LLBUsing))
  741. return true;
  742. //Idle
  743. if (LLname == ModuleName.LLA && !IsLLBFastPumpOpen && !IsLLBSoftPumpOpen && _llPumpingState == LLPumpState.Idle)
  744. {
  745. _llPumpingState = LLPumpState.LLAUsing;
  746. return true;
  747. }
  748. if (LLname == ModuleName.LLB && !IsLLAFastPumpOpen && !IsLLASoftPumpOpen && _llPumpingState == LLPumpState.Idle)
  749. {
  750. _llPumpingState = LLPumpState.LLBUsing;
  751. return true;
  752. }
  753. LOG.Write(eEvent.WARN_DEFAULT_WARN, LLname, "无法打开,另一个泵正在用!");
  754. //locked
  755. return false;
  756. }
  757. public void ReleasePump(ModuleName Module)
  758. {
  759. //release pump (must do it by user)
  760. if ((Module == ModuleName.LLA && _llPumpingState == LLPumpState.LLAUsing) || (Module == ModuleName.LLB && _llPumpingState == LLPumpState.LLBUsing))
  761. _llPumpingState = LLPumpState.Idle;
  762. }
  763. }
  764. }