JetTM.cs 36 KB

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