JetPM.cs 41 KB

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