JetPM.cs 30 KB

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