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 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. OP.Subscribe("TM.ControlPump", (cmd, args) =>
  317. {
  318. _TMPump.SetPumpOnOff((bool)args[0]);
  319. return true;
  320. });
  321. DATA.Subscribe("LL.PumpIsRunning", () => LLPumpIsRunning, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  322. OP.Subscribe("LL.ControlPump", (cmd, args) =>
  323. {
  324. _LLPump.SetPumpOnOff((bool)args[0]);
  325. return true;
  326. });
  327. OP.Subscribe("TM.SetChamberPressure", (cmd, args) =>
  328. {
  329. _presureCtrl.SetTMPressure((int)(args[0]));
  330. return true;
  331. });
  332. OP.Subscribe("TM.SetChamberFlow", (cmd, args) =>
  333. {
  334. _TMMfc.SetPoint = (int)(args[0]);
  335. return true;
  336. });
  337. OP.Subscribe($"TM.SetMFSlitDoor", (cmd, args) =>
  338. {
  339. var module = (ModuleName)Enum.Parse(typeof(ModuleName), args[0].ToString());
  340. TurnMFSlitDoor(module, (bool)args[1], out _);
  341. return true;
  342. });
  343. OP.Subscribe($"TM.SetEFEMSlitDoor", (cmd, args) =>
  344. {
  345. var module = (ModuleName)Enum.Parse(typeof(ModuleName), args[0].ToString());
  346. TurnEFEMSlitDoor(module, (bool)args[1], out _);
  347. return true;
  348. });
  349. _TMVacAtmMode.TurnValve(RouteManager.IsATMMode, out string _);
  350. }
  351. public override void Monitor()
  352. {
  353. if (_WaferLeakSensor.Value && _WaferRelayValve.Status == false)
  354. {
  355. _WaferRelayValve.TurnValve(true, out string _);
  356. }
  357. else if (_WaferLeakSensor.Value == false && _WaferRelayValve.Status == true)
  358. {
  359. _WaferRelayValve.TurnValve(false, out string _);
  360. }
  361. }
  362. public void TurnSoftPumpValve(ModuleName mod, bool bOn)
  363. {
  364. switch(mod)
  365. {
  366. case ModuleName.TM:
  367. _TMSoftPumpValve.TurnValve(bOn, out string _);
  368. break;
  369. case ModuleName.LLA:
  370. _LLASoftPumpValve.TurnValve(bOn, out string _);
  371. break;
  372. case ModuleName.LLB:
  373. _LLBSoftPumpValve.TurnValve(bOn, out string _);
  374. break;
  375. }
  376. }
  377. public void TurnFastPumpValve(ModuleName mod, bool bOn)
  378. {
  379. switch(mod)
  380. {
  381. case ModuleName.TM:
  382. _TMFastPumpValve.TurnValve(bOn, out string _);
  383. break;
  384. case ModuleName.LLA:
  385. _LLAFastPumpValve.TurnValve(bOn, out string _);
  386. break;
  387. case ModuleName.LLB:
  388. _LLBFastPumpValve.TurnValve(bOn, out string _);
  389. break;
  390. }
  391. }
  392. public void TurnVentValve(ModuleName mod, bool bOn)
  393. {
  394. switch (mod)
  395. {
  396. case ModuleName.TM:
  397. _TMVentValve.TurnValve(bOn, out string _);
  398. break;
  399. case ModuleName.LLA:
  400. _LLAVentValve.TurnValve(bOn, out string _);
  401. break;
  402. case ModuleName.LLB:
  403. _LLBVentValve.TurnValve(bOn, out string _);
  404. break;
  405. }
  406. }
  407. public void TurnPurgeValve(ModuleName mod, bool bOn)
  408. {
  409. switch(mod)
  410. {
  411. case ModuleName.TM:
  412. _TMPurgeValve.TurnValve(bOn, out string _);
  413. break;
  414. case ModuleName.LLA:
  415. _LLAPurgeValve.TurnValve(bOn, out string _);
  416. break;
  417. case ModuleName.LLB:
  418. _LLBPurgeValve.TurnValve(bOn, out string _);
  419. break;
  420. }
  421. }
  422. public void TurnN2Valve(bool bOn)
  423. {
  424. _TMN2Valve.TurnValve(bOn, out string _);
  425. }
  426. public void CloseModuleAllValves(ModuleName mod)
  427. {
  428. TurnFastPumpValve(mod, false);
  429. TurnSoftPumpValve(mod, false);
  430. TurnVentValve(mod, false);
  431. TurnPurgeValve(mod, false);
  432. if (mod == ModuleName.TM)
  433. TurnN2Valve(false);
  434. }
  435. public double GetModulePressure(ModuleName mod)
  436. {
  437. switch (mod)
  438. {
  439. case ModuleName.TM:
  440. return ChamberPressure;
  441. case ModuleName.LLA:
  442. return LLAPressure;
  443. case ModuleName.LLB:
  444. return LLBPressure;
  445. }
  446. return 0;
  447. }
  448. public bool IsModuleATM(ModuleName mod)
  449. {
  450. switch (mod)
  451. {
  452. case ModuleName.TM:
  453. return IsTMATM;
  454. case ModuleName.LLA:
  455. return IsLLAATM;
  456. case ModuleName.LLB:
  457. return IsLLBATM;
  458. }
  459. return false;
  460. }
  461. public bool IsModuleVaccum(ModuleName mod)
  462. {
  463. switch (mod)
  464. {
  465. case ModuleName.TM:
  466. return IsTMVac;
  467. case ModuleName.LLA:
  468. return IsLLAVac;
  469. case ModuleName.LLB:
  470. return IsLLBVac;
  471. }
  472. return false;
  473. }
  474. public bool CheckLidClosed(ModuleName mod)
  475. {
  476. switch (mod)
  477. {
  478. case ModuleName.TM:
  479. if(!TMLidClosed)
  480. {
  481. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Lid not closed");
  482. return false;
  483. }
  484. break;
  485. case ModuleName.LLA:
  486. if(!LLALidClosed)
  487. {
  488. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Lid not closed");
  489. return false;
  490. }
  491. break;
  492. case ModuleName.LLB:
  493. if (!LLBLidClosed)
  494. {
  495. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Lid not closed");
  496. return false;
  497. }
  498. break;
  499. }
  500. return true;
  501. }
  502. public bool CheckVentValveClosed(ModuleName mod)
  503. {
  504. switch (mod)
  505. {
  506. case ModuleName.TM:
  507. if (IsTMVentValveOpen)
  508. {
  509. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Vent Valve not closed");
  510. return false;
  511. }
  512. break;
  513. case ModuleName.LLA:
  514. if (IsLLAVentValveOpen)
  515. {
  516. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Vent Valve not closed");
  517. return false;
  518. }
  519. break;
  520. case ModuleName.LLB:
  521. if (IsLLBVentValveOpen)
  522. {
  523. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Vent Valve not closed");
  524. return false;
  525. }
  526. break;
  527. }
  528. return true;
  529. }
  530. public bool CheckPurgeValveClosed(ModuleName mod)
  531. {
  532. switch (mod)
  533. {
  534. case ModuleName.TM:
  535. if (IsTMPurgeValveOpen)
  536. {
  537. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Purge Valve not closed");
  538. return false;
  539. }
  540. break;
  541. case ModuleName.LLA:
  542. if (IsLLAPurgeValveOpen)
  543. {
  544. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Purge Valve not closed");
  545. return false;
  546. }
  547. break;
  548. case ModuleName.LLB:
  549. if (IsLLBPurgeValveOpen)
  550. {
  551. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Purge Valve not closed");
  552. return false;
  553. }
  554. break;
  555. }
  556. return true;
  557. }
  558. public bool CheckPumpValveClosed(ModuleName mod)
  559. {
  560. switch (mod)
  561. {
  562. case ModuleName.TM:
  563. if (IsTMFastPumpOpen)
  564. {
  565. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Fast Pump Valve not closed");
  566. return false;
  567. }
  568. else if(IsTMSoftPumpOpen)
  569. {
  570. LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Soft Pump Valve not closed");
  571. return false;
  572. }
  573. break;
  574. case ModuleName.LLA:
  575. if (IsLLAFastPumpOpen)
  576. {
  577. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Fast Pump Valve not closed");
  578. return false;
  579. }
  580. else if(IsLLASoftPumpOpen)
  581. {
  582. LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Soft Pump Valve not closed");
  583. return false;
  584. }
  585. break;
  586. case ModuleName.LLB:
  587. if (IsLLBFastPumpOpen)
  588. {
  589. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Fast Pump Valve not closed");
  590. return false;
  591. }
  592. else if(IsLLBSoftPumpOpen)
  593. {
  594. LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Soft Pump Valve not closed");
  595. return false;
  596. }
  597. break;
  598. }
  599. return true;
  600. }
  601. private bool CheckRobotNotExtendSensor(ModuleName ll, bool open, bool bTMDoor, out string reason)
  602. {
  603. string action = open ? "Open" : "Close";
  604. string doorName = bTMDoor ? "TM" : "EFEM";
  605. if (ll == ModuleName.LLA)
  606. {
  607. if (!_TMRobotNotExtendLLA.Value)
  608. {
  609. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  610. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  611. return false;
  612. }
  613. if (!_EfemRobotNotExtendLLA.Value)
  614. {
  615. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  616. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  617. return false;
  618. }
  619. }
  620. else
  621. {
  622. if (!_TMRobotNotExtendLLB.Value)
  623. {
  624. reason = $"TM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  625. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  626. return false;
  627. }
  628. if (!_EfemRobotNotExtendLLB.Value)
  629. {
  630. reason = $"EFEM Robot Not Extend to {ll} is false, can not {action} {doorName} slit door";
  631. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  632. return false;
  633. }
  634. }
  635. reason = "";
  636. return true;
  637. }
  638. public bool TurnMFSlitDoor(ModuleName loadlock, bool open, out string reason)
  639. {
  640. if (!CheckRobotNotExtendSensor(loadlock, open, true, out reason))
  641. return false;
  642. if (open)
  643. {
  644. if (RouteManager.IsATMMode)
  645. {
  646. if (!IsTMATM)
  647. {
  648. reason = $"TM is not ATM, can not open slit door";
  649. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  650. return false;
  651. }
  652. if (!IsModuleATM(loadlock))
  653. {
  654. reason = $"{loadlock} is not ATM, can not open slit door";
  655. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  656. return false;
  657. }
  658. }
  659. else
  660. {
  661. if(!IsModuleVaccum(loadlock))
  662. {
  663. reason = $"{loadlock} is notVacuum, can not open slit door";
  664. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  665. return false;
  666. }
  667. double maxPressureDifference = SC.GetValue<double>("System.TMLLMaxPressureDifference");
  668. if (Math.Abs(GetModulePressure(loadlock) - GetModulePressure(ModuleName.TM)) > maxPressureDifference)
  669. {
  670. reason = $"{loadlock}:{GetModulePressure(loadlock)} and TM : {GetModulePressure(ModuleName.TM)} pressure difference exceeds the max limit {maxPressureDifference}";
  671. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  672. return false;
  673. }
  674. }
  675. }
  676. switch(loadlock)
  677. {
  678. case ModuleName.LLA:
  679. return _LLATSlitDoor.SetCylinder(open, out reason);
  680. case ModuleName.LLB:
  681. return _LLBTSlitDoor.SetCylinder(open, out reason);
  682. }
  683. reason = $"Invalid module {loadlock}";
  684. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  685. return false;
  686. }
  687. public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason)
  688. {
  689. if (!CheckRobotNotExtendSensor(loadlock, open, false, out reason))
  690. return false;
  691. if (open && !IsModuleATM(loadlock))
  692. {
  693. reason = $"{loadlock} is not ATM, can not open EFEM side slit door";
  694. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  695. return false;
  696. }
  697. switch (loadlock)
  698. {
  699. case ModuleName.LLA:
  700. return _LLAESlitDoor.SetCylinder(open, out reason);
  701. case ModuleName.LLB:
  702. return _LLBESlitDoor.SetCylinder(open, out reason);
  703. }
  704. reason = $"Invalid module {loadlock}";
  705. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  706. return false;
  707. }
  708. //public bool ControlTMPump(bool ison)
  709. //{
  710. // _TMPump.SetPumpOnOff(ison);
  711. // return true;
  712. //}
  713. public void SwitchTMPressureMode(bool isPressureMode)
  714. {
  715. if (isPressureMode==true)
  716. {
  717. _PressureMode_Switch.TurnOn();
  718. }
  719. else
  720. {
  721. _PressureMode_Switch.TurnOff();
  722. }
  723. }
  724. public void SetTMPressure(int pressureValue)
  725. {
  726. _presureCtrl.SetTMPressure(pressureValue);
  727. }
  728. public void SetTMFlow(int flowValue)
  729. {
  730. _TMMfc.SetPoint = (flowValue);
  731. }
  732. public bool CloseAllSlitDoor()
  733. {
  734. _LLATSlitDoor.SetCylinder(false, out _);
  735. _LLBTSlitDoor.SetCylinder(false, out _);
  736. if (_allInstalledModules.Contains("PMA"))
  737. {
  738. OP.DoOperation("PMA.SetSlitDoor", false);
  739. }
  740. if (_allInstalledModules.Contains("PMB"))
  741. {
  742. OP.DoOperation("PMB.SetSlitDoor", false);
  743. }
  744. if (_allInstalledModules.Contains("PMC"))
  745. {
  746. OP.DoOperation("PMC.SetSlitDoor", false);
  747. }
  748. if (_allInstalledModules.Contains("PMD"))
  749. {
  750. OP.DoOperation("PMD.SetSlitDoor", false);
  751. }
  752. return true;
  753. }
  754. public bool TurnTMPump(bool ison)
  755. {
  756. _TMPump.SetPumpOnOff(ison);
  757. return true;
  758. }
  759. public bool TryGetLLPump(ModuleName LLname)
  760. {
  761. //Self
  762. if ((LLname == ModuleName.LLA && _llPumpingState == LLPumpState.LLAUsing) || (LLname == ModuleName.LLB && _llPumpingState == LLPumpState.LLBUsing))
  763. return true;
  764. //Idle
  765. if (LLname == ModuleName.LLA && !IsLLBFastPumpOpen && !IsLLBSoftPumpOpen && _llPumpingState == LLPumpState.Idle)
  766. {
  767. _llPumpingState = LLPumpState.LLAUsing;
  768. return true;
  769. }
  770. if (LLname == ModuleName.LLB && !IsLLAFastPumpOpen && !IsLLASoftPumpOpen && _llPumpingState == LLPumpState.Idle)
  771. {
  772. _llPumpingState = LLPumpState.LLBUsing;
  773. return true;
  774. }
  775. //LOG.Write(eEvent.WARN_DEFAULT_WARN, LLname, "无法打开,另一个泵正在用!");
  776. //locked
  777. return false;
  778. }
  779. public void ReleasePump(ModuleName Module)
  780. {
  781. //release pump (must do it by user)
  782. if ((Module == ModuleName.LLA && _llPumpingState == LLPumpState.LLAUsing) || (Module == ModuleName.LLB && _llPumpingState == LLPumpState.LLBUsing))
  783. _llPumpingState = LLPumpState.Idle;
  784. }
  785. public void HomeSlitDoor()
  786. {
  787. if (IsLLASlitDoorClosed == true)
  788. {
  789. _LLATSlitDoor.SetCylinder(false, out _);
  790. }
  791. else if(IsLLASlitDoorOpen == true)
  792. {
  793. _LLATSlitDoor.SetCylinder(true, out _);
  794. }
  795. if (IsLLBSlitDoorClosed == true)
  796. {
  797. _LLBTSlitDoor.SetCylinder(false, out _);
  798. }
  799. else if (IsLLBSlitDoorOpen == true)
  800. {
  801. _LLBTSlitDoor.SetCylinder(true, out _);
  802. }
  803. if (IsLLAESlitDoorClosed == true)
  804. {
  805. _LLAESlitDoor.SetCylinder(false, out _);
  806. }
  807. else if (IsLLAESlitDoorOpen == true)
  808. {
  809. _LLAESlitDoor.SetCylinder(true, out _);
  810. }
  811. if (IsLLBESlitDoorClosed == true)
  812. {
  813. _LLBESlitDoor.SetCylinder(false, out _);
  814. }
  815. else if (IsLLBESlitDoorOpen == true)
  816. {
  817. _LLBESlitDoor.SetCylinder(true, out _);
  818. }
  819. }
  820. }
  821. }