JetTM.cs 36 KB

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