JetPM.cs 36 KB

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