JetPM.cs 32 KB

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