JetPM.cs 38 KB

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