JetPM.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. using Aitex.Core.Common.DeviceData;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.Event;
  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 MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  10. using System;
  11. using System.Collections.Generic;
  12. using Venus_Core;
  13. using Venus_RT.Devices.IODevices;
  14. using Venus_RT.Devices.EPD;
  15. using Aitex.Core.RT.DataCenter;
  16. using Aitex.Core.RT.OperationCenter;
  17. namespace Venus_RT.Devices
  18. {
  19. enum ValveType
  20. {
  21. PVN21,
  22. PVN22,
  23. PV11,
  24. PV12,
  25. PV21,
  26. PV22,
  27. PV31,
  28. PV32,
  29. PV41,
  30. PV42,
  31. N2,
  32. Mfc1,
  33. Mfc2,
  34. Mfc3,
  35. Mfc4,
  36. Mfc5,
  37. Mfc6,
  38. Mfc7,
  39. Mfc8,
  40. PVHe1,
  41. PVHe2,
  42. GasFinal,
  43. SoftPump,
  44. FastPump,
  45. CHBPurge,
  46. TurboPumpPumping,
  47. TurboPumpPurge,
  48. Guage,
  49. LoadlockVent,
  50. LoadlockPumping
  51. }
  52. class JetPM : PM
  53. {
  54. private readonly IoLid _Lid;
  55. private readonly IoLid _LidLoadlock;
  56. private readonly IoCylinder _slitDoor;
  57. private readonly IoCylinder _LiftPin;
  58. private readonly IoCylinder _LoadLockArm;
  59. private readonly IoValve _PVN21Valve;
  60. private readonly IoValve _PVN22Valve;
  61. private readonly IoValve _PV11Valve;
  62. private readonly IoValve _PV12Valve;
  63. private readonly IoValve _PV21Valve;
  64. private readonly IoValve _PV22Valve;
  65. private readonly IoValve _PV31Valve;
  66. private readonly IoValve _PV32Valve;
  67. private readonly IoValve _PV41Valve;
  68. private readonly IoValve _PV42Valve;
  69. private readonly IoValve _N2Valve;
  70. private readonly IoValve _Mfc1Valve;
  71. private readonly IoValve _Mfc2Valve;
  72. private readonly IoValve _Mfc3Valve;
  73. private readonly IoValve _Mfc4Valve;
  74. private readonly IoValve _Mfc5Valve;
  75. private readonly IoValve _Mfc6Valve;
  76. private readonly IoValve _Mfc7Valve;
  77. private readonly IoValve _Mfc8Valve;
  78. private readonly IoValve _PVHe1Valve;
  79. private readonly IoValve _PVHe2Valve;
  80. private readonly IoValve _GasFinalValve;
  81. private readonly IoValve _SoftPumpValve;
  82. private readonly IoValve _FastPumpValve;
  83. private readonly IoValve _TurboPumpPumpingValve;
  84. private readonly IoValve _TurboPumpPurgeValve;
  85. private readonly IoValve _GuageValve;
  86. private readonly IoValve _LoadlockVentValve;
  87. private readonly IoValve _LoadlockPumpingValve;
  88. private readonly IoSensor _ATM_sw;
  89. private readonly IoSensor _CDAPressure;
  90. private readonly IoSensor _ATM_Loadlock_sw;
  91. private readonly IoSensor _N2Pressure_sw;
  92. private readonly IoSensor _VAC_sw;
  93. private readonly IoSensor _WLK_sw;
  94. private readonly IoSensor _Water_Flow;
  95. private readonly IoSensor _RFG_Interlock;
  96. private readonly IoSensor _PM_Lid_Closed;
  97. private readonly IoSensor _Source_RF_Fan;
  98. private readonly IoSensor _PM_SlitDoor_Closed;
  99. private readonly IoSensor _TurboPumpInterlock;
  100. private readonly PumpBase _MainPump;
  101. private readonly ESC5HighVoltage _ESCHV;
  102. private readonly AdixenTurboPump _TurboPump;
  103. private readonly PendulumValve _pendulumValve;
  104. private readonly ChillerBase _Chiller;
  105. private readonly RfPowerBase _Generator;//srf=>AdTecGenerator
  106. private readonly RfPowerBase _GeneratorBias;//brf=>CometRF
  107. private readonly RfMatchBase _Match;
  108. private readonly RfMatchBase _BiasMatch;
  109. private readonly IoSignalTower _SignalTower;
  110. private readonly IoHeater _ForelineTC;
  111. private readonly IoPressureControl _pressureController;
  112. private readonly IoGasStick[] _gasLines;
  113. private readonly IoGasStick _gasLineN2;
  114. private readonly IoBacksideHe _backsideHe;
  115. // EndPoint
  116. private readonly EPDClient _epdClient;
  117. private readonly double _foreline_interlock_pressure = 750;
  118. public List<string> EPDCfgList => _epdClient.CFGFileList;
  119. public bool EPDCaptured => _epdClient.Captured;
  120. public bool EPDConnected => _epdClient.IsEPDConnected;
  121. // 盖子的状态
  122. public bool IsLidClosed => _Lid.OFFFeedback;
  123. public bool IsLidLoadlockClosed => _LidLoadlock.OFFFeedback;
  124. public bool IsSlitDoorClosed => !_slitDoor.ONFeedback && _slitDoor.OFFFeedback;
  125. public bool IsPumpRunning => _MainPump.IsRunning;
  126. public bool IsTurboPumpRunning => _TurboPump.IsRunning;
  127. public bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed;
  128. public bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;
  129. public bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning;
  130. public bool IsCDA_OK => _CDAPressure.Value;
  131. public bool IsFastPumpOpened => _FastPumpValve.Status;
  132. public bool IsSoftPumpOpened => _SoftPumpValve.Status;
  133. public bool IsMfc1ValveOpened => _Mfc1Valve.Status;
  134. public bool IsMfc2ValveOpened => _Mfc2Valve.Status;
  135. public bool IsMfc3ValveOpened => _Mfc3Valve.Status;
  136. public bool IsMfc4ValveOpened => _Mfc4Valve.Status;
  137. public bool IsMfc5ValveOpened => _Mfc5Valve.Status;
  138. public bool IsMfc6ValveOpened => _Mfc6Valve.Status;
  139. public bool IsMfc7ValveOpened => _Mfc7Valve.Status;
  140. public bool IsMfc8ValveOpened => _Mfc8Valve.Status;
  141. // 压力信号
  142. public bool IsATM => _ATM_sw.Value;
  143. public bool LiftPinIsDown => _LiftPin.OFFFeedback;
  144. public bool LiftPinIsUp => _LiftPin.ONFeedback;
  145. public bool IsATMLoadlock => _ATM_Loadlock_sw.Value;
  146. public bool IsVACLoadLock => LoadlockPressure <= 1000;
  147. public bool IsVAC => _VAC_sw.Value;
  148. public bool IsWaterFlowOk => _Water_Flow.Value;
  149. public bool IsWLK => _WLK_sw.Value;
  150. public bool IsRFGInterlockOn => _RFG_Interlock.Value;
  151. public bool PMLidClosed => _PM_Lid_Closed.Value;
  152. public bool TurboPumpInterlock => _TurboPumpInterlock.Value;
  153. public bool SourceRFFanInterlock => _Source_RF_Fan.Value;
  154. public bool SlitDoorClosed => _PM_SlitDoor_Closed.Value;
  155. public double ProcessPressure => _pressureController.ProcessGauge.Value;
  156. public override double ChamberPressure => _pressureController.PressureGauge.Value;
  157. public double ForelinePressure => _pressureController.ForelineGauge.Value;
  158. public double TargetPressure => _pressureController.TargetPressure;
  159. public double LoadlockPressure => _pressureController.LoadLockGauge.Value;
  160. public double ESCHePressure => _pressureController.ESCHeGauge.Value;
  161. public float CoolantInletTempFB => _Chiller.CoolantInletTcFeedback;
  162. public float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;
  163. //Loadlock_Arm
  164. public bool IsLoadlockArmRetract => _LoadLockArm.OFFFeedback;
  165. public bool IsLoadlockArmExtend => _LoadLockArm.ONFeedback;
  166. //Loadlock_Arm DO
  167. public bool LoadlockArmRetract => _LoadLockArm.OFFSetPoint;
  168. public bool LoadlockArmExtend => _LoadLockArm.ONSetPoint;
  169. public float ReflectPower => _Generator.ReflectPower;
  170. public float BiasReflectPower => _GeneratorBias.ReflectPower;
  171. public bool BackSideHeOutOfRange => _backsideHe.OutOfRange;
  172. public new ModuleName Module { get; }
  173. public MovementPosition LiftPinPosition
  174. {
  175. get
  176. {
  177. MovementPosition pos = MovementPosition.Unknown;
  178. if (_LiftPin.ONFeedback && !_LiftPin.OFFFeedback)
  179. {
  180. pos = MovementPosition.Up;
  181. }
  182. else if (!_LiftPin.ONFeedback && _LiftPin.OFFFeedback)
  183. {
  184. pos = MovementPosition.Down;
  185. }
  186. return pos;
  187. }
  188. }
  189. public override bool CheckAtm()
  190. {
  191. return _ATM_sw.Value && ChamberPressure > 700000;
  192. }
  193. public bool CheckSlitDoorOpen()
  194. {
  195. return _slitDoor.State == CylinderState.Open;
  196. }
  197. public bool CheckSlitDoorClose()
  198. {
  199. return _slitDoor.State == CylinderState.Close;
  200. }
  201. public bool CheckLiftUp()
  202. {
  203. return _LiftPin.State == CylinderState.Open;
  204. }
  205. public bool CheckLiftDown()
  206. {
  207. return _LiftPin.State == CylinderState.Close;
  208. }
  209. public double TotalGasSetpoint
  210. {
  211. get
  212. {
  213. double sum = 0;
  214. foreach (var gas in _gasLines)
  215. {
  216. sum += gas.FlowSP;
  217. }
  218. return sum;
  219. }
  220. }
  221. public bool HasGasOutOfRange
  222. {
  223. get
  224. {
  225. foreach (var gas in _gasLines)
  226. {
  227. if (!gas.IsOutOfRange)
  228. return false;
  229. }
  230. return true;
  231. }
  232. }
  233. public JetPM(ModuleName mod) : base(mod.ToString())
  234. {
  235. Module = mod;
  236. _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");
  237. _LidLoadlock = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.LidLoadlock}");
  238. _slitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.SlitDoor}");
  239. _LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LiftPin}");
  240. _LoadLockArm = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LoadLockArm}");
  241. _PVN21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN21}");
  242. _PVN22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN22}");
  243. _PV11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV11}");
  244. _PV12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV12}");
  245. _PV21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV21}");
  246. _PV22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV22}");
  247. _PV31Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV31}");
  248. _PV32Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV32}");
  249. _PV41Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV41}");
  250. _PV42Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV42}");
  251. _N2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveN2}");
  252. _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc1}");
  253. _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  254. _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  255. _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  256. _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  257. _Mfc6Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  258. _Mfc7Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  259. _Mfc8Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");
  260. _PVHe1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe1}");
  261. _PVHe2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe2}");
  262. _GasFinalValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGasFinal}");
  263. _SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSoftPump}");
  264. _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveFastPump}");
  265. _TurboPumpPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPumping}");
  266. _TurboPumpPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPurge}");
  267. _GuageValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGuage}");
  268. _LoadlockVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockVent}");
  269. _LoadlockPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockPumping}");
  270. _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");
  271. _ATM_Loadlock_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorLoadlockATMSwitch");
  272. _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");
  273. _VAC_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");
  274. _Water_Flow = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk");
  275. _WLK_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");
  276. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  277. _RFG_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  278. _PM_Lid_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorPMLidClosed");
  279. _Source_RF_Fan = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSourceRFFan");
  280. _PM_SlitDoor_Closed = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSlitDoorClosed");
  281. _TurboPumpInterlock = DEVICE.GetDevice<IoSensor>($"{Module}.TurboPumpInterlock");
  282. _ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
  283. _SignalTower = DEVICE.GetDevice<IoSignalTower>($"{Module}.SignalTower");
  284. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  285. _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");
  286. _gasLines = new IoGasStick[8];
  287. for (int index = 0; index < 8; index++)
  288. {
  289. _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  290. }
  291. _gasLineN2 = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStickN2");
  292. _backsideHe = DEVICE.GetDevice<IoBacksideHe>($"{Module}.BacksideHelium");
  293. _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VenusDevice.MainPump}");
  294. // RS232 Dry pump, SKY
  295. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  296. {
  297. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  298. {
  299. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");
  300. }
  301. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  302. {
  303. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VenusDevice.MainPump}");
  304. }
  305. }
  306. _ESCHV = DEVICE.GetDevice<ESC5HighVoltage>($"{Module}.{VenusDevice.ESCHV}");
  307. _TurboPump = DEVICE.GetDevice<AdixenTurboPump>($"{Module}.{VenusDevice.TurboPump}");
  308. _pendulumValve = DEVICE.GetDevice<PendulumValve>($"{Module}.{VenusDevice.PendulumValve}");
  309. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  310. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)
  311. {
  312. if (SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  313. {
  314. _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");
  315. }
  316. else if (SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)
  317. {
  318. _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");
  319. }
  320. }
  321. // RS223 AdTec Generator
  322. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  323. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  324. {
  325. _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");
  326. }
  327. // Ethernet Comet Generator Bias
  328. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))
  329. {
  330. if (SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  331. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  332. {
  333. _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");
  334. }
  335. else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  336. {
  337. _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.BiasRf}");
  338. }
  339. }
  340. // RS232 AdTec match
  341. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  342. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  343. {
  344. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");
  345. }
  346. // Bias Match
  347. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  348. SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&
  349. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  350. {
  351. _BiasMatch = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.BiasMatch}");
  352. }
  353. _epdClient = DEVICE.GetDevice<EPDClient>($"{Module}.{VenusDevice.EndPoint}");
  354. DATA.Subscribe($"{Name}.ForelinePressure", () => ForelinePressure);
  355. DATA.Subscribe($"{Name}.ProcessPressure", () => ProcessPressure);
  356. DATA.Subscribe($"{Name}.ESCHePressure", () => ESCHePressure);
  357. DATA.Subscribe($"{Name}.LoadlockPressure", () => LoadlockPressure);
  358. DATA.Subscribe($"{Name}.IsATM", () => IsATM);
  359. DATA.Subscribe($"{Name}.IsVAC", () => IsVAC);
  360. DATA.Subscribe($"{Name}.LiftPinIsUp", () => LiftPinIsUp);
  361. DATA.Subscribe($"{Name}.LiftPinIsDown", () => LiftPinIsDown);
  362. DATA.Subscribe($"{Name}.PumpIsRunning", () => IsPumpRunning);
  363. DATA.Subscribe($"{Name}.TurboPumpIsRunning", () => IsTurboPumpRunning);
  364. DATA.Subscribe($"{Name}.IsSlitDoorClosed", () => IsSlitDoorClosed);
  365. DATA.Subscribe($"{Name}.IsLidClosed", () => IsLidClosed);
  366. DATA.Subscribe($"{Name}.SRfIsOn", () => _Generator.IsPowerOn);
  367. DATA.Subscribe($"{Name}.BRfIsOn", () => _GeneratorBias.IsPowerOn);
  368. DATA.Subscribe($"{Name}.TurboPumpRotationalSpeed", () => _TurboPump.RotationalSpeed);
  369. DATA.Subscribe($"{Name}.PendulumValve.Position", () => _pendulumValve.Position);
  370. DATA.Subscribe($"{Name}.PendulumValve.Pressure", () => _pendulumValve.Pressure);
  371. DATA.Subscribe($"{Name}.GetPVPosition", () => GetPVPosition());
  372. //DATA.Subscribe($"{Name}.TurboPumpIsRunning", () => _);
  373. OP.Subscribe($"{Module}.SetLiftPin", (cmd, args) => {
  374. if ((bool)args[0] == true)
  375. {
  376. SetLiftPin(MovementPosition.Up, out _);
  377. }
  378. else
  379. {
  380. SetLiftPin(MovementPosition.Down, out _);
  381. }
  382. return true;
  383. });
  384. OP.Subscribe($"{Module}.SetSRf", (cmd, args) => {
  385. GeneratorSetpower((float)args[0]);
  386. GeneratorPowerOn((bool)args[1]);
  387. return true;
  388. });
  389. OP.Subscribe($"{Module}.SetBRf", (cmd, args) => {
  390. SetBiasMatchPosition((float)args[0], (float)args[1]);
  391. GeneratorBiasPowerOn((bool)args[0]);
  392. return true;
  393. });
  394. OP.Subscribe($"{Module}.SetSlitDoor", (cmd, args) => {
  395. SetSlitDoor((bool)args[0], out _);
  396. return true;
  397. });
  398. OP.Subscribe($"{Module}.SetESCHV", (cmd, args) => {
  399. _ESCHV.SetPowerOnOff((bool)args[0]);
  400. return true;
  401. });
  402. OP.Subscribe($"{Module}.SetPVPostion", (cmd, args) => {
  403. SetPVPostion((int)args[0]);
  404. return true;
  405. });
  406. OP.Subscribe($"{Module}.SetPVPressure", (cmd, args) => {
  407. SetPVPressure((int)args[0]);
  408. return true;
  409. });
  410. OP.Subscribe($"{Module}.ClosePump", (cmd, args) => {
  411. TurnDryPump(false);
  412. return true;
  413. });
  414. OP.Subscribe($"{Module}.CloseTurboPump", (cmd, args) => {
  415. TurnTurboPump(false);
  416. return true;
  417. });
  418. _foreline_interlock_pressure = SC.GetValue<double>($"{mod}.ForelineInterlockPressure");
  419. }
  420. public void CloseValves()
  421. {
  422. _PVN21Valve.TurnValve(false, out _);
  423. _PVN22Valve.TurnValve(false, out _);
  424. _PV11Valve.TurnValve(false, out _);
  425. _PV12Valve.TurnValve(false, out _);
  426. _PV21Valve.TurnValve(false, out _);
  427. _PV22Valve.TurnValve(false, out _);
  428. _PV31Valve.TurnValve(false, out _);
  429. _PV32Valve.TurnValve(false, out _);
  430. _PV41Valve.TurnValve(false, out _);
  431. _PV42Valve.TurnValve(false, out _);
  432. _PVHe1Valve.TurnValve(false, out _);
  433. _PVHe2Valve.TurnValve(false, out _);
  434. _GasFinalValve.TurnValve(false, out _);
  435. _SoftPumpValve.TurnValve(false, out _);
  436. _FastPumpValve.TurnValve(false, out _);
  437. _TurboPumpPumpingValve.TurnValve(false, out _);
  438. _TurboPumpPurgeValve.TurnValve(false, out _);
  439. _GuageValve.TurnValve(false, out _);
  440. _LoadlockVentValve.TurnValve(false, out _);
  441. _LoadlockPumpingValve.TurnValve(false, out _);
  442. _N2Valve.TurnValve(false, out _);
  443. _FastPumpValve.TurnValve(false, out _);
  444. _Mfc1Valve.TurnValve(false, out _);
  445. _Mfc2Valve.TurnValve(false, out _);
  446. _Mfc3Valve.TurnValve(false, out _);
  447. _Mfc4Valve.TurnValve(false, out _);
  448. _Mfc5Valve.TurnValve(false, out _);
  449. _Mfc6Valve.TurnValve(false, out _);
  450. _Mfc7Valve.TurnValve(false, out _);
  451. _Mfc8Valve.TurnValve(false, out _);
  452. foreach (var stick in _gasLines)
  453. {
  454. stick.Stop();
  455. }
  456. }
  457. public void TurnDryPump(bool on)
  458. {
  459. //_pressureController.StartPump(on);
  460. _MainPump?.SetPumpOnOff(on);
  461. }
  462. public void TurnTurboPump(bool on)
  463. {
  464. _TurboPump?.SetPumpOnOff(on);
  465. }
  466. public void OpenValve(ValveType vlvType, bool on)
  467. {
  468. switch (vlvType)
  469. {
  470. case ValveType.PVN21:
  471. _PVN21Valve.TurnValve(on, out _);
  472. break;
  473. case ValveType.PVN22:
  474. _PVN22Valve.TurnValve(on, out _);
  475. break;
  476. case ValveType.PV11:
  477. _PV11Valve.TurnValve(on, out _);
  478. break;
  479. case ValveType.PV12:
  480. _PV12Valve.TurnValve(on, out _);
  481. break;
  482. case ValveType.PV21:
  483. _PV21Valve.TurnValve(on, out _);
  484. break;
  485. case ValveType.PV22:
  486. _PV22Valve.TurnValve(on, out _);
  487. break;
  488. case ValveType.PV31:
  489. _PV31Valve.TurnValve(on, out _);
  490. break;
  491. case ValveType.PV32:
  492. _PV32Valve.TurnValve(on, out _);
  493. break;
  494. case ValveType.PV41:
  495. _PV41Valve.TurnValve(on, out _);
  496. break;
  497. case ValveType.PV42:
  498. _PV42Valve.TurnValve(on, out _);
  499. break;
  500. case ValveType.N2:
  501. _N2Valve.TurnValve(on, out _);
  502. break;
  503. case ValveType.PVHe1:
  504. _PVHe1Valve.TurnValve(on, out _);
  505. break;
  506. case ValveType.PVHe2:
  507. _PVHe2Valve.TurnValve(on, out _);
  508. break;
  509. case ValveType.GasFinal:
  510. _GasFinalValve.TurnValve(on, out _);
  511. break;
  512. case ValveType.SoftPump:
  513. _SoftPumpValve.TurnValve(on, out _);
  514. break;
  515. case ValveType.FastPump:
  516. _FastPumpValve.TurnValve(on, out _);
  517. break;
  518. case ValveType.TurboPumpPumping:
  519. _TurboPumpPumpingValve.TurnValve(on, out _);
  520. break;
  521. case ValveType.TurboPumpPurge:
  522. _TurboPumpPurgeValve.TurnValve(on, out _);
  523. break;
  524. case ValveType.Guage:
  525. _GuageValve.TurnValve(on, out _);
  526. break;
  527. case ValveType.LoadlockVent:
  528. _LoadlockVentValve.TurnValve(on, out _);
  529. break;
  530. case ValveType.LoadlockPumping:
  531. _LoadlockPumpingValve.TurnValve(on, out _);
  532. break;
  533. case ValveType.Mfc1:
  534. _Mfc1Valve.TurnValve(on, out _);
  535. break;
  536. case ValveType.Mfc2:
  537. _Mfc2Valve.TurnValve(on, out _);
  538. break;
  539. case ValveType.Mfc3:
  540. _Mfc3Valve.TurnValve(on, out _);
  541. break;
  542. case ValveType.Mfc4:
  543. _Mfc4Valve.TurnValve(on, out _);
  544. break;
  545. case ValveType.Mfc5:
  546. _Mfc5Valve.TurnValve(on, out _);
  547. break;
  548. case ValveType.Mfc6:
  549. _Mfc6Valve.TurnValve(on, out _);
  550. break;
  551. case ValveType.Mfc7:
  552. _Mfc7Valve.TurnValve(on, out _);
  553. break;
  554. case ValveType.Mfc8:
  555. _Mfc8Valve.TurnValve(on, out _);
  556. break;
  557. default:
  558. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  559. }
  560. }
  561. public override void Monitor()
  562. {
  563. foreach (var gas in _gasLines)
  564. {
  565. gas.Monitor();
  566. }
  567. CheckInterlock();
  568. }
  569. private void CheckInterlock()
  570. {
  571. if (ProcessPressure > 100 && _GuageValve.SetPoint)
  572. {
  573. _GuageValve.TurnValve(false, out _);
  574. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 100 mtorr, Guage Valve (DO-31) closed automaticlly.");
  575. }
  576. if(ForelinePressure > _foreline_interlock_pressure)
  577. {
  578. if(_TurboPumpPumpingValve.SetPoint || _TurboPumpPurgeValve.SetPoint || _pendulumValve.IsOpen)
  579. {
  580. _pendulumValve.TurnValve(false);
  581. _TurboPumpPurgeValve.TurnValve(false, out _);
  582. _TurboPumpPumpingValve.TurnValve(false, out _);
  583. LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Foreline pressure:{ForelinePressure} exceed {_foreline_interlock_pressure} mtorr, Pendulum valve & PV6 & PV7 closed automaticlly.");
  584. }
  585. }
  586. }
  587. public void BuzzerBlinking(double time)
  588. {
  589. _SignalTower.BuzzerBlinking(time);
  590. }
  591. public void SwitchOnBuzzerAndRed()
  592. {
  593. _SignalTower.SwitchOnBuzzerAndRed("", null);
  594. }
  595. public override void Home()
  596. {
  597. // 与yp讨论过,PM 初始化不需要
  598. SetLiftPin(MovementPosition.Down, out _);
  599. SetSlitDoor(false, out _);
  600. }
  601. public bool SetLiftPin(MovementPosition dirt, out string reason)
  602. {
  603. reason = string.Empty;
  604. switch (dirt)
  605. {
  606. case MovementPosition.Down:
  607. return _LiftPin.SetCylinder(false, out reason);
  608. case MovementPosition.Up:
  609. return _LiftPin.SetCylinder(true, out reason);
  610. case MovementPosition.Left:
  611. case MovementPosition.Right:
  612. case MovementPosition.Middle:
  613. throw new ArgumentException("Movement argument error");
  614. }
  615. return true;
  616. }
  617. public void SetSlitDoor(bool open, out string reason)
  618. {
  619. reason = string.Empty;
  620. if(open)
  621. {
  622. double maxPressureDifference = SC.GetValue<double>("System.PMLLMaxPressureDifference");
  623. if(Math.Abs(LoadlockPressure - ChamberPressure) > maxPressureDifference)
  624. {
  625. reason = $"{Module} and Loadlock pressure difference exceeds the max limit";
  626. LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);
  627. return;
  628. }
  629. }
  630. _slitDoor.SetCylinder(open, out reason);
  631. }
  632. public bool RetractWafer()
  633. {
  634. return _LoadLockArm.SetCylinder(false, out _);
  635. }
  636. public bool ExtendWafer()
  637. {
  638. return _LoadLockArm.SetCylinder(true, out _);
  639. }
  640. public bool FlowGas(int gasNum, double val)
  641. {
  642. if (_gasLines.Length <= gasNum)
  643. return false;
  644. _gasLines[gasNum].Flow(val);
  645. return true;
  646. }
  647. public bool StopGas(int gasNum)
  648. {
  649. if (_gasLines.Length <= gasNum)
  650. return false;
  651. _gasLines[gasNum].Stop();
  652. return true;
  653. }
  654. public void StopAllGases()
  655. {
  656. foreach (var line in _gasLines)
  657. {
  658. line.Stop();
  659. }
  660. }
  661. public bool TurnPendulumValve(bool on)
  662. {
  663. return _pendulumValve.TurnValve(on);
  664. }
  665. public bool SetPVPressure(int pressure)
  666. {
  667. return _pendulumValve.SetPressure(pressure);
  668. }
  669. public bool SetPVPostion(int position)
  670. {
  671. return _pendulumValve.SetPosition(position);
  672. }
  673. public int GetPVPosition()
  674. {
  675. return _pendulumValve.Position;
  676. }
  677. public void HeatChiller(double value, double offset)
  678. {
  679. _Chiller?.SetChillerTemp((float)value, (float)offset);
  680. _Chiller?.SetChillerOnOff(true);
  681. }
  682. public bool CheckChillerStatus()
  683. {
  684. return _Chiller != null /*&& _Chiller.IsRunning*/ && !_Chiller.IsError;
  685. }
  686. public void SetGeneratorCommunicationMode(int mode)
  687. {
  688. _Generator?.SetCommunicationMode(mode);
  689. }
  690. public bool GeneratorPowerOn(bool on)
  691. {
  692. if (_Generator == null) return false;
  693. if (on && !IsRFGInterlockOn)
  694. {
  695. LOG.Write(eEvent.ERR_RF, Module, "射频电源 Interlock条件不满足");
  696. return false;
  697. }
  698. return _Generator.SetPowerOnOff(on, out _);
  699. }
  700. public bool GeneratorSetpower(float val)
  701. {
  702. if (_Generator == null) return false;
  703. if (Math.Abs(val) > 0.01)
  704. _Generator.SetPower((ushort)val);
  705. return true;
  706. }
  707. public bool GeneratorBiasPowerOn(bool on)
  708. {
  709. if (_GeneratorBias == null) return false;
  710. if (on && !IsRFGInterlockOn)
  711. {
  712. LOG.Write(eEvent.ERR_RF, Module, "Bias射频电源 Interlock条件不满足");
  713. return false;
  714. }
  715. return _GeneratorBias.SetPowerOnOff(on, out _);
  716. }
  717. public bool GeneratorBiasSetpower(float val)
  718. {
  719. if (_GeneratorBias == null) return false;
  720. if (Math.Abs(val) > 0.01)
  721. _GeneratorBias.SetPower((ushort)val);
  722. return true;
  723. }
  724. public bool GeneratorBiasSetMatchMode(bool val)
  725. {
  726. if (_GeneratorBias == null) return false;
  727. string reason = string.Empty;
  728. _GeneratorBias.SetMatchingAutoMode(val, out reason);
  729. return true;
  730. }
  731. public bool SetMatchPosition(float c1, float c2)
  732. {
  733. if (_Match == null) return false;
  734. string reason = string.Empty;
  735. _Match.SetMatchPosition(c1, c2, out reason);
  736. return true;
  737. }
  738. public bool SetBiasMatchPosition(float c1, float c2)
  739. {
  740. if (_BiasMatch == null) return false;
  741. string reason = string.Empty;
  742. _BiasMatch.SetMatchPosition(c1, c2, out reason);
  743. return true;
  744. }
  745. public bool SetBiasPulseMode(bool on)
  746. {
  747. if (_GeneratorBias == null) return false;
  748. _GeneratorBias.SetPulseMode(on);
  749. return true;
  750. }
  751. public bool SetBiasPulseRateFreq(int nFreq)
  752. {
  753. if (_GeneratorBias == null) return false;
  754. _GeneratorBias.SetPulseRateFreq(nFreq);
  755. return true;
  756. }
  757. public bool SetDiasPulseDutyCycle(int percentage)
  758. {
  759. if (_GeneratorBias == null) return false;
  760. _GeneratorBias.SetPulseDutyCycle(percentage);
  761. return true;
  762. }
  763. public bool SetESCClampVoltage(int nVoltage)
  764. {
  765. if (_ESCHV == null) return false;
  766. return _ESCHV.SetOutputVoltage(nVoltage);
  767. }
  768. public bool CheckGeneratorAndHVInterlock(VenusDevice device)
  769. {
  770. eEvent evt = device == VenusDevice.Rf ? eEvent.ERR_RF : eEvent.ERR_ESC_HV;
  771. string deviceName = device == VenusDevice.Rf ? "RF Generator" : "ESC HV";
  772. if (!PMLidClosed)
  773. {
  774. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as PM Lid is Open.");
  775. return false;
  776. }
  777. if (!IsVAC)
  778. {
  779. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as PM is not Vacuum.");
  780. return false;
  781. }
  782. if(!IsWaterFlowOk)
  783. {
  784. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as Water Flow is OFF.");
  785. return false;
  786. }
  787. if(!IsRFGInterlockOn)
  788. {
  789. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as Generator Interlock is OFF.");
  790. return false;
  791. }
  792. if(!SourceRFFanInterlock)
  793. {
  794. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as Source RF Fan is OFF.");
  795. return false;
  796. }
  797. if(!SlitDoorClosed)
  798. {
  799. LOG.Write(evt, Module, $"Cannot Power ON {deviceName} as Slit Door is open.");
  800. return false;
  801. }
  802. return true;
  803. }
  804. #region EndPoint
  805. public void EPDRecipeStart()
  806. {
  807. _epdClient.RecipeStart();
  808. }
  809. public void EPDRecipeStop()
  810. {
  811. _epdClient.RecipeStop();
  812. }
  813. public void EPDStepStart(string cfgName)
  814. {
  815. _epdClient.StepStart(cfgName);
  816. }
  817. public void EPDStepStop()
  818. {
  819. _epdClient.StepStop();
  820. }
  821. #endregion
  822. public void SetBacksideHeFlow(double flow)
  823. {
  824. if (_backsideHe == null) return ;
  825. _backsideHe.Flow(flow);
  826. }
  827. public bool SetBacksideHePressure(int mTorr)
  828. {
  829. if (_backsideHe == null) return false;
  830. return _backsideHe.SetBacksideHelium(mTorr);
  831. }
  832. public bool SetBacksideHeThreshold(int nMin, int nMax)
  833. {
  834. if (_backsideHe == null) return false;
  835. return _backsideHe.SetFlowThreshold(nMin, nMax);
  836. }
  837. }
  838. }