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