JetDualPM.cs 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Aitex.Core.Common;
  8. using Aitex.Core.Common.DeviceData;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Device;
  11. using Aitex.Core.RT.Device.Unit;
  12. using Aitex.Core.RT.Event;
  13. using Aitex.Core.RT.Log;
  14. using Aitex.Core.RT.SCCore;
  15. using Aitex.Core.Util;
  16. using Aitex.Sorter.Common;
  17. using JetVirgoPM.PMs;
  18. using JetVirgoPM.PMs.Routines;
  19. using MECF.Framework.Common.Device.Bases;
  20. using MECF.Framework.Common.Equipment;
  21. using MECF.Framework.Common.Schedulers;
  22. using MECF.Framework.Common.SubstrateTrackings;
  23. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  24. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump;
  25. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.SkyPump;
  26. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.JEL;
  27. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Rorze;
  28. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  29. namespace JetVirgoPM.Devices
  30. {
  31. enum ValveType
  32. {
  33. PROCESS,
  34. N2,
  35. FAST_PUMP,
  36. SOFT_PUMP,
  37. FAST_VENT,
  38. PURGE,
  39. Mfc1,
  40. Mfc2,
  41. Mfc3,
  42. Mfc4,
  43. Mfc5,
  44. Mfc6,
  45. }
  46. class JetDualPM : DualPM
  47. {
  48. // ----------------------------Fields--------------------------
  49. //
  50. private readonly IoLid _Lid;
  51. //private readonly IoCylinder _LidLocker;
  52. private readonly IoMessage _Messager;
  53. private readonly IoSensor _ATM_sw;
  54. private readonly IoSensor _VAC_sw;
  55. //private readonly IoSensor _WLK_sw;
  56. //private readonly IoSensor _CDAPressure;
  57. private readonly IoSensor _CoolantInletTC1;
  58. private readonly IoSensor _CoolantInletTC2;
  59. private readonly IoSensor _CoolantOutletTC1;
  60. private readonly IoSensor _CoolantOutletTC2;
  61. //private readonly IoSensor _ArmNotExtend;
  62. private readonly IoSensor _N2Pressure_sw;
  63. private readonly IoSensor _LEOT1;
  64. private readonly IoSensor _LEOT2;
  65. private readonly IoSensor _GBInterlock;
  66. private readonly IoSensor _TMRobotNotExtendToPM1;
  67. private readonly IoSensor _TMRobotNotExtendToPM2;
  68. private readonly IoSensor _TMInSafety;
  69. private readonly IoSensor _CHBOTSW;
  70. private readonly IoSensor _SourceFan;
  71. private readonly IoSensor _GeneratorInterlock;
  72. private readonly IoSensor _SensorWaterFlowOk1;
  73. private readonly IoSensor _SensorWaterFlowOk2;
  74. //private readonly IoSensor _RFG_Interlock;
  75. private readonly IoPressureControl _pressureController;
  76. private readonly IoHeater _ChamberHeater1;
  77. private readonly IoHeater _HeaterChamber;
  78. private readonly IoHeater _ForelineHeater;
  79. private readonly IoHeater _LEHeater1;
  80. private readonly IoHeater _LEHeater2;
  81. private readonly IoValve _SoftPumpValve;
  82. private readonly IoValve _FastPumpValve;
  83. private readonly IoValve _ProcessValve;
  84. private readonly IoValve _N2Valve;
  85. private readonly IoValve _PurgeValve;
  86. private readonly IoValve _FastVentValve;
  87. private readonly IoValve _Mfc1Valve;
  88. private readonly IoValve _Mfc2Valve;
  89. private readonly IoValve _Mfc3Valve;
  90. private readonly IoValve _Mfc4Valve;
  91. private readonly IoValve _Mfc5Valve;
  92. private readonly IoValve _Mfc6Valve;
  93. //private readonly IoValve _N2SupplyValve;
  94. private readonly IoCylinder _slitDoor1;
  95. private readonly IoCylinder _slitDoor2;
  96. private readonly IoCylinder _LiftPin1;
  97. private readonly IoCylinder _LiftPin2;
  98. private readonly IoCylinder _GuidePin1; // 3'
  99. private readonly IoCylinder _GuidePin2; // 4'
  100. private readonly RfPowerBase _Generator1;
  101. private readonly RfPowerBase _Generator2;
  102. private readonly RfPowerBase _GeneratorBias1;
  103. private readonly RfPowerBase _GeneratorBias2;
  104. private readonly RfMatchBase _Match1;
  105. private readonly RfMatchBase _Match2;
  106. private readonly PumpBase _MainPump;
  107. private readonly ChillerBase _Chiller1;
  108. private readonly ChillerBase _Chiller2;
  109. private readonly IoGasStick[] _gasLines;
  110. private bool[] _mfcValveStatus => new bool[] {
  111. _Mfc1Valve.Status,_Mfc2Valve.Status,_Mfc3Valve.Status,_Mfc4Valve.Status,_Mfc5Valve.Status,_Mfc6Valve.Status
  112. };
  113. private bool _isAllGasValveOff => _mfcValveStatus != null && _mfcValveStatus.Length > 0 && _mfcValveStatus.All(p => !p);
  114. private bool _isAnyWaterFlowOff => (_SensorWaterFlowOk1 != null && !_SensorWaterFlowOk1.Value) || (_SensorWaterFlowOk2 != null && !_SensorWaterFlowOk2.Value);
  115. private bool _isRFGasInterlockOff => _GBInterlock != null && !_GBInterlock.Value;
  116. private readonly R_TRIG _trigBasePressure = new R_TRIG();
  117. private readonly R_TRIG _trigBaseTemperature1 = new R_TRIG();
  118. private readonly R_TRIG _trigBaseTemperature2 = new R_TRIG();
  119. private readonly RD_TRIG _trigRfInterlock = new RD_TRIG();
  120. private readonly DeviceTimer _timerRFTurnOff = new DeviceTimer();
  121. private double BasePressure;
  122. private double BaseTemperature;
  123. private int _bigWafer = 0;
  124. private int _midWafer = 0;
  125. private int _smallWafer = 0;
  126. private int gasCount = 0;
  127. public bool _Chamber1Disabled;
  128. public bool _Chamber2Disabled;
  129. private bool _guidePinInstalled;
  130. public bool GuidePinInstalled
  131. {
  132. get { return _guidePinInstalled; }
  133. }
  134. public bool AlarmPro = false;
  135. // --------------------------Properties------------------------
  136. //
  137. public new ModuleName Module { get; }
  138. // 门的状态
  139. public bool IsSlitDoor1Closed => !_slitDoor1.ONFeedback && _slitDoor1.OFFFeedback;
  140. public bool IsSlitDoor2Closed => !_slitDoor2.ONFeedback && _slitDoor2.OFFFeedback;
  141. public bool IsTMRobotNotExtendToPM1 => _TMRobotNotExtendToPM1.Value;
  142. public bool IsTMRobotNotExtendToPM2 => _TMRobotNotExtendToPM2.Value;
  143. // 盖子的状态
  144. public bool IsLidClosed => _Lid.OFFFeedback;
  145. // 盖子的锁
  146. //public bool IsLidLocked => !_LidLocker.ONSetPoint && _LidLocker.OFFSetPoint;
  147. public MovementPosition LiftPinPosition
  148. {
  149. get
  150. {
  151. MovementPosition pos = MovementPosition.Unknown;
  152. if (_LiftPin1.ONFeedback && !_LiftPin1.OFFFeedback)
  153. {
  154. pos = MovementPosition.Up;
  155. }
  156. else if (!_LiftPin1.ONFeedback && _LiftPin1.OFFFeedback)
  157. {
  158. pos = MovementPosition.Down;
  159. }
  160. return pos;
  161. }
  162. }
  163. public MovementPosition GuidePin1Position
  164. {
  165. get
  166. {
  167. if (_midWafer == 0)
  168. return MovementPosition.Down;
  169. MovementPosition res = MovementPosition.Unknown;
  170. if (_GuidePin1.ONFeedback && !_GuidePin1.OFFFeedback)
  171. {
  172. res = MovementPosition.Up;
  173. }
  174. else if (_GuidePin1.OFFFeedback && !_GuidePin1.ONFeedback)
  175. {
  176. res = MovementPosition.Down;
  177. }
  178. return res;
  179. }
  180. }
  181. public MovementPosition GuidePin2Position
  182. {
  183. get
  184. {
  185. if (_midWafer == 0)
  186. return MovementPosition.Down;
  187. MovementPosition res = MovementPosition.Unknown;
  188. if (_GuidePin2.ONFeedback && !_GuidePin2.OFFFeedback)
  189. {
  190. res = MovementPosition.Up;
  191. }
  192. else if (_GuidePin2.OFFFeedback && !_GuidePin2.ONFeedback)
  193. {
  194. res = MovementPosition.Down;
  195. }
  196. return res;
  197. }
  198. }
  199. public bool Chamber1Disable => _Chamber1Disabled;
  200. public bool Chamber2Disable => _Chamber2Disabled;
  201. private bool _epdIsEnable;
  202. public bool EPDIsEnable => _epdIsEnable;
  203. private bool _biasRf1Enable;
  204. public bool BiasRf1Enable => _biasRf1Enable;
  205. private bool _biasRf2Enable;
  206. public bool BiasRf2Enable => _biasRf2Enable;
  207. private bool _chiller1Enable;
  208. public bool Chiller1Enable => _chiller1Enable;
  209. private bool _chiller2Enable;
  210. public bool Chiller2Enable => _chiller2Enable;
  211. public override bool IsError
  212. {
  213. get
  214. {
  215. bool IsGeneratorBias1Error = _biasRf1Enable && _GeneratorBias1.IsError;
  216. bool IsGeneratorBias2Error = _biasRf2Enable && _GeneratorBias2.IsError;
  217. return _MainPump.IsError || _Generator1.IsError || _Generator2.IsError || IsGeneratorBias1Error || IsGeneratorBias2Error;
  218. }
  219. }
  220. public override bool IsIdle { get; }
  221. // 腔体压力
  222. public bool IsPressureToleranceEnabled
  223. {
  224. get => _pressureController.EnableTolerance;
  225. set => _pressureController.EnableTolerance = value;
  226. }
  227. public override double ChamberPressure => _pressureController.ProcessGauge.Value;
  228. public override double ChamberPressurePressure => _pressureController.PressureGauge.Value;
  229. public double ForelinePressure => _pressureController.ForelineGauge.Value;
  230. public PressureCtrlMode PressureMode => _pressureController.ThrottleValve.PressureMode;
  231. public double TargetPressure => _pressureController.TargetPressure;
  232. // 压力信号
  233. public bool IsATM => _ATM_sw.Value;
  234. public bool IsVAC => _VAC_sw.Value;
  235. //public bool IsWLK => _WLK_sw.Value;
  236. public bool IsGeneratorInterlockOk => _GeneratorInterlock.Value;
  237. // 温度
  238. public float ChamberTempSP1 => _ChamberHeater1.ControlTcSetPoint;
  239. public float ChamberTempFB1 => _ChamberHeater1.ControlTcFeedback;
  240. public float CoolantInletTempFB1 => _ChamberHeater1.CoolantInletTcFeedback;
  241. public float CoolantOutletTempFB1 => _ChamberHeater1.CoolantOutletTcFeedback;
  242. public float ChamberTempSP2 => _HeaterChamber.ControlTcSetPoint;
  243. public float ChamberTempFB2 => _HeaterChamber.ControlTcFeedback;
  244. public float CoolantInletTempFB2 => _HeaterChamber.CoolantInletTcFeedback;
  245. public float CoolantOutletTempFB2 => _HeaterChamber.CoolantOutletTcFeedback;
  246. // LE温度
  247. public float LETempSP1 => _LEHeater1.ControlTcSetPoint;
  248. public float LETempFB1 => _LEHeater1.ControlTcFeedback;
  249. public string LETempFB1Name => _LEHeater1.Name;
  250. public float LECoolantInletTempFB1 => _LEHeater1.CoolantInletTcFeedback;
  251. public float LECoolantOutletTempFB1 => _LEHeater1.CoolantOutletTcFeedback;
  252. public float LETempSP2 => _LEHeater2.ControlTcSetPoint;
  253. public float LETempFB2 => _LEHeater2.ControlTcFeedback;
  254. public string LETempFB2Name => _LEHeater2.Name;
  255. public float LECoolantInletTempFB2 => _LEHeater2.CoolantInletTcFeedback;
  256. public float LECoolantOutletTempFB2 => _LEHeater2.CoolantOutletTcFeedback;
  257. public bool LETemp1ON => _LEHeater1.IsPowerOnFeedback;
  258. public bool LETemp2ON => _LEHeater2.IsPowerOnFeedback;
  259. // Pump 状态
  260. public bool IsPumpRunning => _MainPump.IsRunning;
  261. public bool IsFastPumpOpened => _FastPumpValve.Status;
  262. public bool IsSoftPumpOpened => _SoftPumpValve.Status;
  263. public bool IsMfc1ValveOpened => _Mfc1Valve.Status;
  264. public bool IsMfc2ValveOpened => _Mfc2Valve.Status;
  265. public bool IsMfc3ValveOpened => _Mfc3Valve.Status;
  266. public bool IsMfc4ValveOpened => _Mfc4Valve.Status;
  267. public bool IsMfc5ValveOpened => _Mfc5Valve.Status;
  268. public bool IsMfc6ValveOpened => _Mfc6Valve.Status;
  269. public bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;
  270. //public bool IsCDA_OK => _CDAPressure.Value;
  271. public bool IsCoolantInletTC_OK1 => _CoolantInletTC1.Value;
  272. public bool IsCoolantInletTC_OK2 => _CoolantInletTC2.Value;
  273. public bool IsCoolantOutletTC_OK1 => _CoolantOutletTC1.Value;
  274. public bool IsCoolantOutletTC_OK2 => _CoolantOutletTC2.Value;
  275. // interlock
  276. public bool NotHasInterlock => AlarmPro ? _GBInterlock.Value : _GBInterlock.Value && _GeneratorInterlock.Value;
  277. public bool NotHasInterlockWithOutGeneratorInterlock => _GBInterlock.Value;
  278. // 蝶阀位置
  279. public float TVPosition => _pressureController.ThrottleValve.PositionFeedback;
  280. // 腔体压力.end
  281. // 射频1
  282. public float Generator1ForwardPower => _Generator1.ForwardPower;
  283. public bool IsGenerator1ON => _Generator1 != null && _Generator1.IsPowerOn;
  284. public float Generator1Setpoint => _Generator1.PowerSetPoint;
  285. // 射频 2
  286. public float Generator2ForwardPower => _Generator2.ForwardPower;
  287. public bool IsGenerator2ON => _Generator2 != null && _Generator2.IsPowerOn;
  288. public float Generator2Setpoint => _Generator2.PowerSetPoint;
  289. // Bias射频1
  290. public float ForwardPowerBias1 => _GeneratorBias1.ForwardPower;
  291. public bool IsGeneratorONBias1 => _GeneratorBias1 != null && _GeneratorBias1.IsPowerOn;
  292. public float GeneratorSetpointBias1 => _GeneratorBias1.PowerSetPoint;
  293. public float CTune1 => _GeneratorBias1.CTune;
  294. public float CLoad1 => _GeneratorBias1.CLoad;
  295. public int VPP1 => _GeneratorBias1.VPP;
  296. // Bias射频2
  297. public float ForwardPowerBias2 => _GeneratorBias2.ForwardPower;
  298. public bool IsGeneratorONBias2 => _GeneratorBias2 != null && _GeneratorBias2.IsPowerOn;
  299. public float GeneratorSetpointBias2 => _GeneratorBias2.PowerSetPoint;
  300. public float CTune2 => _GeneratorBias2.CTune;
  301. public float CLoad2 => _GeneratorBias2.CLoad;
  302. public int VPP2 => _GeneratorBias2.VPP;
  303. // 流气
  304. public double TotalGasSetpoint
  305. {
  306. get
  307. {
  308. double sum = 0;
  309. foreach (var gas in _gasLines)
  310. {
  311. sum += gas.FlowSP;
  312. }
  313. return sum;
  314. }
  315. }
  316. public bool HasGasOutOfRange
  317. {
  318. get
  319. {
  320. foreach (var gas in _gasLines)
  321. {
  322. if (!gas.IsOutOfRange)
  323. return false;
  324. }
  325. return true;
  326. }
  327. }
  328. // --------------------------Constructor-----------------------
  329. //
  330. public JetDualPM(ModuleName mod) : base(mod.ToString())
  331. {
  332. Module = mod;
  333. AlarmPro = SC.GetValue<bool>($"System.SetUp.AlarmPro.IsInstalled");
  334. _Chamber1Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber1Disabled.IsInstalled");
  335. _Chamber2Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber2Disabled.IsInstalled");
  336. _guidePinInstalled = SC.GetValueOrDefault<bool>($"{Module}.GuidePin.IsInstalled");
  337. _epdIsEnable = SC.GetValue<bool>($"{Module}.EPD.IsEnabled");
  338. _biasRf1Enable = SC.GetValue<bool>($"{Module}.BiasRf1.EnableBiasRF");
  339. _biasRf2Enable = SC.GetValue<bool>($"{Module}.BiasRf2.EnableBiasRF");
  340. _chiller1Enable = SC.GetValue<bool>($"{Module}.Chiller1.EnableChiller");
  341. _chiller2Enable = SC.GetValue<bool>($"{Module}.Chiller2.EnableChiller");
  342. BasePressure = SC.GetValue<double>($"{mod}.ChamberBasePressureThreshold");
  343. BaseTemperature = SC.GetValue<double>($"{mod}.ChamberBaseTemperatureThreshold");
  344. _smallWafer = SC.GetValue<int>($"System.SmallWafer");
  345. _midWafer = SC.GetValue<int>($"System.MidWafer");
  346. _bigWafer = SC.GetValue<int>($"System.BigWafer");
  347. for (int i = 1; i <= 6; i++)
  348. {
  349. if (SC.GetValue<bool>($"{Module}.MfcGas{i}.Enable")) gasCount++;
  350. }
  351. //_gasLines = new IoGasStick[gasCount];
  352. _gasLines = new IoGasStick[6];
  353. //for (int index = 0; index < gasCount; index++)
  354. //{
  355. // _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  356. //}
  357. for (int index = 0; index < 6; index++)
  358. {
  359. _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");
  360. }
  361. //_LidLocker = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.LidLocker}");
  362. //_CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
  363. //_ArmNotExtend = DEVICE.GetDevice<IoSensor>($"{Module}.SensorArmNotExtend");
  364. //_RFG_Interlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  365. #region CHECKDED
  366. _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VirgoDevice.Lid}");
  367. _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");
  368. _VAC_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");
  369. _CoolantInletTC1 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantInletTCOK1");
  370. _CoolantInletTC2 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantInletTCOK2");
  371. _CoolantOutletTC1 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantOutletTCOK1");
  372. _CoolantOutletTC2 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCoolantOutletTCOK2");
  373. //_WLK_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");
  374. _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");
  375. _LEOT1 = DEVICE.GetDevice<IoSensor>($"{Module}.LE_OT1");
  376. _LEOT2 = DEVICE.GetDevice<IoSensor>($"{Module}.LE_OT2");
  377. _GBInterlock = DEVICE.GetDevice<IoSensor>($"{Module}.GB_Interlock");
  378. _TMRobotNotExtendToPM1 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorTMRobotNotExtendToPM1");
  379. _TMRobotNotExtendToPM2 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorTMRobotNotExtendToPM2");
  380. _TMInSafety = DEVICE.GetDevice<IoSensor>($"{Module}.SensorTMInSafety");
  381. _CHBOTSW = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCHBOTSW");
  382. _SourceFan = DEVICE.GetDevice<IoSensor>($"{Module}.SourceFan");
  383. _GeneratorInterlock = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");
  384. _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VirgoDevice.PressureControl}");
  385. _ChamberHeater1 = DEVICE.GetDevice<IoHeater>($"{Module}.HeaterChamber1");
  386. _HeaterChamber = DEVICE.GetDevice<IoHeater>($"{Module}.HeaterChamber");
  387. _ForelineHeater = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
  388. _LEHeater1 = DEVICE.GetDevice<IoHeater>($"{Module}.LEHeater1");
  389. _LEHeater2 = DEVICE.GetDevice<IoHeater>($"{Module}.LEHeater2");
  390. _SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveSoftPumping}");
  391. _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveFastPumping}");
  392. _ProcessValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveProcess}");
  393. _N2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveN2}");
  394. _FastVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveFastVent}");
  395. _PurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveChamberPurge}");
  396. _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc1}");
  397. _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc2}");
  398. _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc3}");
  399. _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc4}");
  400. _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc5}");
  401. _Mfc6Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VirgoDevice.ValveMfc6}");
  402. _slitDoor1 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.SlitDoor1}");
  403. _slitDoor2 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.SlitDoor2}");
  404. _LiftPin1 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.LiftPin1}");
  405. _LiftPin2 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.LiftPin2}");
  406. _GuidePin1 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.GuidePin1}");
  407. _GuidePin2 = DEVICE.GetDevice<IoCylinder>($"{Module}.{VirgoDevice.GuidePin2}");
  408. _Messager = DEVICE.GetDevice<IoMessage>($"{Module}.Messager");
  409. _Generator1 = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.Rf1}");
  410. _Generator2 = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.Rf2}");
  411. _GeneratorBias1 = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.BiasRf1}");
  412. _GeneratorBias2 = DEVICE.GetDevice<IoRf>($"{Module}.{VirgoDevice.BiasRf2}");
  413. _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VirgoDevice.MainPump}");
  414. _Chiller1 = DEVICE.GetDevice<ChillerBase>($"{Module}.{VirgoDevice.Chiller1}");
  415. _Chiller2 = DEVICE.GetDevice<ChillerBase>($"{Module}.{VirgoDevice.Chiller2}");
  416. _SensorWaterFlowOk1 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk1");
  417. _SensorWaterFlowOk2 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk2");
  418. #endregion
  419. // RS223 Generator
  420. if (SC.GetValue<int>($"{mod}.Rf1.CommunicationType") == (int)CommunicationType.RS232)
  421. {
  422. if (SC.GetValue<int>($"{mod}.Rf1.MFG") == (int)GeneratorMFG.AdTec)
  423. {
  424. _Generator1 = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.Rf1}");
  425. }
  426. else if (SC.GetValue<int>($"{mod}.Rf1.MFG") == (int)GeneratorMFG.Wattsine)
  427. {
  428. _Generator1 = DEVICE.GetDevice<MicrowareRF>($"{Module}.{VirgoDevice.Rf1}");
  429. }
  430. }
  431. // RS223 Generator
  432. if (SC.GetValue<int>($"{mod}.Rf2.CommunicationType") == (int)CommunicationType.RS232)
  433. {
  434. if (SC.GetValue<int>($"{mod}.Rf2.MFG") == (int)GeneratorMFG.AdTec)
  435. {
  436. _Generator2 = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.Rf2}");
  437. }
  438. else if (SC.GetValue<int>($"{mod}.Rf2.MFG") == (int)GeneratorMFG.Wattsine)
  439. {
  440. _Generator2 = DEVICE.GetDevice<MicrowareRF>($"{Module}.{VirgoDevice.Rf2}");
  441. }
  442. }
  443. // RS223 AdTec Generator Bias 1
  444. if (SC.GetValue<bool>($"{mod}.BiasRf1.EnableBiasRF") &&
  445. SC.GetValue<int>($"{mod}.BiasRf1.CommunicationType") == (int)CommunicationType.RS232 &&
  446. SC.GetValue<int>($"{mod}.BiasRf1.MFG") == (int)GeneratorMFG.AdTec)
  447. {
  448. _GeneratorBias1 = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.BiasRf1}");
  449. }
  450. // RS223 AdTec Generator Bias 2
  451. if (SC.GetValue<bool>($"{mod}.BiasRf2.EnableBiasRF") &&
  452. SC.GetValue<int>($"{mod}.BiasRf2.CommunicationType") == (int)CommunicationType.RS232 &&
  453. SC.GetValue<int>($"{mod}.BiasRf2.MFG") == (int)GeneratorMFG.AdTec)
  454. {
  455. _GeneratorBias2 = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VirgoDevice.BiasRf2}");
  456. }
  457. // Ethernet Comet Generator Bias 1
  458. if (SC.GetValue<bool>($"{mod}.BiasRf1.EnableBiasRF") &&
  459. SC.GetValue<int>($"{mod}.BiasRf1.CommunicationType") == (int)CommunicationType.Ethernet &&
  460. SC.GetValue<int>($"{mod}.BiasRf1.MFG") == (int)GeneratorMFG.Comet)
  461. {
  462. _GeneratorBias1 = DEVICE.GetDevice<CometRF>($"{Module}.{VirgoDevice.BiasRf1}");
  463. }
  464. // Ethernet Comet Generator Bias 2
  465. if (SC.GetValue<bool>($"{mod}.BiasRf2.EnableBiasRF") &&
  466. SC.GetValue<int>($"{mod}.BiasRf2.CommunicationType") == (int)CommunicationType.Ethernet &&
  467. SC.GetValue<int>($"{mod}.BiasRf2.MFG") == (int)GeneratorMFG.Comet)
  468. {
  469. _GeneratorBias2 = DEVICE.GetDevice<CometRF>($"{Module}.{VirgoDevice.BiasRf2}");
  470. }
  471. // RS232 AdTec match
  472. if (SC.GetValue<int>($"{mod}.match1.CommunicationType") == (int)CommunicationType.RS232 &&
  473. SC.GetValue<int>($"{mod}.match1.MFG") == (int)MatchMFG.AdTec)
  474. {
  475. _Match1 = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VirgoDevice.Match1}");
  476. }
  477. // RS232 AdTec match
  478. if (SC.GetValue<int>($"{mod}.match1.CommunicationType") == (int)CommunicationType.RS232 &&
  479. SC.GetValue<int>($"{mod}.match1.MFG") == (int)MatchMFG.AdTec)
  480. {
  481. _Match2 = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VirgoDevice.Match2}");
  482. }
  483. // RS232 Dry pump, SKY
  484. if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)
  485. {
  486. if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)
  487. {
  488. _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VirgoDevice.MainPump}");
  489. }
  490. else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)
  491. {
  492. _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VirgoDevice.MainPump}");
  493. }
  494. }
  495. if (SC.GetValue<bool>($"{mod}.Chiller1.EnableChiller") &&
  496. SC.GetValue<int>($"{mod}.Chiller1.CommunicationType") == (int)CommunicationType.RS232)
  497. {
  498. if (SC.GetValue<int>($"{mod}.Chiller1.MFG") == (int)ChillerMFG.SMC)
  499. {
  500. _Chiller1 = DEVICE.GetDevice<SMCChiller>($"{Module}.{VirgoDevice.Chiller1}");
  501. }
  502. else if (SC.GetValue<int>($"{mod}.Chiller1.MFG") == (int)ChillerMFG.AIRSYS)
  503. {
  504. _Chiller1 = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VirgoDevice.Chiller1}");
  505. }
  506. }
  507. if (SC.GetValue<bool>($"{mod}.Chiller2.EnableChiller") &&
  508. SC.GetValue<int>($"{mod}.Chiller2.CommunicationType") == (int)CommunicationType.RS232)
  509. {
  510. if (SC.GetValue<int>($"System.SetUp.ChillerSetupOp.IsInstalled") == (int)ChillerSetupOp.ShareSingleChiller)
  511. {
  512. _Chiller2 = _Chiller1;
  513. }
  514. else
  515. {
  516. if (SC.GetValue<int>($"{mod}.Chiller2.MFG") == (int)ChillerMFG.SMC)
  517. {
  518. _Chiller2 = DEVICE.GetDevice<SMCChiller>($"{Module}.{VirgoDevice.Chiller2}");
  519. }
  520. else if (SC.GetValue<int>($"{mod}.Chiller1.MFG") == (int)ChillerMFG.AIRSYS)
  521. {
  522. _Chiller2 = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VirgoDevice.Chiller2}");
  523. }
  524. }
  525. }
  526. System.Diagnostics.Debug.Assert(null != _Generator1);
  527. System.Diagnostics.Debug.Assert(null != _Generator2);
  528. System.Diagnostics.Debug.Assert(null != _MainPump);
  529. if (SC.GetValue<bool>($"{Module}.BiasRf1.EnableBiasRF"))
  530. {
  531. System.Diagnostics.Debug.Assert(null != _GeneratorBias1);
  532. }
  533. if (SC.GetValue<bool>($"{Module}.BiasRf2.EnableBiasRF"))
  534. {
  535. System.Diagnostics.Debug.Assert(null != _GeneratorBias2);
  536. }
  537. //WaferManager.Instance.SubscribeLocation(Module, 2);
  538. }
  539. public override bool Initialize()
  540. {
  541. DATA.Subscribe($"{Name}.IsAtm", () => { return CheckAtm(); });
  542. DATA.Subscribe($"{Name}.IsVacuum", () => { return CheckVacuum(); });
  543. DATA.Subscribe($"{Name}.IsCDAOK", () => { return CheckCDAOK(); });
  544. DATA.Subscribe($"{Name}.IsCoolantInletTCOK1", () => { return CheckCoolantInletTCOK1(); });
  545. DATA.Subscribe($"{Name}.IsCoolantOutletTCOK1", () => { return CheckCoolantOutletTCOK1(); });
  546. DATA.Subscribe($"{Name}.IsCoolantInletTCOK2", () => { return CheckCoolantInletTCOK2(); });
  547. DATA.Subscribe($"{Name}.IsCoolantOutletTCOK2", () => { return CheckCoolantOutletTCOK2(); });
  548. DATA.Subscribe($"{Name}.IsTMRbotNotExtendToPM1", () => { return CheckTMRobotCanExtendToPM1(); });
  549. DATA.Subscribe($"{Name}.IsTMRbotNotExtendToPM2", () => { return CheckTMRobotCanExtendToPM2(); });
  550. //DATA.Subscribe($"{Name}.IsWaterLeak", () => { return CheckWaterLeak(); });
  551. DATA.Subscribe($"{Name}.ChamberPressure", () => ChamberPressure);
  552. DATA.Subscribe($"{Name}.IoTemperatureCtrl.TemperatureControl.Chamber1Temperature", () => ChamberTempFB1);
  553. DATA.Subscribe($"{Name}.IoTemperatureCtrl.TemperatureControl.Chamber2Temperature", () => ChamberTempFB2);
  554. IsInstalled = SC.GetValue<bool>($"System.SetUp.{Name}.IsInstalled");
  555. return true;
  556. }
  557. // -----------------------------Method-------------------------
  558. //
  559. public override void Home()
  560. {
  561. // 与yp讨论过,PM 初始化不需要
  562. if (!_Chamber1Disabled)
  563. {
  564. SetLiftPin1(MovementPosition.Down, out _);
  565. if (IsSlitDoor1Closed)
  566. {
  567. SetSlitDoor1(false, out _);
  568. }
  569. else if (!IsSlitDoor1Closed)
  570. {
  571. SetSlitDoor1(false, out _);
  572. }
  573. else if (_slitDoor1.State == CylinderState.Error)
  574. {
  575. SetSlitDoor1(true, out _);
  576. }
  577. if (_biasRf1Enable)
  578. {
  579. _Messager.SetMessager(1); //Virgo B
  580. }
  581. else
  582. {
  583. _Messager.SetMessager(0); //Virgo A
  584. }
  585. }
  586. if (!_Chamber2Disabled)
  587. {
  588. SetLiftPin2(MovementPosition.Down, out _);
  589. //SetSlitDoor(false, out _);
  590. //SetGuidePin1(MovementPosition.Down);
  591. //SetGuidePin2(MovementPosition.Down);
  592. if (IsSlitDoor2Closed)
  593. {
  594. SetSlitDoor2(false, out _);
  595. }
  596. else if (!IsSlitDoor2Closed)
  597. {
  598. SetSlitDoor2(false, out _);
  599. }
  600. else if (_slitDoor2.State == CylinderState.Error)
  601. {
  602. SetSlitDoor2(true, out _);
  603. }
  604. if (_biasRf2Enable)
  605. {
  606. _Messager.SetMessager(1); //Virgo B
  607. }
  608. else
  609. {
  610. _Messager.SetMessager(0); //Virgo A
  611. }
  612. }
  613. }
  614. public bool SetSlitDoor1(bool open, out string reason)
  615. {
  616. reason = string.Empty;
  617. // [XIAHUAN]: 只在关门的时候检查arm not extend
  618. if (!open && !(IsTMRobotNotExtendToPM1/* || DEVICE.GetDevice<RorzeRobot751>($"TMRobot").LastRecordStation != $"{Module}1"*/))
  619. {
  620. reason = "TMRobot Not Extend To PM1 信号不满足";
  621. EV.PostAlarmLog(Module.ToString(), reason);
  622. return false;
  623. }
  624. return _slitDoor1.SetCylinder(open, out reason);
  625. }
  626. public bool SetSlitDoor2(bool open, out string reason)
  627. {
  628. reason = string.Empty;
  629. // [XIAHUAN]: 只在关门的时候检查arm not extend
  630. if (!open && !(IsTMRobotNotExtendToPM2 /*|| DEVICE.GetDevice<RorzeRobot751>($"TMRobot").LastRecordStation != $"{Module}2"*/))
  631. {
  632. reason = "TMRobot Not Extend To PM2 信号不满足";
  633. EV.PostAlarmLog(Module.ToString(), reason);
  634. return false;
  635. }
  636. return _slitDoor2.SetCylinder(open, out reason);
  637. }
  638. //public override bool CheckWaterLeak()
  639. //{
  640. // return _WLK_sw.Value;
  641. //}
  642. //public override bool CheckCDAOK()
  643. //{
  644. // return _CDAPressure.Value;
  645. //}
  646. public override bool CheckCoolantInletTCOK1()
  647. {
  648. return _CoolantInletTC1.Value;
  649. }
  650. public override bool CheckCoolantInletTCOK2()
  651. {
  652. return _CoolantInletTC2.Value;
  653. }
  654. public override bool CheckCoolantOutletTCOK1()
  655. {
  656. return _CoolantOutletTC1.Value;
  657. }
  658. public override bool CheckCoolantOutletTCOK2()
  659. {
  660. return _CoolantOutletTC2.Value;
  661. }
  662. public override bool CheckTMRobotCanExtendToPM1()
  663. {
  664. return _TMRobotNotExtendToPM1.Value;
  665. }
  666. public override bool CheckTMRobotCanExtendToPM2()
  667. {
  668. return _TMRobotNotExtendToPM2.Value;
  669. }
  670. public override bool CheckAtm()
  671. {
  672. return _ATM_sw.Value && ChamberPressurePressure > 700000;
  673. }
  674. public override bool CheckVacuum()
  675. {
  676. return _VAC_sw.Value && ChamberPressure < 100;
  677. }
  678. public bool CheckSlitDoor1Open()
  679. {
  680. return _slitDoor1.State == CylinderState.Open;
  681. }
  682. public bool CheckSlitDoor1Close()
  683. {
  684. return _slitDoor1.State == CylinderState.Close;
  685. }
  686. public bool CheckSlitDoor2Open()
  687. {
  688. return _slitDoor2.State == CylinderState.Open;
  689. }
  690. public bool CheckSlitDoor2Close()
  691. {
  692. return _slitDoor2.State == CylinderState.Close;
  693. }
  694. public bool CheckLift1Up()
  695. {
  696. return _LiftPin1.State == CylinderState.Open;
  697. }
  698. public bool CheckLift1Down()
  699. {
  700. return _LiftPin1.State == CylinderState.Close;
  701. }
  702. public bool CheckLift2Up()
  703. {
  704. return _LiftPin2.State == CylinderState.Open;
  705. }
  706. public bool CheckLift2Down()
  707. {
  708. return _LiftPin2.State == CylinderState.Close;
  709. }
  710. public void StartPump(bool on)
  711. {
  712. //_pressureController.StartPump(on);
  713. _MainPump?.SetPumpOnOff(on);
  714. }
  715. public void OpenValve(ValveType vlvType, bool on)
  716. {
  717. switch (vlvType)
  718. {
  719. case ValveType.PROCESS:
  720. _ProcessValve.TurnValve(on, out _);
  721. break;
  722. case ValveType.N2:
  723. _N2Valve.TurnValve(on, out _);
  724. break;
  725. case ValveType.FAST_PUMP:
  726. _FastPumpValve.TurnValve(on, out _);
  727. break;
  728. case ValveType.SOFT_PUMP:
  729. _SoftPumpValve.TurnValve(on, out _);
  730. break;
  731. case ValveType.FAST_VENT:
  732. _FastVentValve.TurnValve(on, out _);
  733. break;
  734. case ValveType.PURGE:
  735. _PurgeValve.TurnValve(on, out _);
  736. break;
  737. case ValveType.Mfc1:
  738. _Mfc1Valve.TurnValve(on, out _);
  739. break;
  740. case ValveType.Mfc2:
  741. _Mfc2Valve.TurnValve(on, out _);
  742. break;
  743. case ValveType.Mfc3:
  744. _Mfc3Valve.TurnValve(on, out _);
  745. break;
  746. case ValveType.Mfc4:
  747. _Mfc4Valve.TurnValve(on, out _);
  748. break;
  749. case ValveType.Mfc5:
  750. _Mfc5Valve.TurnValve(on, out _);
  751. break;
  752. case ValveType.Mfc6:
  753. _Mfc6Valve.TurnValve(on, out _);
  754. break;
  755. default:
  756. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  757. }
  758. }
  759. public bool CheckValveSwitchStatus(ValveType vlvType, bool on)
  760. {
  761. switch (vlvType)
  762. {
  763. case ValveType.PROCESS:
  764. return _ProcessValve.Status == on;
  765. case ValveType.N2:
  766. return _N2Valve.Status == on;
  767. case ValveType.FAST_PUMP:
  768. return _FastPumpValve.Status == on;
  769. case ValveType.SOFT_PUMP:
  770. return _SoftPumpValve.Status == on;
  771. case ValveType.FAST_VENT:
  772. return _FastVentValve.Status == on;
  773. case ValveType.PURGE:
  774. return _PurgeValve.Status == on;
  775. case ValveType.Mfc1:
  776. return _Mfc1Valve.Status == on;
  777. case ValveType.Mfc2:
  778. return _Mfc2Valve.Status == on;
  779. case ValveType.Mfc3:
  780. return _Mfc3Valve.Status == on;
  781. case ValveType.Mfc4:
  782. return _Mfc4Valve.Status == on;
  783. case ValveType.Mfc5:
  784. return _Mfc5Valve.Status == on;
  785. case ValveType.Mfc6:
  786. return _Mfc6Valve.Status == on;
  787. default:
  788. throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");
  789. }
  790. }
  791. public void CheckPressureStability()
  792. {
  793. IsPressureToleranceEnabled = true;
  794. }
  795. public void CheckPressureDisable()
  796. {
  797. IsPressureToleranceEnabled = false;
  798. }
  799. public override void Monitor()
  800. {
  801. foreach (var gas in _gasLines)
  802. {
  803. gas.Monitor();
  804. }
  805. _trigBasePressure.CLK = ChamberPressurePressure >= BasePressure;
  806. if (_chiller1Enable)
  807. {
  808. _trigBaseTemperature1.CLK = CoolantOutletTempFB1 >= BaseTemperature;
  809. }
  810. else
  811. {
  812. _trigBaseTemperature1.CLK = LETempFB1 >= BaseTemperature;
  813. }
  814. if (_chiller2Enable)
  815. {
  816. _trigBaseTemperature2.CLK = CoolantOutletTempFB2 >= BaseTemperature;
  817. }
  818. else
  819. {
  820. _trigBaseTemperature2.CLK = LETempFB2 >= BaseTemperature;
  821. }
  822. if (_trigBasePressure.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, $"{Module} pressure out of tolerance");
  823. if (_trigBaseTemperature1.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, $"{Module} 1 temperature out of tolerance");
  824. if (_trigBaseTemperature2.Q) EV.PostMessage(Module.ToString(), EventEnum.DefaultAlarm, $"{Module} 2 temperature out of tolerance");
  825. _trigRfInterlock.CLK = (IsGenerator1ON || IsGenerator2ON || IsGeneratorONBias1 || IsGeneratorONBias2) &&
  826. (_isAnyWaterFlowOff || _isRFGasInterlockOff || _isAllGasValveOff);
  827. if (_trigRfInterlock.R) _timerRFTurnOff.Start(3 * 1000);
  828. if (_trigRfInterlock.M && _timerRFTurnOff.IsTimeout())
  829. {
  830. _timerRFTurnOff.Stop();
  831. if (IsGenerator1ON || IsGenerator2ON)
  832. {
  833. //Generator1PowerOn(false);
  834. //Generator2PowerOn(false);
  835. LOG.Info($"{Module} {Name} Source RF cannot power on, gas or water or gas valve is off");
  836. }
  837. if (IsGeneratorONBias1 || IsGeneratorONBias2)
  838. {
  839. //GeneratorBias1PowerOn(false);
  840. //GeneratorBias2PowerOn(false);
  841. LOG.Info($"{Module} {Name} Bias RF cannot power on, gas or water or gas valve is off");
  842. }
  843. }
  844. if (_trigRfInterlock.T) _timerRFTurnOff.Stop();
  845. }
  846. public override void Terminate()
  847. {
  848. base.Terminate();
  849. if(IsGenerator1ON)
  850. Generator1PowerOn(false);
  851. if (IsGenerator2ON)
  852. Generator2PowerOn(false);
  853. if (IsGeneratorONBias1)
  854. GeneratorBias1PowerOn(false);
  855. if (IsGeneratorONBias2)
  856. GeneratorBias2PowerOn(false);
  857. var iovalves = new IoValve[] {
  858. _N2Valve,_SoftPumpValve,_FastPumpValve,_ProcessValve,_PurgeValve,
  859. _FastVentValve,_Mfc1Valve,_Mfc2Valve,_Mfc3Valve,_Mfc4Valve,_Mfc5Valve,_Mfc6Valve
  860. };
  861. if(iovalves.Any(p=> p.Status ))
  862. CloseValves();
  863. }
  864. public void CloseValves()
  865. {
  866. _N2Valve.TurnValve(false, out _);
  867. _SoftPumpValve.TurnValve(false, out _);
  868. _FastPumpValve.TurnValve(false, out _);
  869. _ProcessValve.TurnValve(false, out _);
  870. _PurgeValve.TurnValve(false, out _);
  871. _FastVentValve.TurnValve(false, out _);
  872. _PurgeValve.TurnValve(false, out _);
  873. _Mfc1Valve.TurnValve(false, out _);
  874. _Mfc2Valve.TurnValve(false, out _);
  875. _Mfc3Valve.TurnValve(false, out _);
  876. _Mfc4Valve.TurnValve(false, out _);
  877. _Mfc5Valve.TurnValve(false, out _);
  878. _Mfc6Valve.TurnValve(false, out _);
  879. foreach (var stick in _gasLines)
  880. {
  881. stick.Stop();
  882. }
  883. }
  884. public bool FlowGas(int gasNum, double val)
  885. {
  886. if (_gasLines.Length <= gasNum)
  887. return false;
  888. _gasLines[gasNum].Flow(val);
  889. return true;
  890. }
  891. public void StopAllGases()
  892. {
  893. foreach (var line in _gasLines)
  894. {
  895. line.Stop();
  896. }
  897. }
  898. public bool SetLiftPin1(MovementPosition dirt, out string reason)
  899. {
  900. reason = string.Empty;
  901. switch (dirt)
  902. {
  903. case MovementPosition.Down:
  904. return _LiftPin1.SetCylinder(false, out reason);
  905. case MovementPosition.Up:
  906. return _LiftPin1.SetCylinder(true, out reason);
  907. case MovementPosition.Left:
  908. case MovementPosition.Right:
  909. case MovementPosition.Middle:
  910. throw new ArgumentException("Movement argument error");
  911. }
  912. return true;
  913. }
  914. public bool SetLiftPin2(MovementPosition dirt, out string reason)
  915. {
  916. reason = string.Empty;
  917. switch (dirt)
  918. {
  919. case MovementPosition.Down:
  920. return _LiftPin2.SetCylinder(false, out reason);
  921. case MovementPosition.Up:
  922. return _LiftPin2.SetCylinder(true, out reason);
  923. case MovementPosition.Left:
  924. case MovementPosition.Right:
  925. case MovementPosition.Middle:
  926. throw new ArgumentException("Movement argument error");
  927. }
  928. return true;
  929. }
  930. public void SetGuidePin(WaferSize ws, MovementPosition dirt)
  931. {
  932. //if (ws == WaferSize.WS3)
  933. // SetGuidePinSmall(dirt);
  934. //else if (ws == WaferSize.WS4)
  935. // SetGuidePinMedium(dirt);
  936. }
  937. public void PrepareGuidePinForPlace(WaferSize ws)
  938. {
  939. //if (ws == WaferSize.WS3)
  940. //{
  941. // SetGuidePinSmall(MovementPosition.Up);
  942. // SetGuidePinMedium(MovementPosition.Down);
  943. //}
  944. //else if (ws == WaferSize.WS4)
  945. //{
  946. // SetGuidePinSmall(MovementPosition.Down);
  947. // SetGuidePinMedium(MovementPosition.Up);
  948. //}
  949. //else if (ws == WaferSize.WS6)
  950. //{
  951. // SetGuidePinSmall(MovementPosition.Down);
  952. // SetGuidePinMedium(MovementPosition.Down);
  953. //}
  954. }
  955. public void PrepareGuidePinForPlaceLeft(WaferSize ws)
  956. {
  957. //if (ws == WaferSize.WS3)
  958. //{
  959. // SetGuidePinSmall(MovementPosition.Up);
  960. // SetGuidePinMedium(MovementPosition.Down);
  961. //}
  962. //else if (ws == WaferSize.WS4)
  963. //{
  964. // SetGuidePinSmall(MovementPosition.Down);
  965. // SetGuidePinMedium(MovementPosition.Up);
  966. //}
  967. //else if (ws == WaferSize.WS6)
  968. //{
  969. // SetGuidePinSmall(MovementPosition.Down);
  970. // SetGuidePinMedium(MovementPosition.Down);
  971. //}
  972. string reason = string.Empty;
  973. if (ws == WaferSize.WS4)
  974. {
  975. _GuidePin1.SetCylinder(true, out reason);
  976. }
  977. else
  978. {
  979. _GuidePin1.SetCylinder(false, out reason);
  980. }
  981. }
  982. public void PrepareGuidePinForPlaceRight(WaferSize ws)
  983. {
  984. //if (ws == WaferSize.WS3)
  985. //{
  986. // SetGuidePinSmall(MovementPosition.Up);
  987. // SetGuidePinMedium(MovementPosition.Down);
  988. //}
  989. //else if (ws == WaferSize.WS4)
  990. //{
  991. // SetGuidePinSmall(MovementPosition.Down);
  992. // SetGuidePinMedium(MovementPosition.Up);
  993. //}
  994. //else if (ws == WaferSize.WS6)
  995. //{
  996. // SetGuidePinSmall(MovementPosition.Down);
  997. // SetGuidePinMedium(MovementPosition.Down);
  998. //}
  999. string reason = string.Empty;
  1000. if (ws == WaferSize.WS4)
  1001. {
  1002. _GuidePin2.SetCylinder(true, out reason);
  1003. }
  1004. else
  1005. {
  1006. _GuidePin2.SetCylinder(false, out reason);
  1007. }
  1008. }
  1009. public bool CheckGuidePinIsReadyForTransfer(EnumDualPM pos, WaferSize ws)
  1010. {
  1011. if (!GuidePinInstalled)
  1012. {
  1013. return true;
  1014. }
  1015. if (pos == EnumDualPM.Left)
  1016. {
  1017. return CheckGuidePinIsReadyForTransferLeft(ws);
  1018. }
  1019. else if (pos == EnumDualPM.Right)
  1020. {
  1021. return CheckGuidePinIsReadyForTransferRight(ws);
  1022. }
  1023. return false;
  1024. }
  1025. public bool CheckGuidePinIsReadyForTransferLeft(WaferSize ws)
  1026. {
  1027. if (ws == WaferSize.WS4)
  1028. {
  1029. return GuidePin1Position == MovementPosition.Up;
  1030. }
  1031. else if (ws == WaferSize.WS6 || ws == WaferSize.WS8 || ws == WaferSize.WS12)
  1032. {
  1033. return GuidePin1Position == MovementPosition.Down;
  1034. }
  1035. else
  1036. return false;
  1037. }
  1038. public bool CheckGuidePinIsReadyForTransferRight(WaferSize ws)
  1039. {
  1040. if (ws == WaferSize.WS4)
  1041. {
  1042. return GuidePin2Position == MovementPosition.Up;
  1043. }
  1044. else if (ws == WaferSize.WS6 || ws == WaferSize.WS8 || ws == WaferSize.WS12)
  1045. {
  1046. return GuidePin2Position == MovementPosition.Down;
  1047. }
  1048. else
  1049. return false;
  1050. }
  1051. private void SetGuidePin1(MovementPosition dirt)
  1052. {
  1053. EV.PostInfoLog(Module.ToString(), $"set small pin {dirt}, smallWafer={_smallWafer}");
  1054. switch (dirt)
  1055. {
  1056. case MovementPosition.Down:
  1057. if (_smallWafer != 0)
  1058. _GuidePin1?.SetCylinder(false, out _);
  1059. break;
  1060. case MovementPosition.Up:
  1061. if (_smallWafer != 0)
  1062. _GuidePin1?.SetCylinder(true, out _);
  1063. break;
  1064. default:
  1065. throw new ArgumentException("Movement argument error");
  1066. }
  1067. }
  1068. private void SetGuidePin2(MovementPosition dirt)
  1069. {
  1070. EV.PostInfoLog(Module.ToString(), $"set medium pin {dirt}, midWafer={_midWafer}");
  1071. switch (dirt)
  1072. {
  1073. case MovementPosition.Down:
  1074. if (_midWafer != 0)
  1075. _GuidePin2?.SetCylinder(false, out _);
  1076. break;
  1077. case MovementPosition.Up:
  1078. if (_midWafer != 0)
  1079. _GuidePin2?.SetCylinder(true, out _);
  1080. break;
  1081. default:
  1082. throw new ArgumentException("Movement argument error");
  1083. }
  1084. }
  1085. public void SetGenerator1CommunicationMode(int mode)
  1086. {
  1087. _Generator1?.SetCommunicationMode(mode);
  1088. }
  1089. public void SetGenerator2CommunicationMode(int mode)
  1090. {
  1091. _Generator2?.SetCommunicationMode(mode);
  1092. }
  1093. public bool Generator1PowerOn(bool on)
  1094. {
  1095. if (_Generator1 == null) return false;
  1096. if (on && !NotHasInterlock)
  1097. {
  1098. EV.PostAlarmLog(Module.ToString(), "射频电源 Interlock条件不满足");
  1099. return false;
  1100. }
  1101. return _Generator1.SetPowerOnOff(on, out _);
  1102. }
  1103. public bool Generator2PowerOn(bool on)
  1104. {
  1105. if (_Generator2 == null) return false;
  1106. if (on && !NotHasInterlock)
  1107. {
  1108. EV.PostAlarmLog(Module.ToString(), "射频电源 Interlock条件不满足");
  1109. return false;
  1110. }
  1111. return _Generator2.SetPowerOnOff(on, out _);
  1112. }
  1113. public bool Generator1Setpower(float val)
  1114. {
  1115. if (_Generator1 == null) return false;
  1116. if (Math.Abs(val) > 0.01)
  1117. _Generator1.SetPower((ushort)val);
  1118. return true;
  1119. }
  1120. public bool Generator2Setpower(float val)
  1121. {
  1122. if (_Generator2 == null) return false;
  1123. if (Math.Abs(val) > 0.01)
  1124. _Generator2.SetPower((ushort)val);
  1125. return true;
  1126. }
  1127. public bool GeneratorBias1PowerOn(bool on)
  1128. {
  1129. if (_GeneratorBias1 == null) return false;
  1130. if (on && !NotHasInterlock)
  1131. {
  1132. EV.PostAlarmLog(Module.ToString(), "Bias射频电源 Interlock条件不满足");
  1133. return false;
  1134. }
  1135. return _GeneratorBias1.SetPowerOnOff(on, out _);
  1136. }
  1137. public bool GeneratorBias2PowerOn(bool on)
  1138. {
  1139. if (_GeneratorBias2 == null) return false;
  1140. if (on && !NotHasInterlock)
  1141. {
  1142. EV.PostAlarmLog(Module.ToString(), "Bias射频电源 Interlock条件不满足");
  1143. return false;
  1144. }
  1145. return _GeneratorBias2.SetPowerOnOff(on, out _);
  1146. }
  1147. public bool GeneratorBias1Setpower(float val)
  1148. {
  1149. if (_GeneratorBias1 == null) return false;
  1150. if (Math.Abs(val) > 0.01)
  1151. _GeneratorBias1.SetPower((ushort)val);
  1152. return true;
  1153. }
  1154. public bool GeneratorBias2Setpower(float val)
  1155. {
  1156. if (_GeneratorBias2 == null) return false;
  1157. if (Math.Abs(val) > 0.01)
  1158. _GeneratorBias2.SetPower((ushort)val);
  1159. return true;
  1160. }
  1161. public bool GeneratorBias1SetMatchMode(bool val)
  1162. {
  1163. if (_GeneratorBias1 == null) return false;
  1164. string reason = string.Empty;
  1165. _GeneratorBias1.SetMatchingAutoMode(val, out reason);
  1166. return true;
  1167. }
  1168. public bool GeneratorBias2SetMatchMode(bool val)
  1169. {
  1170. if (_GeneratorBias2 == null) return false;
  1171. string reason = string.Empty;
  1172. _GeneratorBias2.SetMatchingAutoMode(val, out reason);
  1173. return true;
  1174. }
  1175. public bool SetMatch1Position(float c1, float c2)
  1176. {
  1177. if (_Match1 == null) return false;
  1178. string reason = string.Empty;
  1179. _Match1.SetMatchPosition(c1, c2, out reason);
  1180. return true;
  1181. }
  1182. public bool SetMatch2Position(float c1, float c2)
  1183. {
  1184. if (_Match2 == null) return false;
  1185. string reason = string.Empty;
  1186. _Match2.SetMatchPosition(c1, c2, out reason);
  1187. return true;
  1188. }
  1189. public bool SetBias1MatchPosition(float c1, float c2)
  1190. {
  1191. if (_GeneratorBias1 == null) return false;
  1192. string reason = string.Empty;
  1193. _GeneratorBias1.SetMatchPosition(c1, c2, out reason);
  1194. return true;
  1195. }
  1196. public bool SetBias2MatchPosition(float c1, float c2)
  1197. {
  1198. if (_GeneratorBias2 == null) return false;
  1199. string reason = string.Empty;
  1200. _GeneratorBias2.SetMatchPosition(c1, c2, out reason);
  1201. return true;
  1202. }
  1203. public void FullOpenTV()
  1204. {
  1205. _pressureController.FullOpenThrottleValve();
  1206. }
  1207. public void HeatChamber1(double val)
  1208. {
  1209. _ChamberHeater1?.RampTemp((float)val);
  1210. _ChamberHeater1?.TurnOnOff(true);
  1211. }
  1212. public void HeatChamber2(double val)
  1213. {
  1214. _HeaterChamber?.RampTemp((float)val);
  1215. _HeaterChamber?.TurnOnOff(true);
  1216. }
  1217. public void HeatChiller1(double value, double offset)
  1218. {
  1219. _Chiller1?.SetChillerTemp((float)value, (float)offset);
  1220. _Chiller1?.SetChillerOnOff(true);
  1221. }
  1222. public void HeatChiller2(double value, double offset)
  1223. {
  1224. _Chiller2?.SetChillerTemp((float)value, (float)offset);
  1225. _Chiller2?.SetChillerOnOff(true);
  1226. }
  1227. public void HeatForeline(double val)
  1228. {
  1229. _ForelineHeater?.RampTemp((float)val);
  1230. }
  1231. public void HeatLE1(double val)
  1232. {
  1233. _LEHeater1?.RampTemp((float)val);
  1234. _LEHeater1?.TurnOnOff(true);
  1235. }
  1236. public void HeatLE2(double val)
  1237. {
  1238. _LEHeater2?.RampTemp((float)val);
  1239. _LEHeater2?.TurnOnOff(true);
  1240. }
  1241. public override bool CheckEnableTransfer(EnumTransferType type, EnumDualPM pos)
  1242. {
  1243. if (type == EnumTransferType.Pick)
  1244. {
  1245. if (pos == EnumDualPM.Left)
  1246. {
  1247. return _slitDoor1.State == CylinderState.Open && _LiftPin1.State == CylinderState.Open;
  1248. }
  1249. else if (pos == EnumDualPM.Right)
  1250. {
  1251. return _slitDoor2.State == CylinderState.Open && _LiftPin2.State == CylinderState.Open;
  1252. }
  1253. }
  1254. if (type == EnumTransferType.Place)
  1255. {
  1256. if (pos == EnumDualPM.Left)
  1257. {
  1258. return _slitDoor1.State == CylinderState.Open && _LiftPin1.State == CylinderState.Close;
  1259. }
  1260. else if (pos == EnumDualPM.Right)
  1261. {
  1262. return _slitDoor2.State == CylinderState.Open && _LiftPin2.State == CylinderState.Close;
  1263. }
  1264. }
  1265. return false;
  1266. }
  1267. public bool CheckEnableTransfer(EnumTransferType type, EnumDualPM pos, WaferSize waferSize)
  1268. {
  1269. if (type == EnumTransferType.Pick)
  1270. {
  1271. return ((pos != EnumDualPM.Left && pos != EnumDualPM.Both) || (_slitDoor1.State == CylinderState.Open && _LiftPin1.State == CylinderState.Open && CheckGuidePinIsReadyForTransfer(pos, waferSize))) &&
  1272. ((pos != EnumDualPM.Right && pos != EnumDualPM.Both) || (_slitDoor2.State == CylinderState.Open && _LiftPin2.State == CylinderState.Open && CheckGuidePinIsReadyForTransfer(pos, waferSize)));
  1273. }
  1274. if (type == EnumTransferType.Place)
  1275. {
  1276. return ((pos != EnumDualPM.Left && pos != EnumDualPM.Both) || (_slitDoor1.State == CylinderState.Open && _LiftPin1.State == CylinderState.Close && CheckGuidePinIsReadyForTransfer(pos, waferSize))) &&
  1277. ((pos != EnumDualPM.Right && pos != EnumDualPM.Both) || (_slitDoor2.State == CylinderState.Open && _LiftPin2.State == CylinderState.Close && CheckGuidePinIsReadyForTransfer(pos, waferSize)));
  1278. }
  1279. return false;
  1280. }
  1281. public override void TransferHandoff(EnumTransferType type, EnumDualPM pos)
  1282. {
  1283. switch (type)
  1284. {
  1285. case EnumTransferType.Pick:
  1286. if (pos == EnumDualPM.Left)
  1287. {
  1288. SetLiftPin1(MovementPosition.Up, out _);
  1289. }
  1290. else if (pos == EnumDualPM.Right)
  1291. {
  1292. SetLiftPin2(MovementPosition.Up, out _);
  1293. }
  1294. break;
  1295. case EnumTransferType.Place:
  1296. SetLiftPin1(MovementPosition.Down, out _);
  1297. break;
  1298. case EnumTransferType.Extend:
  1299. break;
  1300. case EnumTransferType.Retract:
  1301. break;
  1302. default:
  1303. break;
  1304. }
  1305. }
  1306. public override void Reset()
  1307. {
  1308. _trigBasePressure.RST = true;
  1309. _trigBaseTemperature1.RST = true;
  1310. }
  1311. public bool CloseAllGenerator()
  1312. {
  1313. if (IsGenerator1ON) Generator1PowerOn(false);
  1314. if (IsGenerator2ON) Generator2PowerOn(false);
  1315. if (IsGeneratorONBias1) GeneratorBias1PowerOn(false);
  1316. if (IsGeneratorONBias2) GeneratorBias2PowerOn(false);
  1317. return true;
  1318. }
  1319. public bool CloseAllGasValve()
  1320. {
  1321. var iovalves = new IoValve[] {
  1322. _N2Valve,_ProcessValve,_PurgeValve,_FastVentValve,_Mfc1Valve,_Mfc2Valve,_Mfc3Valve,_Mfc4Valve,_Mfc5Valve,_Mfc6Valve
  1323. }.Where(p=>p.Status);
  1324. Array.ForEach(iovalves.ToArray(), p => p.TurnValve(false, out _));
  1325. return true;
  1326. }
  1327. }
  1328. /// <summary>
  1329. /// PM Action
  1330. /// </summary>
  1331. abstract class PmActionBase : ActionBase
  1332. {
  1333. protected internal JetDualPM _chamber;
  1334. protected PmActionBase(ModuleName mod, JetDualPM dualPm) : base(mod)
  1335. {
  1336. _chamber = dualPm;
  1337. }
  1338. }
  1339. class PinAction : PmActionBase
  1340. {
  1341. public MovementPosition Pos { get; }
  1342. public bool IsWaferTransfered { get; }
  1343. public PMModule PmModule { get; set; }
  1344. private Hand _blade;
  1345. public PinAction(ModuleName mod, JetDualPM dualPm, MovementPosition pos, bool isTransferWafer, Hand blade) : base(mod, dualPm)
  1346. {
  1347. this.Pos = pos;
  1348. IsWaferTransfered = isTransferWafer;
  1349. _blade = blade;
  1350. }
  1351. public override void Execute()
  1352. {
  1353. if (Module == ModuleName.PMA)
  1354. PmModule = (PMModule)EquipmentManager.Modules[ModuleName.PMA];
  1355. else if (Module == ModuleName.PMB)
  1356. PmModule = (PMModule)EquipmentManager.Modules[ModuleName.PMB];
  1357. if (PmModule != null)
  1358. {
  1359. PmModule.PostMsg(PMModule.MSG.MoveLiftPin1, Pos, ID);
  1360. }
  1361. }
  1362. public override void OnPostWork(string data = null)
  1363. {
  1364. if (IsWaferTransfered)
  1365. {
  1366. if (Pos == MovementPosition.Up)
  1367. {
  1368. WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1, Module, 0);
  1369. }
  1370. else
  1371. {
  1372. WaferManager.Instance.WaferMoved(Module, 0, ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1);
  1373. }
  1374. }
  1375. }
  1376. }
  1377. abstract class ActionBase
  1378. {
  1379. private static ushort _id = 100;
  1380. //---------------------------------Properties------------------------------------
  1381. //
  1382. public ushort ID { get; }
  1383. public ModuleName Module { get; protected set; }
  1384. public virtual ActionStatus Status { get; set; }
  1385. public virtual bool IsReady { get; set; }
  1386. public bool IsBackground { get; set; }
  1387. //--------------------------------Constructor------------------------------------
  1388. //
  1389. protected ActionBase(ModuleName mod)
  1390. {
  1391. this.ID = _id++;
  1392. this.Module = mod;
  1393. this.Status = ActionStatus.Pending;
  1394. }
  1395. public virtual void Execute()
  1396. {
  1397. this.Status = ActionStatus.SendCmd;
  1398. }
  1399. protected virtual void OnPreWork() { }
  1400. public virtual void OnPostWork(string data = null) { }
  1401. }
  1402. }