PMN2Purge.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Device.Unit;
  4. using Aitex.Core.RT.IOCore;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using DocumentFormat.OpenXml.Packaging;
  9. using DocumentFormat.OpenXml.Spreadsheet;
  10. using FurnaceRT.Devices;
  11. using FurnaceRT.Equipments.PMs.Devices;
  12. using FurnaceRT.Equipments.Systems;
  13. using FurnaceRT.Extraction;
  14. using MECF.Framework.Common.CommonData.SorterDefines;
  15. using MECF.Framework.Common.Equipment;
  16. using MECF.Framework.Common.Tolerance;
  17. using MECF.Framework.Common.Utilities;
  18. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
  19. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  20. using System;
  21. using System.Collections.Generic;
  22. using System.Diagnostics;
  23. using System.Linq;
  24. namespace FurnaceRT.Equipments.PMs
  25. {
  26. /// <summary>
  27. /// 分布类 定义N2Purge的执行逻辑
  28. /// </summary>
  29. public partial class PMModule
  30. {
  31. private R_TRIG _trigN2UpRD = new R_TRIG();
  32. private R_TRIG _trigN2DownRD = new R_TRIG();
  33. private R_TRIG _trigN2AirUpRD = new R_TRIG();
  34. private R_TRIG _trigN2AirDownRD = new R_TRIG();
  35. private R_TRIG _trigN2AirDownTwoRD = new R_TRIG();
  36. private R_TRIG _trigSelectN2PurgeModeD = new R_TRIG();
  37. private FilterChecker _filterChecker = new FilterChecker();
  38. private R_TRIG tank1_TRIG = new R_TRIG();
  39. private R_TRIG tank2_TRIG = new R_TRIG();
  40. private Dictionary<string, Tuple<R_TRIG, List<Tuple<IDevice, string>>>> _n2PurgeSequenceAction;
  41. private Dictionary<string, Func<bool>> _n2PurgeSequenceStatus;
  42. private Dictionary<string, R_TRIG> _rTrigDict;
  43. private N2PurgeModeEnum _N2PurgeMode = N2PurgeModeEnum.Auto;
  44. private double _n2PurgeData = 20;
  45. private double _n2ToAirData = 185000;
  46. private N2PurgeModeEnum _currentPhase;
  47. private double _manualPhase2StabilityTime = 0;
  48. private double _manualPhase4StabilityTime = 0;
  49. private bool _enableAbortN2purge = true;
  50. private int _phase1CycleCount = 0;
  51. private int _phase1CycleCountSC = 0;
  52. private bool _canSwitchToPhase2 = true;
  53. private Dictionary<string, Stopwatch> _allTimeDict = new Dictionary<string, Stopwatch>();
  54. private void InitN2PurgeData()
  55. {
  56. DATA.Subscribe($"{Module}.N2PurgeLimitData", () => GetN2PurgeLimitData());
  57. DATA.Subscribe($"{Module}.O2DensityData", () => ConcentrationO2.Value.ToString("f3"), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  58. DATA.Subscribe($"{Module}.CheckO2Location", () => GetCheckO2Location(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  59. DATA.Subscribe($"{Module}.O2SetCheckSetPoint", () => GetO2SetCheckSetPoint(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  60. DATA.Subscribe($"{Module}.N2PurgeMode", () => SC.ContainsItem("PM1.SelectN2PurgeMode") ? SC.GetStringValue("PM1.SelectN2PurgeMode") : "");
  61. var selectN2PurgeMode = SC.ContainsItem("PM1.SelectN2PurgeMode") ? SC.GetStringValue("PM1.SelectN2PurgeMode") : "";
  62. if (!string.IsNullOrEmpty(selectN2PurgeMode))
  63. {
  64. if (selectN2PurgeMode != _N2PurgeMode.ToString())
  65. {
  66. SetN2PurgeModeAction(selectN2PurgeMode);
  67. }
  68. }
  69. var currentPhase = SC.ContainsItem("PM1.SelectN2PurgeModePhase") ? SC.GetStringValue("PM1.SelectN2PurgeModePhase") : "";
  70. if (!string.IsNullOrEmpty(currentPhase))
  71. {
  72. var enumCurrentPhase = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), currentPhase);
  73. _currentPhase = enumCurrentPhase;
  74. }
  75. }
  76. private void InitN2PurgeConfigData()
  77. {
  78. _n2PurgeData = SC.ContainsItem($"System.N2PurgeData") ? SC.GetValue<double>("System.N2PurgeData") : 20;
  79. _n2ToAirData = SC.ContainsItem($"System.N2PurgeData") ? SC.GetValue<double>("System.N2ToAirData") : 185000;
  80. _enableAbortN2purge = SC.ContainsItem($"PM1.N2Purge.EnableAbortN2purge") ? SC.GetValue<bool>("PM1.N2Purge.EnableAbortN2purge") : false;
  81. _manualPhase2StabilityTime = SC.ContainsItem($"PM1.N2Purge.Manual_phase2.StabilityTime") ? SC.GetValue<double>("PM1.N2Purge.Manual_phase2.StabilityTime") : 0;
  82. _manualPhase4StabilityTime = SC.ContainsItem($"PM1.N2Purge.Manual_phase4.StabilityTime") ? SC.GetValue<double>("PM1.N2Purge.Manual_phase4.StabilityTime") : 0;
  83. _phase1CycleCountSC = SC.ContainsItem($"PM1.N2Purge.Manual_phase1.CycleCount") ? SC.GetValue<int>("PM1.N2Purge.Manual_phase1.CycleCount") : 0;
  84. _n2PurgeSequenceAction = ExtractionMethods.GetN2PurgeSequenceAction();
  85. _n2PurgeSequenceStatus = new Dictionary<string, Func<bool>>()
  86. {
  87. {"N2PurgeAIRTo20PPM",()=> GetN2PurgeAIRTo20PPMStatus()},
  88. {"N2PurgeUnder20PPM",()=> GetN2PurgeUnder20PPMStatus()},
  89. {"AIR",()=> GetN2PurgeAIRStatus()},
  90. {"DoorOpen",()=> GetN2PurgeDoorOpenStatus()},
  91. {"Foup1",()=> GetN2PurgeFoup1Status()},
  92. {"Foup2",()=> GetN2PurgeFoup2Status()},
  93. {N2PurgeModeEnum.Manual_phase1.ToString(),()=> CheckN2PurgePhase1() },
  94. {N2PurgeModeEnum.Manual_phase2.ToString(),()=> CheckN2PurgePhase2()},
  95. {N2PurgeModeEnum.Manual_phase3.ToString(),()=> CheckN2PurgePhase3() },
  96. {N2PurgeModeEnum.Manual_phase4.ToString(),()=> CheckN2PurgePhase4() },
  97. {N2PurgeModeEnum.Manual_phase5.ToString(),()=> CheckN2PurgePhase5() },
  98. };
  99. _allTimeDict = new Dictionary<string, Stopwatch>()
  100. {
  101. {N2PurgeModeEnum.Manual_phase1.ToString(),new Stopwatch() },
  102. {N2PurgeModeEnum.Manual_phase2.ToString(),new Stopwatch()},
  103. {N2PurgeModeEnum.Manual_phase3.ToString(),new Stopwatch()},
  104. {N2PurgeModeEnum.Manual_phase4.ToString(),new Stopwatch() },
  105. {N2PurgeModeEnum.Manual_phase5.ToString(),new Stopwatch() }
  106. };
  107. _rTrigDict = new Dictionary<string, R_TRIG>();
  108. }
  109. private void MonitorN2Purge()
  110. {
  111. var selectN2PurgeMode = SC.ContainsItem("PM1.SelectN2PurgeMode") ? SC.GetStringValue("PM1.SelectN2PurgeMode") : "";
  112. if (string.IsNullOrEmpty(selectN2PurgeMode))
  113. {
  114. return;
  115. }
  116. SetN2PurgeModeAction(selectN2PurgeMode);
  117. }
  118. private void MonitorTank1LeakAgeExec()
  119. {
  120. tank1_TRIG.CLK = SensorHCDTANKH != null && SensorHCDTANKH.Value;
  121. if (tank1_TRIG.Q)
  122. {
  123. LOG.Info($"SensorHCDTANKH trigger:{SensorHCDTANKH.Value}");
  124. SetHREFEnable(new object[1] { false });
  125. ValveAV113?.TurnValve(false, out _);
  126. }
  127. if ((SensorHCDTANKH != null && SensorHCDTANKH.Value) && TrigSIREFON.Value)
  128. {
  129. LOG.Info($"SensorHCDTANKH trigger:{SensorHCDTANKH.Value},TrigCREFON:{TrigSIREFON.Value}");
  130. SetHREFEnable(new object[1] { false });
  131. ValveAV113?.TurnValve(false, out _);
  132. }
  133. }
  134. public bool SetHREFEnable(object[] param)
  135. {
  136. if (param == null || param.Length <= 0)
  137. return true;
  138. bool.TryParse(param[0].ToString(), out bool isEnable);
  139. if (isEnable)
  140. {
  141. if (SensorHREFILK != null && SensorHREFILK.Value)
  142. {
  143. TrigSIREFON?.CheckAndSet(isEnable, out _);
  144. }
  145. }
  146. else
  147. {
  148. TrigSIREFON?.CheckAndSet(isEnable, out _);
  149. }
  150. return true;
  151. }
  152. private void MonitorTank2LeakAgeExec()
  153. {
  154. tank2_TRIG.CLK = SensorCSOURCETANKH != null && SensorCSOURCETANKH.Value;
  155. if (tank2_TRIG.Q)
  156. {
  157. LOG.Info($"SensorCSOURCETANKH trigger:{SensorCSOURCETANKH.Value}");
  158. SetCREFEnable(new object[1] { false });
  159. ValveAV121?.TurnValve(false, out _);
  160. }
  161. if ((SensorCSOURCETANKH != null && SensorCSOURCETANKH.Value) && (TrigCREFON != null && TrigCREFON.Value))
  162. {
  163. LOG.Info($"SensorCSOURCETANKH trigger:{SensorCSOURCETANKH.Value},TrigCREFON:{TrigCREFON.Value}");
  164. SetCREFEnable(new object[1] { false });
  165. ValveAV121?.TurnValve(false, out _);
  166. }
  167. }
  168. public bool SetCREFEnable(object[] param)
  169. {
  170. if (param == null || param.Length <= 0)
  171. return true;
  172. bool.TryParse(param[0].ToString(), out bool isEnable);
  173. if (isEnable)
  174. {
  175. if (SensorCREFILK != null && SensorCREFILK.Value)
  176. {
  177. TrigCREFON?.CheckAndSet(isEnable, out _);
  178. }
  179. }
  180. else
  181. {
  182. TrigCREFON?.CheckAndSet(isEnable, out _);
  183. }
  184. return true;
  185. }
  186. public void SetN2PurgeModePhase(string setValue)
  187. {
  188. if (SC.ContainsItem("PM1.N2PurgeModePhase"))
  189. {
  190. var data = SC.GetStringValue("PM1.N2PurgeModePhase");
  191. if (data != setValue)
  192. {
  193. SC.SetItemValue("PM1.N2PurgeModePhase", setValue);
  194. }
  195. }
  196. }
  197. /// <summary>
  198. /// TODO:这里展示数据的逻辑 不正确,待明确逻辑
  199. /// </summary>
  200. /// <returns></returns>
  201. private double GetN2PurgeLimitData()
  202. {
  203. if (_N2PurgeMode == N2PurgeModeEnum.N2PurgeMode)
  204. {
  205. if ((SensorO2DetectSideFIMS1 != null && SensorO2DetectSideFIMS1.Value) || (SensorO2DetectSideFIMS2 != null && SensorO2DetectSideFIMS2.Value))
  206. {
  207. if (SC.ContainsItem("PM1.N2PurgeModePhase"))
  208. {
  209. var n2PurgeModePhase = SC.GetStringValue("PM1.N2PurgeModePhase");
  210. if (n2PurgeModePhase == N2PurgeModeEnum.WaferCharge.ToString())
  211. {
  212. return (float)SC.GetValue<double>("PM1.N2Purge.WaferCharge.FOUPO2CheckSV");
  213. }
  214. else if (n2PurgeModePhase == N2PurgeModeEnum.FoupEnter.ToString())
  215. {
  216. return (float)SC.GetValue<double>("PM1.N2Purge.FoupEnter.FOUPO2CheckSV");
  217. }
  218. else if (n2PurgeModePhase == N2PurgeModeEnum.WaferDisCharge.ToString())
  219. {
  220. return (float)SC.GetValue<double>("PM1.N2Purge.WaferDisCharge.FOUPO2CheckSV");
  221. }
  222. return (float)SC.GetValue<double>("System.N2PurgeData");
  223. }
  224. }
  225. if (CheckIsLASide())
  226. {
  227. if (SC.ContainsItem("PM1.N2PurgeModePhase"))
  228. {
  229. var n2PurgeModePhase = SC.GetStringValue("PM1.N2PurgeModePhase");
  230. if (n2PurgeModePhase == N2PurgeModeEnum.BoatLoad.ToString())
  231. {
  232. return (float)SC.GetValue<double>("PM1.N2Purge.BoatLoad.LAO2CheckSV");
  233. }
  234. if (n2PurgeModePhase == N2PurgeModeEnum.BoatUnLoad.ToString())
  235. {
  236. return (float)SC.GetValue<double>("PM1.N2Purge.BoatUnLoad.LAO2CheckSV");
  237. }
  238. if (n2PurgeModePhase == N2PurgeModeEnum.FoupEnter.ToString())
  239. {
  240. return (float)SC.GetValue<double>("PM1.N2Purge.FoupEnter.LAO2CheckSV");
  241. }
  242. if (n2PurgeModePhase == N2PurgeModeEnum.WaferCharge.ToString())
  243. {
  244. return (float)SC.GetValue<double>("PM1.N2Purge.WaferCharge.LAO2CheckSV");
  245. }
  246. if (n2PurgeModePhase == N2PurgeModeEnum.WaferDisCharge.ToString())
  247. {
  248. return (float)SC.GetValue<double>("PM1.N2Purge.WaferDisCharge.LAO2CheckSV");
  249. }
  250. if (n2PurgeModePhase == N2PurgeModeEnum.Idle.ToString())
  251. {
  252. return (float)SC.GetValue<double>("System.N2PurgeData");
  253. }
  254. return (float)SC.GetValue<double>("System.N2PurgeData");
  255. }
  256. }
  257. return _n2PurgeData;
  258. }
  259. if (_N2PurgeMode == N2PurgeModeEnum.ATMMode)
  260. {
  261. return _n2ToAirData;
  262. }
  263. return ConcentrationO2.Value;
  264. }
  265. private void SetN2PurgeModeAction(string selectN2PurgeMode)
  266. {
  267. _N2PurgeMode = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), selectN2PurgeMode);
  268. if (_N2PurgeMode == N2PurgeModeEnum.N2PurgeMode)
  269. {
  270. if (_currentPhase == N2PurgeModeEnum.Manual_phase1)
  271. {
  272. _filterChecker.CheckInterval = 3;
  273. _filterChecker.Monitor(CheckN2PurgePhase2());
  274. if (_filterChecker.Trig && _canSwitchToPhase2)
  275. {
  276. LOG.Info($" N2PurgeMode Trigger from Manual_phase1 to Manual_phase2,O2:{ConcentrationO2.Value}");
  277. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase2.ToString());
  278. }
  279. }
  280. else if (_currentPhase == N2PurgeModeEnum.Manual_phase2)
  281. {
  282. if (!_allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].IsRunning && _canSwitchToPhase2)
  283. {
  284. _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Restart();
  285. }
  286. var second = _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Elapsed.TotalSeconds;
  287. if (second >= _manualPhase2StabilityTime)
  288. {
  289. if (CheckN2PurgePhase1())
  290. {
  291. LOG.Info($"N2PurgeMode Trigger Manual_phase1 was triggered {second} seconds later,O2:{ConcentrationO2.Value}");
  292. N2PurgeFaileAlarm.Set();
  293. _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Restart();
  294. _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Stop();
  295. _canSwitchToPhase2 = false;
  296. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase1.ToString());
  297. }
  298. if (CheckN2PurgePhase2())
  299. {
  300. LOG.Info($"N2PurgeMode Trigger Hold Manual_phase2 was triggered {second} seconds later,O2:{ConcentrationO2.Value}");
  301. _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Restart();
  302. _allTimeDict[N2PurgeModeEnum.Manual_phase2.ToString()].Stop();
  303. _canSwitchToPhase2 = false;
  304. }
  305. }
  306. }
  307. else
  308. {
  309. if (CheckN2PurgePhase1())
  310. {
  311. LOG.Info($"N2PurgeMode Trigger Directly triggered Manual_phase1,O2:{ConcentrationO2.Value}");
  312. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase1.ToString());
  313. }
  314. else if (CheckN2PurgePhase2())
  315. {
  316. LOG.Info($"N2PurgeMode Trigger Directly triggered Manual_phase2,O2:{ConcentrationO2.Value}");
  317. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase2.ToString());
  318. }
  319. }
  320. }
  321. if (_N2PurgeMode == N2PurgeModeEnum.ATMMode)
  322. {
  323. if (_currentPhase == N2PurgeModeEnum.Manual_phase3)
  324. {
  325. var checkResult = CheckN2PurgePhase4();
  326. if (!_allTimeDict[N2PurgeModeEnum.Manual_phase4.ToString()].IsRunning)
  327. {
  328. _allTimeDict[N2PurgeModeEnum.Manual_phase4.ToString()].Restart();
  329. }
  330. var second = _allTimeDict[N2PurgeModeEnum.Manual_phase4.ToString()].Elapsed.TotalSeconds;
  331. if (second >= _manualPhase4StabilityTime && checkResult)
  332. {
  333. LOG.Info($"N2PurgeMode Trigger from Manual_phase3 to Manual_phase4 is triggered {second} seconds later,O2:{ConcentrationO2.Value}");
  334. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase4.ToString());
  335. _allTimeDict[N2PurgeModeEnum.Manual_phase4.ToString()].Restart();
  336. _allTimeDict[N2PurgeModeEnum.Manual_phase4.ToString()].Stop();
  337. }
  338. }
  339. else if (_currentPhase == N2PurgeModeEnum.Manual_phase4)
  340. {
  341. if (CheckN2PurgePhase5())
  342. {
  343. LOG.Info($"N2PurgeMode Trigger from Manual_phase4 to Manual_phase5,O2:{ConcentrationO2.Value}");
  344. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase5.ToString());
  345. }
  346. //if (CheckN2PurgePhase3( ))
  347. //{
  348. // LOG.Info($"N2PurgeMode Trigger from Manual_phase4 to Manual_phase3,O2:{o2Value}");
  349. // SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase3.ToString());
  350. //}
  351. }
  352. else if (_currentPhase == N2PurgeModeEnum.Manual_phase5)
  353. {
  354. if (CheckN2PurgePhase4())
  355. {
  356. LOG.Info($"N2PurgeMode Trigger from Manual_phase5 to Manual_phase4,O2:{ConcentrationO2.Value}");
  357. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase4.ToString());
  358. }
  359. //if (CheckN2PurgePhase3( ))
  360. //{
  361. // LOG.Info($"N2PurgeMode Trigger from Manual_phase5 to Manual_phase3,O2:{o2Value}");
  362. // SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase3.ToString());
  363. //}
  364. }
  365. else
  366. {
  367. if (CheckN2PurgePhase3())
  368. {
  369. LOG.Info($"N2PurgeMode Trigger Directly triggered Manual_phase3,O2:{ConcentrationO2.Value}");
  370. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase3.ToString());
  371. return;
  372. }
  373. if (CheckN2PurgePhase5())
  374. {
  375. LOG.Info($"N2PurgeMode Trigger Directly triggered Manual_phase5,O2:{ConcentrationO2.Value}");
  376. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase5.ToString());
  377. return;
  378. }
  379. if (CheckN2PurgePhase4())
  380. {
  381. LOG.Info($"N2PurgeMode Trigger Directly triggered Manual_phase4,O2:{ConcentrationO2.Value}");
  382. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase4.ToString());
  383. return;
  384. }
  385. }
  386. }
  387. if (_N2PurgeMode == N2PurgeModeEnum.ManualMode || _N2PurgeMode == N2PurgeModeEnum.Auto)
  388. {
  389. _currentPhase = _N2PurgeMode;
  390. }
  391. //switch (_N2PurgeMode)
  392. //{
  393. // case N2PurgeModeEnum.Auto:
  394. // // 自动模式下的操作
  395. // break;
  396. // case N2PurgeModeEnum.ManualMode:
  397. // break;
  398. // case N2PurgeModeEnum.N2PurgeMode:
  399. // ProcessPhase(_trigN2UpRD, N2PurgeModeEnum.Manual_phase1.ToString());
  400. // ProcessPhase(_trigN2DownRD, N2PurgeModeEnum.Manual_phase2.ToString(), _manualPhase2NeedCheck, (int)(_manualPhase2StabilityTime * 1000));
  401. // break;
  402. // case N2PurgeModeEnum.ATMMode:
  403. // ProcessPhase(_trigN2AirDownRD, N2PurgeModeEnum.Manual_phase3.ToString());
  404. // ProcessPhase(_trigN2AirUpRD, N2PurgeModeEnum.Manual_phase4.ToString(), _manualPhase4NeedCheck, (int)(_manualPhase4StabilityTime * 1000));
  405. // ProcessPhase(_trigN2AirDownTwoRD, N2PurgeModeEnum.Manual_phase5.ToString());
  406. // break;
  407. //}
  408. }
  409. bool CheckConditionInTime(string modeKey, int millisecondsTimeout, Func<bool> condition)
  410. {
  411. var stopwatch = _allTimeDict[modeKey];
  412. if (!_allTimeDict[modeKey].IsRunning)
  413. {
  414. _allTimeDict[modeKey].Restart();
  415. }
  416. while (stopwatch.ElapsedMilliseconds < millisecondsTimeout)
  417. {
  418. if (!_allTimeDict[modeKey].IsRunning)
  419. {
  420. return true;
  421. }
  422. if (!condition())
  423. {
  424. _allTimeDict[modeKey].Stop();
  425. _allTimeDict[modeKey].Reset();
  426. return false;
  427. }
  428. }
  429. if (stopwatch.ElapsedMilliseconds > millisecondsTimeout)
  430. {
  431. _allTimeDict[modeKey].Stop();
  432. _allTimeDict[modeKey].Reset();
  433. }
  434. return true;
  435. }
  436. private void ProcessPhase(R_TRIG r_TRIG, string modeKey, bool needCheck = false, int time = 0)
  437. {
  438. r_TRIG.CLK = needCheck ? (CheckConditionInTime(modeKey, time, () => _n2PurgeSequenceStatus[modeKey].Invoke())) : _n2PurgeSequenceStatus[modeKey].Invoke();
  439. if (r_TRIG.Q)
  440. {
  441. LOG.Info($"N2PurgeMode Trigger {modeKey}!,O2:{ConcentrationO2.Value},time:{_allTimeDict[modeKey].ElapsedMilliseconds}");
  442. SetN2PurgeValveData(modeKey);
  443. _allTimeDict[modeKey].Stop();
  444. _allTimeDict[modeKey].Reset();
  445. }
  446. }
  447. public void RestAllN2PrugeRD()
  448. {
  449. _trigN2AirDownRD.RST = false;
  450. _trigN2AirUpRD.RST = false;
  451. _trigN2DownRD.RST = false;
  452. _trigN2UpRD.RST = false;
  453. foreach (var item in _allTimeDict)
  454. {
  455. item.Value.Stop();
  456. item.Value.Reset();
  457. }
  458. _canSwitchToPhase2 = true;
  459. }
  460. public void SetN2PurgeValveData(string mode, string msg = "")
  461. {
  462. var value = _n2PurgeSequenceAction[mode];
  463. _currentPhase = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), mode);
  464. if (SC.ContainsItem("PM1.SelectN2PurgeModePhase"))
  465. {
  466. SC.SetItemValue("PM1.SelectN2PurgeModePhase", mode);
  467. }
  468. foreach (var operateItem in value.Item2)
  469. {
  470. if (operateItem.Item1 is IoMFC)
  471. {
  472. var ioMFc = (operateItem.Item1 as IoMFC);
  473. { ioMFc.SetMfcValue(out _, 0, new object[] { float.Parse(operateItem.Item2.ToString()) }); }
  474. }
  475. if (operateItem.Item1 is IoValve)
  476. {
  477. var ioValve = (operateItem.Item1 as IoValve);
  478. ioValve.TurnValve(bool.Parse(operateItem.Item2), out _);
  479. }
  480. if (operateItem.Item1 is IoTrigger)
  481. {
  482. var ioTrigger = (operateItem.Item1 as IoTrigger);
  483. ioTrigger.CheckAndSet(bool.Parse(operateItem.Item2), out _);
  484. }
  485. }
  486. }
  487. private bool SetN2PurgeMode(out string reason, int time, object[] param)
  488. {
  489. reason = string.Empty;
  490. var mode = param[0].ToString();
  491. _N2PurgeMode = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), mode);
  492. if (SC.ContainsItem("PM1.SelectN2PurgeMode"))
  493. {
  494. SC.SetItemValue("PM1.SelectN2PurgeMode", mode);
  495. }
  496. RestAllN2PrugeRD();
  497. return true;
  498. }
  499. /// <summary>
  500. /// 获取当前O2检测位置的设定值
  501. /// TODO:这里展示数据的逻辑也不正确,待明确逻辑
  502. /// </summary>
  503. /// <returns></returns>
  504. private string GetO2SetCheckSetPoint()
  505. {
  506. if (SensorO2DetectSideLA != null && SensorO2DetectSideLA.Value)
  507. {
  508. var key = "PM1.N2Purge.N2PurgeLAO2CheckSV";
  509. if (SC.ContainsItem(key))
  510. return SC.GetValue<double>(key).ToString("f3");
  511. }
  512. if ((SensorO2DetectSideFIMS1 != null && SensorO2DetectSideFIMS1.Value) || (SensorO2DetectSideFIMS2 != null && SensorO2DetectSideFIMS2.Value))
  513. {
  514. var key = "PM1.N2Purge.N2PurgeFOUPO2CheckSV";
  515. if (SC.ContainsItem(key))
  516. return SC.GetValue<double>(key).ToString("f3");
  517. }
  518. return "";
  519. }
  520. /// <summary>
  521. /// 获取当前O2检测位置
  522. /// </summary>
  523. /// <returns></returns>
  524. private string GetCheckO2Location()
  525. {
  526. if (SensorO2DetectSideLA != null && SensorO2DetectSideLA.Value)
  527. return SensorO2DetectSideLA.Display;
  528. if (SensorO2DetectSideFIMS1 != null && SensorO2DetectSideFIMS1.Value)
  529. return SensorO2DetectSideFIMS1.Display;
  530. if (SensorO2DetectSideFIMS2 != null && SensorO2DetectSideFIMS2.Value)
  531. return SensorO2DetectSideFIMS2.Display;
  532. return "";
  533. }
  534. /// <summary>
  535. /// 获取当前O2浓度
  536. /// </summary>
  537. /// <returns></returns>
  538. public bool CheckIsLASide()
  539. {
  540. if (SensorO2DetectSideLA == null)
  541. {
  542. return false;
  543. }
  544. return SensorO2DetectSideLA.Value;
  545. }
  546. private bool CheckN2PurgePhase1()
  547. {
  548. return ((int)ConcentrationO2.Value >= _n2PurgeData) && GetLADoorOpenStatus() && CheckIsLASide();
  549. }
  550. private bool CheckN2PurgePhase2()
  551. {
  552. return ((int)ConcentrationO2.Value < _n2PurgeData) && GetLADoorOpenStatus() && CheckIsLASide();
  553. }
  554. private bool CheckN2PurgePhase3()
  555. {
  556. return ((int)ConcentrationO2.Value) < _n2ToAirData && GetLADoorOpenStatus() && CheckIsLASide();
  557. }
  558. private bool CheckN2PurgePhase5()
  559. {
  560. return ((int)ConcentrationO2.Value) >= _n2ToAirData && !GetLADoorOpenStatus() && CheckIsLASide();
  561. }
  562. private bool CheckN2PurgePhase4()
  563. {
  564. return (((int)ConcentrationO2.Value)) >= _n2ToAirData && GetLADoorOpenStatus() && CheckIsLASide();
  565. }
  566. private bool GetN2PurgeAIRTo20PPMStatus()
  567. {
  568. return ValveAV202.DOOpen.Value;
  569. }
  570. public bool GetN2PurgeUnder20PPMStatus(double value = 20)
  571. {
  572. return ConcentrationO2.Value < value;
  573. }
  574. private bool GetN2PurgeAIRStatus()
  575. {
  576. return ValveAV202.DOClose.Value && (AlarmSignalFilterBox1DoorSwitch != null ? !AlarmSignalFilterBox1DoorSwitch.Value : false);
  577. }
  578. private bool GetLADoorOpenStatus()
  579. {
  580. return (bool)(SensorLADoorSw1?.Value);
  581. }
  582. private bool GetN2PurgeDoorOpenStatus()
  583. {
  584. return ValveAV202.DOClose.Value && (AlarmSignalFilterBox1DoorSwitch != null ? !AlarmSignalFilterBox1DoorSwitch.Value : false);
  585. }
  586. private bool GetN2PurgeFoup1Status()
  587. {
  588. return GetN2PurgeAIRTo20PPMStatus() && GetN2PurgeUnder20PPMStatus() && FIMS1.IsFoupExist && FIMS1.CollisionAvoidanceUpDownStatus == DeviceStatus.Down;
  589. }
  590. private bool GetN2PurgeFoup2Status()
  591. {
  592. return GetN2PurgeAIRTo20PPMStatus() && GetN2PurgeUnder20PPMStatus() && FIMS2.IsFoupExist && FIMS2.CollisionAvoidanceUpDownStatus == DeviceStatus.Down; ;
  593. }
  594. public bool IsAbortN2purge()
  595. {
  596. if (!_enableAbortN2purge)
  597. {
  598. return false;
  599. }
  600. if (SensorSL02001gasboxdoorsw11.Value || SensorSL02001gasboxdoorsw12.Value || SensorSL02002gasboxdoorsw11.Value || SensorSL02002gasboxdoorsw12.Value || SensorSL05002LAdoorsw2.Value || SensorSL05004LAfurnacedoorsw.Value)
  601. {
  602. return true;
  603. }
  604. return false;
  605. }
  606. public void SetN2PurgeLAO2CheckFirstEnable(bool isEable)
  607. {
  608. if (TrigN2PurgeLAO2CheckFirstEnable != null && TrigN2PurgeLAO2CheckFirstEnable.Value != isEable)
  609. {
  610. TrigN2PurgeLAO2CheckFirstEnable.SetTrigger(isEable, out _);
  611. }
  612. }
  613. public void SetN2PurgeFIMS1O2CheckEnable(ModuleName fims, bool isEable)
  614. {
  615. if (fims == ModuleName.FIMS1 && TrigN2PurgeFIMS1O2CheckEnable != null && TrigN2PurgeFIMS1O2CheckEnable.Value != isEable)
  616. {
  617. TrigN2PurgeFIMS1O2CheckEnable.SetTrigger(isEable, out _);
  618. }
  619. if (fims == ModuleName.FIMS2 && TrigN2PurgeFIMS2O2CheckEnable != null && TrigN2PurgeFIMS2O2CheckEnable.Value != isEable)
  620. {
  621. TrigN2PurgeFIMS2O2CheckEnable.SetTrigger(isEable, out _);
  622. }
  623. }
  624. public void SetN2PurgeProcess(bool isEable)
  625. {
  626. if (TrigN2PurgeProcess != null && TrigN2PurgeProcess.Value != isEable)
  627. {
  628. TrigN2PurgeProcess.SetTrigger(isEable, out _);
  629. }
  630. }
  631. public void SetN2PurgeLAO2CheckSV(float value)
  632. {
  633. if (TrigN2PurgeLAO2CheckSV != null)
  634. TrigN2PurgeLAO2CheckSV?.SetAOTrigger(value, out _);
  635. }
  636. public void SetN2PurgeFOUPO2CheckSV(float value)
  637. {
  638. if (TrigN2PurgeFOUPO2CheckSV != null)
  639. TrigN2PurgeFOUPO2CheckSV?.SetAOTrigger(value, out _);
  640. }
  641. /// <summary>
  642. /// N2Purge相关时间参数,电气要求设定为秒,实际下发按照毫秒
  643. /// </summary>
  644. public void SetN2PurgeParameters(string n2PurgeModeEnum)
  645. {
  646. if (SC.ContainsItem("PM1.N2Purge.TransferRoomArrivalWaitTime") && TrigN2PurgeLAO2CheckTime != null)
  647. {
  648. var time = (float)SC.GetValue<double>("PM1.N2Purge.TransferRoomArrivalWaitTime");
  649. TrigN2PurgeLAO2CheckTime.SetAOTrigger(time, out _);
  650. }
  651. if (SC.ContainsItem("PM1.N2Purge.TransferRoomStableWaitTime") && TrigN2PurgeLAO2OverTime != null)
  652. {
  653. var time = (float)SC.GetValue<double>("PM1.N2Purge.TransferRoomStableWaitTime");
  654. TrigN2PurgeLAO2OverTime.SetAOTrigger(time, out _);
  655. }
  656. if (SC.ContainsItem("PM1.N2Purge.FOUPOpenerArrivalWaitTime") && TrigN2PurgeFOUPO2CheckTime != null)
  657. {
  658. var time = (float)SC.GetValue<double>("PM1.N2Purge.FOUPOpenerArrivalWaitTime");
  659. TrigN2PurgeFOUPO2CheckTime.SetAOTrigger(time, out _);
  660. }
  661. if (SC.ContainsItem("PM1.N2Purge.FOUPOpenerStableWaitTime") && TrigN2PurgeFOUPO2OverTime != null)
  662. {
  663. var time = (float)SC.GetValue<double>("PM1.N2Purge.FOUPOpenerStableWaitTime");
  664. TrigN2PurgeFOUPO2OverTime.SetAOTrigger(time, out _);
  665. }
  666. if (SC.ContainsItem("PM1.N2Purge.O2DetectorTransferRoomToFOUPTime") && TrigN2PurgeExchangeLATOFOUPWaitTime != null)
  667. {
  668. var time = (float)SC.GetValue<double>("PM1.N2Purge.O2DetectorTransferRoomToFOUPTime");
  669. TrigN2PurgeExchangeLATOFOUPWaitTime.SetAOTrigger(time, out _);
  670. }
  671. if (SC.ContainsItem("PM1.N2Purge.O2DetectorFOUPToTransferRoomTime") && TrigN2PurgeExchangeFOUPTOLAWaitTime != null)
  672. {
  673. var time = (float)SC.GetValue<double>("PM1.N2Purge.O2DetectorFOUPToTransferRoomTime");
  674. TrigN2PurgeExchangeFOUPTOLAWaitTime.SetAOTrigger(time, out _);
  675. }
  676. if (SC.ContainsItem("PM1.N2Purge.O2DetectorFOUPToFOUPTime") && TrigN2PurgeExchangeFOUPTOFOUPWaitTime != null)
  677. {
  678. var time = (float)SC.GetValue<double>("PM1.N2Purge.O2DetectorFOUPToFOUPTime");
  679. TrigN2PurgeExchangeFOUPTOFOUPWaitTime.SetAOTrigger(time, out _);
  680. }
  681. if (SC.ContainsItem("PM1.N2PurgeModePhase"))
  682. {
  683. SC.SetItemValue("PM1.N2PurgeModePhase", n2PurgeModeEnum);
  684. }
  685. //这2个SV下发值应该根据什么阶段下发什么值
  686. if (n2PurgeModeEnum == N2PurgeModeEnum.WaferCharge.ToString())
  687. {
  688. SetN2PurgeFOUPO2CheckSV((float)GetWaferChargeFOUPO2CheckSV());
  689. SetN2PurgeLAO2CheckSV((float)GetWaferChargeLAO2CheckSV());
  690. if (GetWaferChargeLAN2purgeConfig())
  691. {
  692. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase1.ToString());
  693. RestAllN2PrugeRD();
  694. }
  695. }
  696. if (n2PurgeModeEnum == N2PurgeModeEnum.FoupEnter.ToString())
  697. {
  698. SetN2PurgeFOUPO2CheckSV((float)GetFoupEnterFOUPO2CheckSV());
  699. SetN2PurgeLAO2CheckSV((float)GetFoupEnterLAO2CheckSV());
  700. if (GetFoupEnterLAN2purgeConfig())
  701. {
  702. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase1.ToString());
  703. RestAllN2PrugeRD();
  704. }
  705. }
  706. if (n2PurgeModeEnum == N2PurgeModeEnum.WaferDisCharge.ToString())
  707. {
  708. SetN2PurgeFOUPO2CheckSV((float)GetWaferDisChargeFOUPO2CheckSV());
  709. SetN2PurgeLAO2CheckSV((float)GetWaferDisChargeLAO2CheckSV());
  710. if (GetWaferDisChargeLAN2purgeConfig())
  711. {
  712. SetN2PurgeValveData(N2PurgeModeEnum.Manual_phase1.ToString());
  713. RestAllN2PrugeRD();
  714. }
  715. }
  716. }
  717. /// <summary>
  718. /// Job start的时候,就根据Process的配置判定是否需要进行LA压氧
  719. /// </summary>
  720. /// <param name="n2PurgeModeStr"></param>
  721. public void InitN2PurgeMode(string n2PurgeModeStr)
  722. {
  723. if (string.IsNullOrEmpty(n2PurgeModeStr))
  724. return;
  725. if (n2PurgeModeStr.ToLower() == "none")
  726. return;
  727. if (SC.ContainsItem("PM1.RecipeRelevancyN2Purge") && SC.GetValue<bool>("PM1.RecipeRelevancyN2Purge") && SC.ContainsItem("PM1.SelectN2PurgeMode"))
  728. {
  729. var setValue = GetN2PurgeModeEnumByStr(n2PurgeModeStr);
  730. SC.SetItemValueFromString("PM1.SelectN2PurgeMode", setValue);
  731. RestAllN2PrugeRD();
  732. }
  733. }
  734. public bool CheckFimsIsNeedOxygenPressure(bool fimsN2PurgeConfig, string recipeN2PurgeModeStr, out bool isCheckO2, bool isCheckRecipeHeader = true)
  735. {
  736. isCheckO2 = false;
  737. var currectN2PurgeModel = GetLACurrectN2purgeMode();
  738. if (isCheckRecipeHeader)
  739. {
  740. if (string.IsNullOrEmpty(recipeN2PurgeModeStr))
  741. return false;
  742. if (recipeN2PurgeModeStr.ToLower().Equals("n2 purge"))
  743. {
  744. recipeN2PurgeModeStr = N2PurgeModeEnum.N2PurgeMode.ToString();
  745. }
  746. if (recipeN2PurgeModeStr.ToLower().Contains("atm"))
  747. {
  748. recipeN2PurgeModeStr = IsATMMode(recipeN2PurgeModeStr);
  749. }
  750. var n2PurgeEnum = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), recipeN2PurgeModeStr);
  751. if (n2PurgeEnum == N2PurgeModeEnum.ATMMode)
  752. return false;
  753. if (n2PurgeEnum == N2PurgeModeEnum.N2PurgeMode)
  754. {
  755. if (currectN2PurgeModel == N2PurgeModeEnum.N2PurgeMode.ToString() || currectN2PurgeModel == N2PurgeModeEnum.ATMMode.ToString() || currectN2PurgeModel == N2PurgeModeEnum.ManualMode.ToString())
  756. {
  757. if (fimsN2PurgeConfig)
  758. {
  759. isCheckO2 = true;
  760. return true;
  761. }
  762. else
  763. {
  764. return false;
  765. }
  766. }
  767. }
  768. if (n2PurgeEnum == N2PurgeModeEnum.None)
  769. {
  770. if (currectN2PurgeModel == N2PurgeModeEnum.ATMMode.ToString() || currectN2PurgeModel == N2PurgeModeEnum.ManualMode.ToString())
  771. {
  772. return false;
  773. }
  774. if (currectN2PurgeModel == N2PurgeModeEnum.N2PurgeMode.ToString())
  775. {
  776. if (fimsN2PurgeConfig)
  777. {
  778. isCheckO2 = true;
  779. return true;
  780. }
  781. else
  782. {
  783. return false;
  784. }
  785. }
  786. }
  787. }
  788. else
  789. {
  790. if (currectN2PurgeModel == N2PurgeModeEnum.N2PurgeMode.ToString() || currectN2PurgeModel == N2PurgeModeEnum.ManualMode.ToString())
  791. {
  792. if (fimsN2PurgeConfig)
  793. {
  794. isCheckO2 = true;
  795. return true;
  796. }
  797. else
  798. {
  799. return false;
  800. }
  801. }
  802. if (currectN2PurgeModel == N2PurgeModeEnum.ATMMode.ToString())
  803. {
  804. return false;
  805. }
  806. }
  807. return false;
  808. }
  809. public bool CheckLAIsNeedOxygenPressure(string recipeN2PurgeModeStr)
  810. {
  811. if (string.IsNullOrEmpty(recipeN2PurgeModeStr))
  812. return false;
  813. if (recipeN2PurgeModeStr.ToLower() == "none")
  814. return false;
  815. if (recipeN2PurgeModeStr.ToLower() == "atm")
  816. {
  817. recipeN2PurgeModeStr = N2PurgeModeEnum.ATMMode.ToString();
  818. }
  819. if (recipeN2PurgeModeStr.ToLower().Contains("n2"))
  820. {
  821. recipeN2PurgeModeStr = N2PurgeModeEnum.N2PurgeMode.ToString();
  822. }
  823. var n2PurgeEnum = (N2PurgeModeEnum)Enum.Parse(typeof(N2PurgeModeEnum), recipeN2PurgeModeStr);
  824. if (n2PurgeEnum == N2PurgeModeEnum.N2PurgeMode || n2PurgeEnum == N2PurgeModeEnum.ATMMode)
  825. return true;
  826. return false;
  827. }
  828. /// <summary>
  829. /// boat Move时候是否Check氧气浓度
  830. /// </summary>
  831. /// <param name="n2PurgeModeEnumStr"></param>
  832. /// <param name="isProcessing"></param>
  833. /// <param name="limitO2Data"></param>
  834. /// <returns></returns>
  835. public bool CheckBoatMoveIsNeedOxygenPressure(string n2PurgeModeEnumStr, bool isProcessing, out double limitO2Data)
  836. {
  837. limitO2Data = 0;
  838. if (!CheckIsLASide())
  839. return false;
  840. if (!isProcessing)
  841. return false;
  842. if (n2PurgeModeEnumStr == N2PurgeModeEnum.BoatLoad.ToString())
  843. {
  844. var isCheckO2Enbale = GetBoatLoadCheckO2DensityConfig();
  845. limitO2Data = GetBoatLoadLAO2CheckSV();
  846. return isCheckO2Enbale;
  847. }
  848. if (n2PurgeModeEnumStr == N2PurgeModeEnum.BoatUnLoad.ToString())
  849. {
  850. var isCheckO2Enbale = GetBoatUnLoadCheckO2DensityConfig();
  851. limitO2Data = GetBoatUnLoadLAO2CheckSV();
  852. return isCheckO2Enbale;
  853. }
  854. return false;
  855. }
  856. public string GetN2PurgeModeEnumByStr(string str)
  857. {
  858. if ((str == N2PurgeModeEnum.ATMMode.ToString()) || (str == N2PurgeModeEnum.ATMMode.ToDescription()) || (str.StartsWith("ATM")))
  859. {
  860. return N2PurgeModeEnum.ATMMode.ToString();
  861. }
  862. else if ((str == N2PurgeModeEnum.N2PurgeMode.ToString()) || (str == N2PurgeModeEnum.N2PurgeMode.ToDescription()) || (str.StartsWith("N2")))
  863. {
  864. return N2PurgeModeEnum.N2PurgeMode.ToString();
  865. }
  866. else
  867. {
  868. return GetLACurrectN2purgeMode();
  869. }
  870. }
  871. public string IsATMMode(string str)
  872. {
  873. if ((str == N2PurgeModeEnum.ATMMode.ToString()) || (str == N2PurgeModeEnum.ATMMode.ToDescription()) || (str.StartsWith("ATM")))
  874. {
  875. return N2PurgeModeEnum.ATMMode.ToString();
  876. }
  877. return str;
  878. }
  879. public string GetLACurrectN2purgeMode()
  880. {
  881. return SC.ContainsItem("PM1.SelectN2PurgeMode") ? SC.GetStringValue("PM1.SelectN2PurgeMode") : N2PurgeModeEnum.ManualMode.ToString();
  882. }
  883. #region FoupEnter
  884. public double GetFoupEnterLAO2CheckSV()
  885. {
  886. return SC.ContainsItem("PM1.N2Purge.FoupEnter.LAO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.FoupEnter.LAO2CheckSV") : 20;
  887. }
  888. public double GetFoupEnterFOUPO2CheckSV()
  889. {
  890. return SC.ContainsItem("PM1.N2Purge.FoupEnter.FOUPO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.FoupEnter.FOUPO2CheckSV") : 20;
  891. }
  892. public bool GetFoupEnterFIMSN2purgeConfig()
  893. {
  894. return SC.ContainsItem("PM1.N2Purge.FoupEnter.FOUPN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.FoupEnter.FOUPN2PurgeEnable") : false;
  895. }
  896. public bool GetFoupEnterLAN2purgeConfig()
  897. {
  898. return SC.ContainsItem("PM1.N2Purge.FoupEnter.TransferRoomN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.FoupEnter.TransferRoomN2PurgeEnable") : false;
  899. }
  900. #endregion
  901. #region WaferCharge
  902. public double GetWaferChargeLAO2CheckSV()
  903. {
  904. return SC.ContainsItem("PM1.N2Purge.WaferCharge.LAO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.WaferCharge.LAO2CheckSV") : 20;
  905. }
  906. public double GetWaferChargeFOUPO2CheckSV()
  907. {
  908. return SC.ContainsItem("PM1.N2Purge.WaferCharge.FOUPO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.WaferCharge.FOUPO2CheckSV") : 20;
  909. }
  910. public bool GetWaferChargeFIMSN2purgeConfig()
  911. {
  912. return SC.ContainsItem("PM1.N2Purge.WaferCharge.FOUPN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.WaferCharge.FOUPN2PurgeEnable") : false;
  913. }
  914. public bool GetWaferChargeLAN2purgeConfig()
  915. {
  916. return SC.ContainsItem("PM1.N2Purge.WaferCharge.TransferRoomN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.WaferCharge.TransferRoomN2PurgeEnable") : false;
  917. }
  918. #endregion
  919. #region WaferDisCharge
  920. public double GetWaferDisChargeLAO2CheckSV()
  921. {
  922. return SC.ContainsItem("PM1.N2Purge.WaferDisCharge.LAO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.WaferDisCharge.LAO2CheckSV") : 20;
  923. }
  924. public double GetWaferDisChargeFOUPO2CheckSV()
  925. {
  926. return SC.ContainsItem("PM1.N2Purge.WaferDisCharge.FOUPO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.WaferDisCharge.FOUPO2CheckSV") : 20;
  927. }
  928. public bool GetWaferDisChargeFIMSN2purgeConfig()
  929. {
  930. return SC.ContainsItem("PM1.N2Purge.WaferDisCharge.FOUPN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.WaferDisCharge.FOUPN2PurgeEnable") : false;
  931. }
  932. public bool GetWaferDisChargeLAN2purgeConfig()
  933. {
  934. return SC.ContainsItem("PM1.N2Purge.WaferDisCharge.TransferRoomN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.WaferDisCharge.TransferRoomN2PurgeEnable") : false;
  935. }
  936. #endregion
  937. #region Boat Load
  938. public double GetBoatLoadLAO2CheckSV()
  939. {
  940. return SC.ContainsItem("PM1.N2Purge.BoatLoad.LAO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.BoatLoad.LAO2CheckSV") : 20;
  941. }
  942. public bool GetBoatLoadCheckO2DensityConfig()
  943. {
  944. return SC.ContainsItem("PM1.N2Purge.BoatLoad.TransferRoomO2DensityCheckEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatLoad.TransferRoomO2DensityCheckEnable") : false;
  945. }
  946. public bool GetBoatLoadEAxisInhibitEnableConfig()
  947. {
  948. return SC.ContainsItem("PM1.N2Purge.BoatLoad.EAxisInhibitEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatLoad.EAxisInhibitEnable") : false;
  949. }
  950. public bool GetBoatLoadLAN2purgeConfig()
  951. {
  952. return SC.ContainsItem("PM1.N2Purge.BoatLoad.TransferRoomN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatLoad.TransferRoomN2PurgeEnable") : false;
  953. }
  954. #endregion
  955. #region BoatUnLoad
  956. public bool GetBoatUnLoadCheckO2DensityConfig()
  957. {
  958. return SC.ContainsItem("PM1.N2Purge.BoatUnLoad.TransferRoomO2DensityCheckEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatUnLoad.TransferRoomO2DensityCheckEnable") : false;
  959. }
  960. public bool GetBoatUnLoadEAxisInhibitEnableConfig()
  961. {
  962. return SC.ContainsItem("PM1.N2Purge.BoatUnLoad.EAxisInhibitEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatUnLoad.EAxisInhibitEnable") : false;
  963. }
  964. public double GetBoatUnLoadLAO2CheckSV()
  965. {
  966. return SC.ContainsItem("PM1.N2Purge.BoatUnLoad.LAO2CheckSV") ? SC.GetValue<double>("PM1.N2Purge.BoatUnLoad.LAO2CheckSV") : 20;
  967. }
  968. public bool GetBoatUnLoadLAN2purgeConfig()
  969. {
  970. return SC.ContainsItem("PM1.N2Purge.BoatUnLoad.TransferRoomN2PurgeEnable") ? SC.GetValue<bool>("PM1.N2Purge.BoatUnLoad.TransferRoomN2PurgeEnable") : false;
  971. }
  972. #endregion
  973. }
  974. }