JetPM.cs 42 KB

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