JetPM.cs 38 KB

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