JetPM.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.Common.DeviceData;
  5. using Aitex.Core.RT.DataCenter;
  6. using Aitex.Core.RT.Device;
  7. using Aitex.Core.RT.Device.Unit;
  8. using Aitex.Core.RT.Event;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using Aitex.Sorter.Common;
  12. using MECF.Framework.Common.Device.Bases;
  13. using MECF.Framework.Common.Equipment;
  14. using MECF.Framework.Common.Schedulers;
  15. using MECF.Framework.Common.SubstrateTrackings;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  17. using VirgoCommon;
  18. using VirgoRT.Devices.IODevices;
  19. using VirgoRT.Instances;
  20. using VirgoRT.Module;
  21. using VirgoRT.Modules;
  22. namespace VirgoRT.Devices
  23. {
  24. enum ValveType
  25. {
  26. PROCESS,
  27. FAST_PUMP,
  28. SOFT_PUMP,
  29. FAST_VENT,
  30. PURGE,
  31. Mfc1,
  32. Mfc2,
  33. Mfc3,
  34. Mfc4,
  35. Mfc5
  36. }
  37. class JetPM : PM
  38. {
  39. // ----------------------------Fields--------------------------
  40. //
  41. private readonly IoLid _Lid;
  42. //private readonly IoCylinder _LidLocker;
  43. private readonly IoMessage _Messager;
  44. private readonly IoSensor _ATM_sw;
  45. private readonly IoSensor _VAC_sw;
  46. private readonly IoSensor _WLK_sw;
  47. private readonly IoSensor _CDAPressure;
  48. private readonly IoSensor _CoolantInletTC;
  49. private readonly IoSensor _CoolantOutletTC;
  50. private readonly IoSensor _ArmNotExtend;
  51. private readonly IoSensor _N2Pressure_sw;
  52. private readonly IoSensor _RFG_Interlock;
  53. private readonly IoPressureControl _pressureController;
  54. private readonly IoHeater _SubstrateTC;
  55. private readonly IoHeater _ForelineTC;
  56. private readonly IoValve _SoftPumpValve;
  57. private readonly IoValve _FastPumpValve;
  58. private readonly IoValve _ProcessValve;
  59. private readonly IoValve _PurgeValve;
  60. private readonly IoValve _FastVentValve;
  61. private readonly IoValve _Mfc1Valve;
  62. private readonly IoValve _Mfc2Valve;
  63. private readonly IoValve _Mfc3Valve;
  64. private readonly IoValve _Mfc4Valve;
  65. private readonly IoValve _Mfc5Valve;
  66. //private readonly IoValve _N2SupplyValve;
  67. private readonly IoCylinder _slitDoor;
  68. private readonly IoCylinder _LiftPin;
  69. private readonly IoCylinder _PinSmall; // 3'
  70. private readonly IoCylinder _PinMedium; // 4'
  71. private readonly RfPowerBase _Generator;
  72. private readonly RfPowerBase _GeneratorBias;
  73. private readonly RfMatchBase _Match;
  74. private readonly PumpBase _MainPump;
  75. private readonly ChillerBase _Chiller;
  76. private readonly IoGasStick[] _gasLines;
  77. private readonly ChillerBase _gridChiller;
  78. private readonly IoHeater _gridHeater;
  79. private readonly R_TRIG _trigBasePressure = new R_TRIG();
  80. private readonly R_TRIG _trigBaseTemperature = new R_TRIG();
  81. private double BasePressure;
  82. private double BaseTemperature;
  83. private bool EnableBiasRF = false;
  84. private int _bigWafer = 0;
  85. private int _midWafer = 0;
  86. private int _smallWafer = 0;
  87. private int gasCount = 0;
  88. // --------------------------Properties------------------------
  89. //
  90. public new ModuleName Module { get; }
  91. // 门的状态
  92. public bool IsSlitDoorClosed => !_slitDoor.ONFeedback && _slitDoor.OFFFeedback;
  93. public bool IsArmNotExtend => _ArmNotExtend.Value;
  94. // 盖子的状态
  95. public bool IsLidClosed => _Lid.OFFFeedback;
  96. // 盖子的锁
  97. //public bool IsLidLocked => !_LidLocker.ONSetPoint && _LidLocker.OFFSetPoint;
  98. public MovementPosition LiftPinPosition
  99. {
  100. get
  101. {
  102. MovementPosition pos = MovementPosition.Unknown;
  103. if (_LiftPin.ONFeedback && !_LiftPin.OFFFeedback)
  104. {
  105. pos = MovementPosition.Up;
  106. }
  107. else if (!_LiftPin.ONFeedback && _LiftPin.OFFFeedback)
  108. {
  109. pos = MovementPosition.Down;
  110. }
  111. return pos;
  112. }
  113. }
  114. public MovementPosition SmallPosition
  115. {
  116. get
  117. {
  118. if (_smallWafer == 0)
  119. return MovementPosition.Down;
  120. MovementPosition res = MovementPosition.Unknown;
  121. if (_PinSmall.ONFeedback && !_PinSmall.OFFFeedback)
  122. {
  123. res = MovementPosition.Up;
  124. }
  125. else if (_PinSmall.OFFFeedback && !_PinSmall.ONFeedback)
  126. {
  127. res = MovementPosition.Down;
  128. }
  129. return res;
  130. }
  131. }
  132. public MovementPosition MediumPosition
  133. {
  134. get
  135. {
  136. if (_midWafer == 0)
  137. return MovementPosition.Down;
  138. MovementPosition res = MovementPosition.Unknown;
  139. if (_PinMedium.ONFeedback && !_PinMedium.OFFFeedback)
  140. {
  141. res = MovementPosition.Up;
  142. }
  143. else if (_PinMedium.OFFFeedback && !_PinMedium.ONFeedback)
  144. {
  145. res = MovementPosition.Down;
  146. }
  147. return res;
  148. }
  149. }
  150. public override bool IsError
  151. {
  152. get
  153. {
  154. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  155. {
  156. return _MainPump.IsError || _Generator.IsError || _GeneratorBias.IsError;
  157. }
  158. else
  159. {
  160. return _MainPump.IsError || _Generator.IsError;
  161. }
  162. }
  163. }
  164. public override bool IsIdle { get; }
  165. // 腔体压力
  166. public bool IsPressureToleranceEnabled
  167. {
  168. get => _pressureController.EnableTolerance;
  169. set => _pressureController.EnableTolerance = value;
  170. }
  171. public override double ChamberPressure => _pressureController.ProcessGauge.Value;
  172. public override double ChamberPressurePressure => _pressureController.PressureGauge.Value;
  173. public double ForelinePressure => _pressureController.ForelineGauge.Value;
  174. public PressureCtrlMode PressureMode => _pressureController.ThrottleValve.PressureMode;
  175. public double TargetPressure => _pressureController.TargetPressure;
  176. // 压力信号
  177. public bool IsATM => _ATM_sw.Value;
  178. public bool IsVAC => _VAC_sw.Value;
  179. public bool IsWLK => _WLK_sw.Value;
  180. public bool IsRFGInterlockOn => _RFG_Interlock.Value;
  181. // 温度
  182. public float SubstrateTempSP => _SubstrateTC.ControlTcSetPoint;
  183. public float SubstrateTempFB => _SubstrateTC.ControlTcFeedback;
  184. public float CoolantInletTempFB => _SubstrateTC.CoolantInletTcFeedback;
  185. public float CoolantOutletTempFB => _SubstrateTC.CoolantOutletTcFeedback;
  186. // Pump 状态
  187. public bool IsPumpRunning => _MainPump.IsRunning;
  188. public bool IsFastPumpOpened => _FastPumpValve.Status;
  189. public bool IsSoftPumpOpened => _SoftPumpValve.Status;
  190. public bool IsMfc1ValveOpened => _Mfc1Valve.Status;
  191. public bool IsMfc2ValveOpened => _Mfc2Valve.Status;
  192. public bool IsMfc3ValveOpened => _Mfc3Valve.Status;
  193. public bool IsMfc4ValveOpened => _Mfc4Valve.Status;
  194. public bool IsMfc5ValveOpened => _Mfc5Valve.Status;
  195. public bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;
  196. public bool IsCDA_OK => _CDAPressure.Value;
  197. public bool IsCoolantInletTC_OK => _CoolantInletTC.Value;
  198. public bool IsCoolantOutletTC_OK => _CoolantOutletTC.Value;
  199. // 蝶阀位置
  200. public float TVPosition => _pressureController.ThrottleValve.PositionFeedback;
  201. // 腔体压力.end
  202. // 射频
  203. public float ForwardPower => _Generator.ForwardPower;
  204. public bool IsGeneratorON => _Generator.IsPowerOn;
  205. public float GeneratorSetpoint => _Generator.PowerSetPoint;
  206. // Bias射频
  207. public float ForwardPowerBias => _GeneratorBias.ForwardPower;
  208. public bool IsGeneratorONBias => _GeneratorBias.IsPowerOn;
  209. public float GeneratorSetpointBias => _GeneratorBias.PowerSetPoint;
  210. public float CTune => _GeneratorBias.CTune;
  211. public float CLoad => _GeneratorBias.CLoad;
  212. public int VPP => _GeneratorBias.VPP;
  213. // 流气
  214. public double TotalGasSetpoint
  215. {
  216. get
  217. {
  218. double sum = 0;
  219. foreach (var gas in _gasLines)
  220. {
  221. sum += gas.FlowSP;
  222. }
  223. return sum;
  224. }
  225. }
  226. public bool HasGasOutOfRange
  227. {
  228. get
  229. {
  230. foreach (var gas in _gasLines)
  231. {
  232. if (!gas.IsOutOfRange)
  233. return false;
  234. }
  235. return true;
  236. }
  237. }
  238. // --------------------------Constructor-----------------------
  239. //
  240. public JetPM(ModuleName mod) : base(mod.ToString())
  241. {
  242. Module = mod;
  243. BasePressure = SC.GetValue<double>($"{mod}.ChamberBasePressureThreshold");
  244. BaseTemperature = SC.GetValue<double>($"{mod}.ChamberBaseTemperatureThreshold");
  245. _smallWafer = SC.GetValue<int>($"System.SmallWafer");
  246. _midWafer = SC.GetValue<int>($"System.MidWafer");
  247. _bigWafer = SC.GetValue<int>($"System.BigWafer");
  248. EnableBiasRF = SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF");
  249. for (int i = 1; i <= 5; i++)
  250. {
  251. if (SC.GetValue<bool>($"{Module}.MfcGas{i}.Enable")) gasCount++;
  252. }
  253. //_gasLines = new IoGasStick[gasCount];
  254. _gasLines = new IoGasStick[5];
  255. //for (int index = 0; index < gasCount; index++)
  256. //{
  257. // _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  258. //}
  259. for (int index = 0; index < 5; index++)
  260. {
  261. _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  262. }
  263. _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VirgoDevice.Lid}");
  264. //_LidLocker = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.LidLocker}");
  265. _Messager = DEVICE.GetDevice<IoMessage>($"{Module}.Messager");
  266. _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");
  267. _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");
  268. _VAC_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");
  269. _WLK_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");
  270. _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  271. _CoolantInletTC = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantInletTCOK");
  272. _CoolantOutletTC = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantOutletTCOK");
  273. _ArmNotExtend = DEVICE.GetDevice<IoSensor>($"{Module}.SensorArmNotExtend");
  274. _RFG_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  275. _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VirgoDevice.PressureControl}");
  276. _SubstrateTC = DEVICE.GetDevice<IoHeater>($"{Module}.HeaterChamber");
  277. _ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
  278. _SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveSoftPumping}");
  279. _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveFastPumping}");
  280. _ProcessValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveProcess}");
  281. _FastVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveFastVent}");
  282. _PurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveChamberPurge}");
  283. _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc1}");
  284. _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc2}");
  285. _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc3}");
  286. _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc4}");
  287. _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc5}");
  288. _slitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.SlitDoor}");
  289. _LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.LiftPin}");
  290. _PinSmall = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.SmallPin}");
  291. _PinMedium = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.MediumPin}");
  292. _Generator = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.Rf}");
  293. _GeneratorBias = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.BiasRf}");
  294. _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VirgoDevice.MainPump}");
  295. _Chiller = DEVICE.GetDevice<ChillerBase>($"{Module}.{VirgoDevice.Chiller}");
  296. _gridChiller = DEVICE.GetDevice<ChillerBase>($"{Module}.GridChiller");
  297. _gridHeater = DEVICE.GetDevice<IoHeater>($"{Module}.GridHeater");
  298. _gridHeater.Controller = (IoHeaterController)_gridChiller;
  299. // RS223 AdTec Generator
  300. if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&
  301. SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  302. {
  303. _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.Rf}");
  304. }
  305. // Ethernet Comet Generator Bias
  306. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  307. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  308. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  309. {
  310. _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VirgoDevice.BiasRf}");
  311. }
  312. // RS232 AdTec match
  313. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  314. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  315. {
  316. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VirgoDevice.Match}");
  317. }
  318. // RS232 Dry pump, SKY
  319. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  320. {
  321. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  322. {
  323. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VirgoDevice.MainPump}");
  324. }
  325. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  326. {
  327. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VirgoDevice.MainPump}");
  328. }
  329. }
  330. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  331. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232 &&
  332. SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  333. {
  334. _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VirgoDevice.Chiller}");
  335. }
  336. System.Diagnostics.Debug.Assert(null != _Generator);
  337. System.Diagnostics.Debug.Assert(null != _MainPump);
  338. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  339. {
  340. System.Diagnostics.Debug.Assert(null != _GeneratorBias);
  341. }
  342. WaferManager.Instance.SubscribeLocation(Module, 1);
  343. }
  344. public override bool Initialize()
  345. {
  346. base.Initialize();
  347. DATA.Subscribe($"{Name}.IoTemperatureCtrl.TemperatureControl.SubstrateTemperature", () => SubstrateTempFB);
  348. DATA.Subscribe($"{Module}.WaferSize", () => WaferManager.Instance.GetWafer(Module, 0).Size.ToString());
  349. DATA.Subscribe($"{Module}.EnableBiasRF", () => EnableBiasRF);
  350. return true;
  351. }
  352. // -----------------------------Method-------------------------
  353. //
  354. public override void Home()
  355. {
  356. // 与yp讨论过,PM 初始化不需要
  357. SetLiftPin(MovementPosition.Down, out _);
  358. //SetSlitDoor(false, out _);
  359. if (WaferManager.Instance.CheckNoWafer(Module, 0))
  360. {
  361. SetGuidePinSmall(MovementPosition.Down);
  362. SetGuidePinMedium(MovementPosition.Down);
  363. }
  364. if (IsSlitDoorClosed)
  365. {
  366. SetSlitDoor(false, out _);
  367. }
  368. else if (!IsSlitDoorClosed)
  369. {
  370. SetSlitDoor(false, out _);
  371. }
  372. else if (_slitDoor.State == CylinderState.Error)
  373. {
  374. SetSlitDoor(true, out _);
  375. }
  376. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  377. {
  378. _Messager.SetMessager(1); //Virgo B
  379. }
  380. else
  381. {
  382. _Messager.SetMessager(0); //Virgo A
  383. }
  384. }
  385. public void SetSlitDoor(bool open, out string reason)
  386. {
  387. reason = string.Empty;
  388. // [XIAHUAN]: 只在关门的时候检查arm not extend
  389. if (!open && !IsArmNotExtend)
  390. {
  391. EV.PostAlarmLog(Module.ToString(), "Arm Not Extend 信号不满足");
  392. return;
  393. }
  394. _slitDoor.SetCylinder(open, out reason);
  395. }
  396. public override bool CheckWaterLeak()
  397. {
  398. return _WLK_sw.Value;
  399. }
  400. public override bool CheckCDAOK()
  401. {
  402. return _CDAPressure.Value;
  403. }
  404. public override bool CheckCoolantInletTCOK()
  405. {
  406. return _CoolantInletTC.Value;
  407. }
  408. public override bool CheckCoolantOutletTCOK()
  409. {
  410. return _CoolantOutletTC.Value;
  411. }
  412. public override bool CheckArmExtendOK()
  413. {
  414. return _ArmNotExtend.Value;
  415. }
  416. public override bool CheckAtm()
  417. {
  418. return _ATM_sw.Value && ChamberPressure > 700000;
  419. }
  420. public override bool CheckVacuum()
  421. {
  422. return _VAC_sw.Value && ChamberPressure < 100;
  423. }
  424. public bool CheckSlitDoorOpen()
  425. {
  426. return _slitDoor.State == CylinderState.Open;
  427. }
  428. public bool CheckSlitDoorClose()
  429. {
  430. return _slitDoor.State == CylinderState.Close;
  431. }
  432. public bool CheckLiftUp()
  433. {
  434. return _LiftPin.State == CylinderState.Open;
  435. }
  436. public bool CheckLiftDown()
  437. {
  438. return _LiftPin.State == CylinderState.Close;
  439. }
  440. public void StartPump(bool on)
  441. {
  442. //_pressureController.StartPump(on);
  443. _MainPump?.SetPumpOnOff(on);
  444. }
  445. public void SetValveOnOff(ValveType vlvType, bool on)
  446. {
  447. switch (vlvType)
  448. {
  449. case ValveType.PROCESS:
  450. _ProcessValve.TurnValve(on, out _);
  451. break;
  452. case ValveType.FAST_PUMP:
  453. _FastPumpValve.TurnValve(on, out _);
  454. break;
  455. case ValveType.SOFT_PUMP:
  456. _SoftPumpValve.TurnValve(on, out _);
  457. break;
  458. case ValveType.FAST_VENT:
  459. _FastVentValve.TurnValve(on, out _);
  460. break;
  461. case ValveType.PURGE:
  462. _PurgeValve.TurnValve(on, out _);
  463. break;
  464. case ValveType.Mfc1:
  465. _Mfc1Valve.TurnValve(on, out _);
  466. break;
  467. case ValveType.Mfc2:
  468. _Mfc2Valve.TurnValve(on, out _);
  469. break;
  470. case ValveType.Mfc3:
  471. _Mfc3Valve.TurnValve(on, out _);
  472. break;
  473. case ValveType.Mfc4:
  474. _Mfc4Valve.TurnValve(on, out _);
  475. break;
  476. case ValveType.Mfc5:
  477. _Mfc5Valve.TurnValve(on, out _);
  478. break;
  479. default:
  480. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  481. }
  482. }
  483. public void CheckPressureStability()
  484. {
  485. IsPressureToleranceEnabled = true;
  486. }
  487. public override void Monitor()
  488. {
  489. foreach (var gas in _gasLines)
  490. {
  491. gas.Monitor();
  492. }
  493. _trigBasePressure.CLK = ChamberPressurePressure >= BasePressure;
  494. if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller"))
  495. {
  496. _trigBaseTemperature.CLK = CoolantOutletTempFB >= BaseTemperature;
  497. }
  498. else
  499. {
  500. _trigBaseTemperature.CLK = SubstrateTempFB >= BaseTemperature;
  501. }
  502. if (_trigBasePressure.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, "PM pressure out of tolerance");
  503. if (_trigBaseTemperature.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, "PM temperature out of tolerance");
  504. }
  505. public void CloseValves()
  506. {
  507. _SoftPumpValve.TurnValve(false, out _);
  508. _FastPumpValve.TurnValve(false, out _);
  509. _ProcessValve.TurnValve(false, out _);
  510. _PurgeValve.TurnValve(false, out _);
  511. _FastVentValve.TurnValve(false, out _);
  512. _PurgeValve.TurnValve(false, out _);
  513. _Mfc1Valve.TurnValve(false, out _);
  514. _Mfc2Valve.TurnValve(false, out _);
  515. _Mfc3Valve.TurnValve(false, out _);
  516. _Mfc4Valve.TurnValve(false, out _);
  517. _Mfc5Valve.TurnValve(false, out _);
  518. foreach (var stick in _gasLines)
  519. {
  520. stick.Stop();
  521. }
  522. }
  523. public bool FlowGas(int gasNum, double val)
  524. {
  525. if (_gasLines.Length <= gasNum)
  526. return false;
  527. _gasLines[gasNum].Flow(val);
  528. return true;
  529. }
  530. public void StopAllGases()
  531. {
  532. foreach (var line in _gasLines)
  533. {
  534. line.Stop();
  535. }
  536. }
  537. public bool SetLiftPin(MovementPosition dirt, out string reason)
  538. {
  539. reason = string.Empty;
  540. switch (dirt)
  541. {
  542. case MovementPosition.Down:
  543. return _LiftPin.SetCylinder(false, out reason);
  544. case MovementPosition.Up:
  545. return _LiftPin.SetCylinder(true, out reason);
  546. case MovementPosition.Left:
  547. case MovementPosition.Right:
  548. case MovementPosition.Middle:
  549. throw new ArgumentException("Movement argument error");
  550. }
  551. return true;
  552. }
  553. public void SetGuidePin(WaferSize ws, MovementPosition dirt)
  554. {
  555. if (ws == WaferSize.WS3)
  556. SetGuidePinSmall(dirt);
  557. else if (ws == WaferSize.WS4)
  558. SetGuidePinMedium(dirt);
  559. }
  560. public void PrepareGuidePinForPlace(WaferSize ws)
  561. {
  562. if (ws == WaferSize.WS3)
  563. {
  564. SetGuidePinSmall(MovementPosition.Up);
  565. SetGuidePinMedium(MovementPosition.Down);
  566. }
  567. else if (ws == WaferSize.WS4)
  568. {
  569. SetGuidePinSmall(MovementPosition.Down);
  570. SetGuidePinMedium(MovementPosition.Up);
  571. }
  572. else if (ws == WaferSize.WS6)
  573. {
  574. SetGuidePinSmall(MovementPosition.Down);
  575. SetGuidePinMedium(MovementPosition.Down);
  576. }
  577. }
  578. public bool CheckGuidePinIsReadyForTransfer(WaferSize ws)
  579. {
  580. if (ws == WaferSize.WS3)
  581. {
  582. return SmallPosition == MovementPosition.Up && MediumPosition == MovementPosition.Down;
  583. }
  584. else if (ws == WaferSize.WS4)
  585. {
  586. return SmallPosition == MovementPosition.Down && MediumPosition == MovementPosition.Up;
  587. }
  588. else if (ws == WaferSize.WS6)
  589. {
  590. return SmallPosition == MovementPosition.Down && MediumPosition == MovementPosition.Down;
  591. }
  592. else
  593. return false;
  594. }
  595. private void SetGuidePinSmall(MovementPosition dirt)
  596. {
  597. EV.PostInfoLog(Module.ToString(), $"set small pin {dirt}, smallWafer={_smallWafer}");
  598. switch (dirt)
  599. {
  600. case MovementPosition.Down:
  601. if (_smallWafer != 0)
  602. _PinSmall?.SetCylinder(false, out _);
  603. break;
  604. case MovementPosition.Up:
  605. if (_smallWafer != 0)
  606. _PinSmall?.SetCylinder(true, out _);
  607. break;
  608. default:
  609. throw new ArgumentException("Movement argument error");
  610. }
  611. }
  612. private void SetGuidePinMedium(MovementPosition dirt)
  613. {
  614. EV.PostInfoLog(Module.ToString(), $"set medium pin {dirt}, midWafer={_midWafer}");
  615. switch (dirt)
  616. {
  617. case MovementPosition.Down:
  618. if (_midWafer != 0)
  619. _PinMedium?.SetCylinder(false, out _);
  620. break;
  621. case MovementPosition.Up:
  622. if (_midWafer != 0)
  623. _PinMedium?.SetCylinder(true, out _);
  624. break;
  625. default:
  626. throw new ArgumentException("Movement argument error");
  627. }
  628. }
  629. public void SetGeneratorCommunicationMode(int mode)
  630. {
  631. _Generator?.SetCommunicationMode(mode);
  632. }
  633. public bool GeneratorPowerOn(bool on)
  634. {
  635. if (_Generator == null) return false;
  636. if (on && !IsRFGInterlockOn)
  637. {
  638. EV.PostAlarmLog(Module.ToString(), "射频电源 Interlock条件不满足");
  639. return false;
  640. }
  641. return _Generator.SetPowerOnOff(on, out _);
  642. }
  643. public bool GeneratorSetpower(float val)
  644. {
  645. if (_Generator == null) return false;
  646. if (Math.Abs(val) > 0.01)
  647. _Generator.SetPower((ushort)val);
  648. return true;
  649. }
  650. public bool GeneratorBiasPowerOn(bool on)
  651. {
  652. if (_GeneratorBias == null) return false;
  653. if (on && !IsRFGInterlockOn)
  654. {
  655. EV.PostAlarmLog(Module.ToString(), "Bias射频电源 Interlock条件不满足");
  656. return false;
  657. }
  658. return _GeneratorBias.SetPowerOnOff(on, out _);
  659. }
  660. public bool GeneratorBiasSetpower(float val)
  661. {
  662. if (_GeneratorBias == null) return false;
  663. if (Math.Abs(val) > 0.01)
  664. _GeneratorBias.SetPower((ushort)val);
  665. return true;
  666. }
  667. public bool GeneratorBiasSetMatchMode(bool val)
  668. {
  669. if (_GeneratorBias == null) return false;
  670. string reason = string.Empty;
  671. _GeneratorBias.SetMatchingAutoMode(val, out reason);
  672. return true;
  673. }
  674. public bool SetMatchPosition(float c1, float c2)
  675. {
  676. if (_Match == null) return false;
  677. string reason = string.Empty;
  678. _Match.SetMatchPosition(c1, c2, out reason);
  679. return true;
  680. }
  681. public bool SetBiasMatchPosition(float c1, float c2)
  682. {
  683. if (_GeneratorBias == null) return false;
  684. string reason = string.Empty;
  685. _GeneratorBias.SetMatchPosition(c1, c2, out reason);
  686. return true;
  687. }
  688. public void FullOpenTV()
  689. {
  690. _pressureController.FullOpenThrottleValve();
  691. }
  692. public void HeatSubstrate(double val)
  693. {
  694. _SubstrateTC?.RampTemp((float)val);
  695. _SubstrateTC?.TurnOnOff(true);
  696. }
  697. public void HeatChiller(double value, double offset)
  698. {
  699. _Chiller?.SetChillerTemp((float)value, (float)offset);
  700. _Chiller?.SetChillerOnOff(true);
  701. }
  702. public bool CheckChillerStatus()
  703. {
  704. return _Chiller != null && _Chiller.IsRunning && !_Chiller.IsError;
  705. }
  706. public void HeatForeline(double val)
  707. {
  708. _ForelineTC?.RampTemp((float)val);
  709. }
  710. public override bool CheckEnableTransfer(EnumTransferType type)
  711. {
  712. if (type == EnumTransferType.Pick)
  713. {
  714. return _slitDoor.State == CylinderState.Open && _LiftPin.State == CylinderState.Open;
  715. }
  716. if (type == EnumTransferType.Place)
  717. {
  718. return _slitDoor.State == CylinderState.Open && _LiftPin.State == CylinderState.Close;
  719. }
  720. return false;
  721. }
  722. public bool CheckEnableTransfer(EnumTransferType type, WaferSize waferSize)
  723. {
  724. if (type == EnumTransferType.Pick)
  725. {
  726. return _slitDoor.State == CylinderState.Open
  727. && _LiftPin.State == CylinderState.Open
  728. && CheckGuidePinIsReadyForTransfer(waferSize);
  729. }
  730. if (type == EnumTransferType.Place)
  731. {
  732. return _slitDoor.State == CylinderState.Open
  733. && _LiftPin.State == CylinderState.Close
  734. && CheckGuidePinIsReadyForTransfer(waferSize);
  735. }
  736. return false;
  737. }
  738. public override void TransferHandoff(EnumTransferType type)
  739. {
  740. switch (type)
  741. {
  742. case EnumTransferType.Pick:
  743. SetLiftPin(MovementPosition.Up, out _);
  744. break;
  745. case EnumTransferType.Place:
  746. SetLiftPin(MovementPosition.Down, out _);
  747. break;
  748. case EnumTransferType.Extend:
  749. break;
  750. case EnumTransferType.Retract:
  751. break;
  752. default:
  753. break;
  754. }
  755. }
  756. public override void Reset()
  757. {
  758. _trigBasePressure.RST = true;
  759. _trigBaseTemperature.RST = true;
  760. }
  761. }
  762. /// <summary>
  763. /// PM Action
  764. /// </summary>
  765. abstract class PmActionBase : ActionBase
  766. {
  767. protected internal JetPM _chamber;
  768. protected PmActionBase(ModuleName mod, JetPM pm) : base(mod)
  769. {
  770. _chamber = pm;
  771. }
  772. }
  773. class PinAction : PmActionBase
  774. {
  775. public MovementPosition Pos { get; }
  776. public bool IsWaferTransfered { get; }
  777. public PMEntity PmEntity { get; set; }
  778. private Hand _blade;
  779. private bool _isPick;
  780. public PinAction(ModuleName mod, JetPM pm, MovementPosition pos, bool isTransferWafer, Hand blade, bool isPick) : base(mod, pm)
  781. {
  782. this.Pos = pos;
  783. IsWaferTransfered = isTransferWafer;
  784. _blade = blade;
  785. _isPick = isPick;
  786. }
  787. public override void Execute()
  788. {
  789. if (Module == ModuleName.PMA)
  790. PmEntity = Singleton<RouteManager>.Instance.PMA;
  791. else if (Module == ModuleName.PMB)
  792. PmEntity = Singleton<RouteManager>.Instance.PMB;
  793. if (PmEntity != null)
  794. {
  795. PmEntity.PostMsg(PMEntity.MSG.MoveLiftPin, Pos, ID, _isPick);
  796. }
  797. }
  798. public override void OnPostWork(string data = null)
  799. {
  800. if (IsWaferTransfered)
  801. {
  802. if (Pos == MovementPosition.Up)
  803. {
  804. WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, _blade==Hand.Blade1 ? 0 : 1, Module, 0);
  805. }
  806. else
  807. {
  808. WaferManager.Instance.WaferMoved(Module, 0, ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1);
  809. }
  810. }
  811. }
  812. }
  813. }