JetPM.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  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. {
  312. if(SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)
  313. {
  314. _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.Rf}");
  315. }
  316. else if (SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.Revtech)
  317. {
  318. _Generator = DEVICE.GetDevice<RevtechGenerator>($"{Module}.{VirgoDevice.Rf}");
  319. }
  320. }
  321. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Kashiyama)
  322. {
  323. _MainPump = DEVICE.GetDevice<KashiyamaPump>($"{Module}.{VirgoDevice.MainPump}");
  324. }
  325. // Ethernet Comet Generator Bias
  326. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  327. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&
  328. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)
  329. {
  330. _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VirgoDevice.BiasRf}");
  331. }
  332. // RS223 AdTec Generator Bias
  333. if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF") &&
  334. SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.RS232 &&
  335. SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)
  336. {
  337. _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.BiasRf}");
  338. }
  339. // RS232 AdTec match
  340. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232 &&
  341. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.AdTec)
  342. {
  343. if (SC.GetValue<int>($"{mod}.match.AdTecSourceMatchModel") == 0)
  344. {
  345. _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VirgoDevice.Match}");
  346. }
  347. if (SC.GetValue<int>($"{mod}.match.AdTecSourceMatchModel") == 1)
  348. {
  349. _Match = DEVICE.GetDevice<AdTecMatchAMVG>($"{Module}.{VirgoDevice.Match}");
  350. }
  351. }
  352. if (SC.GetValue<bool>($"{mod}.match.EnableMatch") &&
  353. SC.GetValue<int>($"{mod}.match.MFG") == (int)MatchMFG.Revtech)
  354. {
  355. if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.RS232)
  356. {
  357. _Match = DEVICE.GetDevice<ComRevtechMatch>($"{Module}.match");
  358. }
  359. else if (SC.GetValue<int>($"{mod}.match.CommunicationType") == (int)CommunicationType.Ethernet)
  360. {
  361. _Match = DEVICE.GetDevice<EthernetRevtechMatch>($"{Module}.match");
  362. }
  363. }
  364. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  365. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.Revtech)
  366. {
  367. if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232)
  368. {
  369. _BiasMatch = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VirgoDevice.BiasMatch}");
  370. }
  371. else if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.Ethernet)
  372. {
  373. _BiasMatch = DEVICE.GetDevice<RevtechMatch>($"{Module}.{VirgoDevice.BiasMatch}");
  374. }
  375. }
  376. if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&
  377. SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)
  378. {
  379. if (SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232)
  380. {
  381. if (SC.GetValue<int>($"{mod}.BiasMatch.AdTecBiasMatchModel") == 0)
  382. {
  383. _BiasMatch = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VirgoDevice.BiasMatch}");
  384. }
  385. if (SC.GetValue<int>($"{mod}.BiasMatch.AdTecBiasMatchModel") == 1)
  386. {
  387. _BiasMatch = DEVICE.GetDevice<AdTecMatchAMVG>($"{Module}.{VirgoDevice.BiasMatch}");
  388. }
  389. }
  390. }
  391. // RS232 Dry pump, SKY
  392. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  393. {
  394. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  395. {
  396. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VirgoDevice.MainPump}");
  397. }
  398. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  399. {
  400. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VirgoDevice.MainPump}");
  401. }
  402. }
  403. if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&
  404. SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232 &&
  405. SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)
  406. {
  407. _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VirgoDevice.Chiller}");
  408. }
  409. System.Diagnostics.Debug.Assert(null != _Generator);
  410. System.Diagnostics.Debug.Assert(null != _MainPump);
  411. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  412. {
  413. System.Diagnostics.Debug.Assert(null != _GeneratorBias);
  414. }
  415. WaferManager.Instance.SubscribeLocation(Module, 1);
  416. }
  417. public override bool Initialize()
  418. {
  419. base.Initialize();
  420. DATA.Subscribe($"{Name}.IoTemperatureCtrl.TemperatureControl.SubstrateTemperature", () => SubstrateTempFB);
  421. DATA.Subscribe($"{Module}.WaferSize", () => WaferManager.Instance.GetWafer(Module, 0).Size.ToString());
  422. DATA.Subscribe($"{Module}.EnableBiasRF", () => EnableBiasRF);
  423. return true;
  424. }
  425. // -----------------------------Method-------------------------
  426. //
  427. public override void Home()
  428. {
  429. // 与yp讨论过,PM 初始化不需要
  430. SetLiftPin(MovementPosition.Down, out _);
  431. //SetSlitDoor(false, out _);
  432. if (WaferManager.Instance.CheckNoWafer(Module, 0))
  433. {
  434. SetGuidePinSmall(MovementPosition.Down);
  435. SetGuidePinMedium(MovementPosition.Down);
  436. }
  437. if (IsSlitDoorClosed)
  438. {
  439. SetSlitDoor(false, out _);
  440. }
  441. else if (!IsSlitDoorClosed)
  442. {
  443. SetSlitDoor(false, out _);
  444. }
  445. else if (_slitDoor.State == CylinderState.Error)
  446. {
  447. SetSlitDoor(true, out _);
  448. }
  449. if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))
  450. {
  451. _Messager.SetMessager(1); //Virgo B
  452. }
  453. else
  454. {
  455. _Messager.SetMessager(0); //Virgo A
  456. }
  457. }
  458. public void SetSlitDoor(bool open, out string reason)
  459. {
  460. reason = string.Empty;
  461. // [XIAHUAN]: 只在关门的时候检查arm not extend
  462. if (!open && !IsArmNotExtend)
  463. {
  464. EV.PostAlarmLog(Module.ToString(), "Arm Not Extend 信号不满足");
  465. return;
  466. }
  467. _slitDoor.SetCylinder(open, out reason);
  468. }
  469. public override bool CheckWaterLeak()
  470. {
  471. return _WLK_sw.Value;
  472. }
  473. public override bool CheckCDAOK()
  474. {
  475. return _CDAPressure.Value;
  476. }
  477. public override bool CheckCoolantInletTCOK()
  478. {
  479. return _CoolantInletTC.Value;
  480. }
  481. public override bool CheckCoolantOutletTCOK()
  482. {
  483. return _CoolantOutletTC.Value;
  484. }
  485. public override bool CheckArmExtendOK()
  486. {
  487. return _ArmNotExtend.Value;
  488. }
  489. public override bool CheckAtm()
  490. {
  491. return _ATM_sw.Value && ChamberPressure > 700000;
  492. }
  493. public override bool CheckVacuum()
  494. {
  495. return _VAC_sw.Value && ChamberPressure < 100;
  496. }
  497. public bool CheckSlitDoorOpen()
  498. {
  499. return _slitDoor.State == CylinderState.Open;
  500. }
  501. public bool CheckSlitDoorClose()
  502. {
  503. return _slitDoor.State == CylinderState.Close;
  504. }
  505. public bool CheckLiftUp()
  506. {
  507. return _LiftPin.State == CylinderState.Open;
  508. }
  509. public bool CheckLiftDown()
  510. {
  511. return _LiftPin.State == CylinderState.Close;
  512. }
  513. public void StartPump(bool on)
  514. {
  515. //_pressureController.StartPump(on);
  516. _MainPump?.SetPumpOnOff(on);
  517. }
  518. public void SetValveOnOff(ValveType vlvType, bool on)
  519. {
  520. switch (vlvType)
  521. {
  522. case ValveType.PROCESS:
  523. _ProcessValve.TurnValve(on, out _);
  524. break;
  525. case ValveType.FAST_PUMP:
  526. _FastPumpValve.TurnValve(on, out _);
  527. break;
  528. case ValveType.SOFT_PUMP:
  529. _SoftPumpValve.TurnValve(on, out _);
  530. break;
  531. case ValveType.FAST_VENT:
  532. _FastVentValve.TurnValve(on, out _);
  533. break;
  534. case ValveType.PURGE:
  535. _PurgeValve.TurnValve(on, out _);
  536. break;
  537. case ValveType.Mfc1:
  538. _Mfc1Valve.TurnValve(on, out _);
  539. break;
  540. case ValveType.Mfc2:
  541. _Mfc2Valve.TurnValve(on, out _);
  542. break;
  543. case ValveType.Mfc3:
  544. _Mfc3Valve.TurnValve(on, out _);
  545. break;
  546. case ValveType.Mfc4:
  547. _Mfc4Valve.TurnValve(on, out _);
  548. break;
  549. case ValveType.Mfc5:
  550. _Mfc5Valve.TurnValve(on, out _);
  551. break;
  552. default:
  553. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  554. }
  555. }
  556. public void CheckPressureStability()
  557. {
  558. IsPressureToleranceEnabled = true;
  559. }
  560. public override void Monitor()
  561. {
  562. foreach (var gas in _gasLines)
  563. {
  564. gas.Monitor();
  565. }
  566. _trigBasePressure.CLK = ChamberPressurePressure >= BasePressure;
  567. if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller"))
  568. {
  569. _trigBaseTemperature.CLK = CoolantOutletTempFB >= BaseTemperature;
  570. }
  571. else
  572. {
  573. _trigBaseTemperature.CLK = SubstrateTempFB >= BaseTemperature;
  574. }
  575. if (_trigBasePressure.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, "PM pressure out of tolerance");
  576. if (_trigBaseTemperature.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, "PM temperature out of tolerance");
  577. _trigWaterFlowCloseChiller.CLK = SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") && !CheckWaterLeak() && _Chiller != null && _Chiller.IsRunning;
  578. if (_trigWaterFlowCloseChiller.Q)
  579. {
  580. Aitex.Core.RT.Log.LOG.Info("Turn off chiller by water leak");
  581. _Chiller.SetChillerOnOff(false);
  582. }
  583. }
  584. public void CloseValves()
  585. {
  586. _SoftPumpValve.TurnValve(false, out _);
  587. _FastPumpValve.TurnValve(false, out _);
  588. _ProcessValve.TurnValve(false, out _);
  589. _PurgeValve.TurnValve(false, out _);
  590. _FastVentValve.TurnValve(false, out _);
  591. _PurgeValve.TurnValve(false, out _);
  592. _Mfc1Valve.TurnValve(false, out _);
  593. _Mfc2Valve.TurnValve(false, out _);
  594. _Mfc3Valve.TurnValve(false, out _);
  595. _Mfc4Valve.TurnValve(false, out _);
  596. _Mfc5Valve.TurnValve(false, out _);
  597. foreach (var stick in _gasLines)
  598. {
  599. stick.Stop();
  600. }
  601. }
  602. public bool FlowGas(int gasNum, double val)
  603. {
  604. if (_gasLines.Length <= gasNum)
  605. return false;
  606. _gasLines[gasNum].Flow(val);
  607. return true;
  608. }
  609. public void StopAllGases()
  610. {
  611. foreach (var line in _gasLines)
  612. {
  613. line.Stop();
  614. }
  615. }
  616. public bool SetLiftPin(MovementPosition dirt, out string reason)
  617. {
  618. reason = string.Empty;
  619. switch (dirt)
  620. {
  621. case MovementPosition.Down:
  622. return _LiftPin.SetCylinder(false, out reason);
  623. case MovementPosition.Up:
  624. return _LiftPin.SetCylinder(true, out reason);
  625. case MovementPosition.Left:
  626. case MovementPosition.Right:
  627. case MovementPosition.Middle:
  628. throw new ArgumentException("Movement argument error");
  629. }
  630. return true;
  631. }
  632. public void SetGuidePin(WaferSize ws, MovementPosition dirt)
  633. {
  634. if (ws == WaferSize.WS3)
  635. SetGuidePinSmall(dirt);
  636. else if (ws == WaferSize.WS4)
  637. SetGuidePinMedium(dirt);
  638. }
  639. public void PrepareGuidePinForPlace(WaferSize ws)
  640. {
  641. if (ws == WaferSize.WS3)
  642. {
  643. SetGuidePinSmall(MovementPosition.Up);
  644. SetGuidePinMedium(MovementPosition.Down);
  645. }
  646. else if (ws == WaferSize.WS4)
  647. {
  648. SetGuidePinSmall(MovementPosition.Down);
  649. SetGuidePinMedium(MovementPosition.Up);
  650. }
  651. else if (ws == WaferSize.WS6)
  652. {
  653. SetGuidePinSmall(MovementPosition.Down);
  654. SetGuidePinMedium(MovementPosition.Down);
  655. }
  656. }
  657. public bool CheckGuidePinIsReadyForTransfer(WaferSize ws)
  658. {
  659. if (ws == WaferSize.WS3)
  660. {
  661. return SmallPosition == MovementPosition.Up && MediumPosition == MovementPosition.Down;
  662. }
  663. else if (ws == WaferSize.WS4)
  664. {
  665. return SmallPosition == MovementPosition.Down && MediumPosition == MovementPosition.Up;
  666. }
  667. else if (ws == WaferSize.WS6)
  668. {
  669. return SmallPosition == MovementPosition.Down && MediumPosition == MovementPosition.Down;
  670. }
  671. //else if (ws == WaferSize.WS8)
  672. //{
  673. // return SmallPosition == MovementPosition.Down && MediumPosition == MovementPosition.Down;
  674. //}
  675. else
  676. return false;
  677. }
  678. private void SetGuidePinSmall(MovementPosition dirt)
  679. {
  680. if (_smallGuidePinEnable)
  681. {
  682. EV.PostInfoLog(Module.ToString(), $"set small pin {dirt}, smallWafer={_smallWafer}");
  683. switch (dirt)
  684. {
  685. case MovementPosition.Down:
  686. if (_smallWafer != 0)
  687. _PinSmall?.SetCylinder(false, out _);
  688. break;
  689. case MovementPosition.Up:
  690. if (_smallWafer != 0)
  691. _PinSmall?.SetCylinder(true, out _);
  692. break;
  693. default:
  694. throw new ArgumentException("Movement argument error");
  695. }
  696. }
  697. else
  698. {
  699. _smallGuidePinDummyPos = dirt;
  700. }
  701. }
  702. private void SetGuidePinMedium(MovementPosition dirt)
  703. {
  704. if(_mediumGuidePinEnable)
  705. {
  706. EV.PostInfoLog(Module.ToString(), $"set medium pin {dirt}, midWafer={_midWafer}");
  707. switch (dirt)
  708. {
  709. case MovementPosition.Down:
  710. if (_midWafer != 0)
  711. _PinMedium?.SetCylinder(false, out _);
  712. break;
  713. case MovementPosition.Up:
  714. if (_midWafer != 0)
  715. _PinMedium?.SetCylinder(true, out _);
  716. break;
  717. default:
  718. throw new ArgumentException("Movement argument error");
  719. }
  720. }
  721. else
  722. {
  723. _mediumGuidePinDummyPos = dirt;
  724. }
  725. }
  726. public void SetGeneratorCommunicationMode(int mode)
  727. {
  728. _Generator?.SetCommunicationMode(mode);
  729. }
  730. public bool GeneratorPowerOn(bool on)
  731. {
  732. if (_Generator == null) return false;
  733. if (on && !IsRFGInterlockOn)
  734. {
  735. EV.PostAlarmLog(Module.ToString(), "射频电源 Interlock条件不满足");
  736. return false;
  737. }
  738. return _Generator.SetPowerOnOff(on, out _);
  739. }
  740. public bool GeneratorSetpower(float val)
  741. {
  742. if (_Generator == null) return false;
  743. if (Math.Abs(val) > 0.01)
  744. _Generator.SetPower((ushort)val);
  745. return true;
  746. }
  747. public bool GeneratorBiasPowerOn(bool on)
  748. {
  749. if (_GeneratorBias == null) return false;
  750. if (on && !IsRFGInterlockOn)
  751. {
  752. EV.PostAlarmLog(Module.ToString(), "Bias射频电源 Interlock条件不满足");
  753. return false;
  754. }
  755. return _GeneratorBias.SetPowerOnOff(on, out _);
  756. }
  757. public bool GeneratorBiasSetpower(float val)
  758. {
  759. if (_GeneratorBias == null) return false;
  760. if (Math.Abs(val) > 0.01)
  761. _GeneratorBias.SetPower((ushort)val);
  762. return true;
  763. }
  764. public bool GeneratorBiasSetMatchMode(bool val)
  765. {
  766. if (_BiasMatch != null)
  767. {
  768. _BiasMatch.SetMatchMode(true ? EnumRfMatchTuneMode.Auto.ToString() : EnumRfMatchTuneMode.Manual.ToString(), out _);
  769. return true;
  770. }
  771. if (_GeneratorBias == null) return false;
  772. string reason = string.Empty;
  773. _GeneratorBias.SetMatchingAutoMode(val, out reason);
  774. return true;
  775. }
  776. public bool SetMatchPosition(float c1, float c2)
  777. {
  778. if (_Match == null) return false;
  779. string reason = string.Empty;
  780. _Match.SetMatchPosition(c1, c2, out reason);
  781. return true;
  782. }
  783. public bool SetBiasMatchPosition(float c1, float c2)
  784. {
  785. if (_BiasMatch != null)
  786. {
  787. _BiasMatch.SetMatchPosition(c1, c2, out _);
  788. return true;
  789. }
  790. if (_GeneratorBias == null) return false;
  791. string reason = string.Empty;
  792. _GeneratorBias.SetMatchPosition(c1, c2, out reason);
  793. return true;
  794. }
  795. public void FullOpenTV()
  796. {
  797. _pressureController.FullOpenThrottleValve();
  798. }
  799. public void HeatSubstrate(double val)
  800. {
  801. _SubstrateTC?.RampTemp((float)val);
  802. _SubstrateTC?.TurnOnOff(true);
  803. }
  804. public void HeatChiller(double value, double offset)
  805. {
  806. _Chiller?.SetChillerTemp((float)value, (float)offset);
  807. _Chiller?.SetChillerOnOff(true);
  808. }
  809. public bool CheckChillerStatus()
  810. {
  811. return _Chiller != null && _Chiller.IsRunning && !_Chiller.IsError;
  812. }
  813. public void HeatForeline(double val)
  814. {
  815. _ForelineTC?.RampTemp((float)val);
  816. }
  817. public override bool CheckEnableTransfer(EnumTransferType type)
  818. {
  819. if (type == EnumTransferType.Pick)
  820. {
  821. return _slitDoor.State == CylinderState.Open && _LiftPin.State == CylinderState.Open;
  822. }
  823. if (type == EnumTransferType.Place)
  824. {
  825. return _slitDoor.State == CylinderState.Open && _LiftPin.State == CylinderState.Close;
  826. }
  827. return false;
  828. }
  829. public bool CheckEnableTransfer(EnumTransferType type, WaferSize waferSize)
  830. {
  831. bool guidePinIsOk = CheckGuidePinIsReadyForTransfer(waferSize);
  832. bool pressureIsOk = CheckSlitDoorOpen() || IsATM;
  833. if (type == EnumTransferType.Pick)
  834. {
  835. return _LiftPin.State == CylinderState.Open && pressureIsOk
  836. && CheckGuidePinIsReadyForTransfer(waferSize);
  837. }
  838. if (type == EnumTransferType.Place)
  839. {
  840. return _LiftPin.State == CylinderState.Close && pressureIsOk
  841. && CheckGuidePinIsReadyForTransfer(waferSize);
  842. }
  843. return false;
  844. }
  845. public override void TransferHandoff(EnumTransferType type)
  846. {
  847. switch (type)
  848. {
  849. case EnumTransferType.Pick:
  850. SetLiftPin(MovementPosition.Up, out _);
  851. break;
  852. case EnumTransferType.Place:
  853. SetLiftPin(MovementPosition.Down, out _);
  854. break;
  855. case EnumTransferType.Extend:
  856. break;
  857. case EnumTransferType.Retract:
  858. break;
  859. default:
  860. break;
  861. }
  862. }
  863. public override void Reset()
  864. {
  865. _trigBasePressure.RST = true;
  866. _trigBaseTemperature.RST = true;
  867. }
  868. }
  869. /// <summary>
  870. /// PM Action
  871. /// </summary>
  872. abstract class PmActionBase : ActionBase
  873. {
  874. protected internal JetPM _chamber;
  875. protected PmActionBase(ModuleName mod, JetPM pm) : base(mod)
  876. {
  877. _chamber = pm;
  878. }
  879. }
  880. class PinAction : PmActionBase
  881. {
  882. public MovementPosition Pos { get; }
  883. public bool IsWaferTransfered { get; }
  884. public PMEntity PmEntity { get; set; }
  885. private Hand _blade;
  886. private bool _isPick;
  887. private bool _delay;
  888. public PinAction(ModuleName mod, JetPM pm, MovementPosition pos, bool isTransferWafer, Hand blade, bool isPick, bool isDelay) : base(mod, pm)
  889. {
  890. this.Pos = pos;
  891. IsWaferTransfered = isTransferWafer;
  892. _blade = blade;
  893. _isPick = isPick;
  894. _delay = isDelay;
  895. }
  896. public override void Execute()
  897. {
  898. if (Module == ModuleName.PMA)
  899. PmEntity = Singleton<RouteManager>.Instance.PMA;
  900. else if (Module == ModuleName.PMB)
  901. PmEntity = Singleton<RouteManager>.Instance.PMB;
  902. if (PmEntity != null)
  903. {
  904. EV.PostInfoLog(Module.ToString(), $"开始执行 Delayrecorder");
  905. PmEntity.PostMsg(PMEntity.MSG.MoveLiftPin, Pos, ID, _isPick, _delay);
  906. }
  907. }
  908. public override void OnPostWork(string data = null)
  909. {
  910. if (IsWaferTransfered)
  911. {
  912. if (Pos == MovementPosition.Up)
  913. {
  914. WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, _blade==Hand.Blade1 ? 0 : 1, Module, 0);
  915. }
  916. else
  917. {
  918. WaferManager.Instance.WaferMoved(Module, 0, ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1);
  919. }
  920. }
  921. }
  922. }
  923. class SlitDoorAction : PmActionBase
  924. {
  925. public PMEntity PmEntity { get; set; }
  926. private bool _isOpen;
  927. public SlitDoorAction(ModuleName mod, JetPM pm, bool isOpen ) : base(mod, pm)
  928. {
  929. _isOpen = isOpen;
  930. }
  931. public override void Execute()
  932. {
  933. if (Module == ModuleName.PMA)
  934. PmEntity = Singleton<RouteManager>.Instance.PMA;
  935. else if (Module == ModuleName.PMB)
  936. PmEntity = Singleton<RouteManager>.Instance.PMB;
  937. if (PmEntity != null)
  938. {
  939. if (_isOpen)
  940. {
  941. PmEntity.PostMsg(PMEntity.MSG.OpenSlitDoor, ID );
  942. }
  943. else
  944. {
  945. PmEntity.PostMsg(PMEntity.MSG.CloseSlitDoor, ID);
  946. }
  947. }
  948. }
  949. public override void OnPostWork(string data = null)
  950. {
  951. }
  952. }
  953. }