JetPM.cs 31 KB

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