PMRoutineBase.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. using System;
  2. using Aitex.Core.RT.Event;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using JetVirgoPM.Devices;
  6. using MECF.Framework.Common.DBCore;
  7. using MECF.Framework.Common.Routine;
  8. using MECF.Framework.Common.SubstrateTrackings;
  9. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  10. namespace JetVirgoPM.PMs.Routines
  11. {
  12. public enum MonitorStepState
  13. {
  14. Continue,
  15. Failed,
  16. Break,
  17. }
  18. class PMRoutineBase : ModuleRoutineBase
  19. {
  20. // ----------------------------Fields--------------------------
  21. //
  22. //private SCConfigItem scOpenGasValveTimeout = null;
  23. private int dOpenGasValveTimeout = 1; //1S
  24. //private SCConfigItem scCloseGasValveTimeout = null;
  25. public int dCloseGasValveTimeout = 2; //2s
  26. //private SCConfigItem scOpenCloseSlitValveTimeout = null;
  27. protected int valveOpenCloseTimeout = 2; //2s
  28. protected int _PressureTrip1 = 80;
  29. protected bool bUINotify;
  30. //public static Guid RecipeRunGuid;
  31. protected readonly JetDualPM _chamber;
  32. // --------------------------Properties------------------------
  33. //
  34. //状态持续时间,单位为秒
  35. public int Elapsed { get { return (int)(counter.GetElapseTime() / 1000); } }
  36. public string Display { get; set; }
  37. public string WaferID { get; set; }
  38. // Constructor
  39. protected PMRoutineBase(JetDualPM chamber):base(chamber.Module.ToString())
  40. {
  41. _chamber = chamber;
  42. bUINotify = true;
  43. dOpenGasValveTimeout = SC.GetValue<int>($"{Module}.OpenGasValveTimeout");
  44. dCloseGasValveTimeout = SC.GetValue<int>($"{Module}.TimeLimitOfCloseGasValve");
  45. valveOpenCloseTimeout = SC.GetValue<int>($"{Module}.OpenCloseSlitValveTimeout");
  46. }
  47. public RState CheckLid()
  48. {
  49. if (!_chamber.IsLidClosed)
  50. {
  51. this.Stop("Chamber 盖子必须关");
  52. return RState.Failed;
  53. }
  54. return RState.Running;
  55. }
  56. protected RState CheckSlitDoor1()
  57. {
  58. if (!_chamber.IsSlitDoor1Closed)
  59. {
  60. Stop("传送门1必须关");
  61. return RState.Failed;
  62. }
  63. return RState.Running;
  64. }
  65. protected RState CheckSlitDoor2()
  66. {
  67. if (!_chamber.IsSlitDoor2Closed)
  68. {
  69. Stop("传送门2必须关");
  70. return RState.Failed;
  71. }
  72. return RState.Running;
  73. }
  74. protected RState CheckDryPump()
  75. {
  76. if (!_chamber.IsPumpRunning)
  77. {
  78. Stop("泵没有启动");
  79. return RState.Failed;
  80. }
  81. if (_chamber.HasPumpError)
  82. {
  83. Stop("泵状态有错误");
  84. return RState.Failed;
  85. }
  86. return RState.Running;
  87. }
  88. protected bool FullOpenTV()
  89. {
  90. Notify("完全打开蝶阀");
  91. _chamber.FullOpenTV();
  92. return true;
  93. }
  94. protected bool CheckFullOpenTV()
  95. {
  96. if (_chamber.TVPosition >= 98)
  97. {
  98. Notify("蝶阀已经完全打开");
  99. return true;
  100. }
  101. return false;
  102. }
  103. protected bool CloseAllValve()
  104. {
  105. Notify("关闭所有的阀门");
  106. _chamber.CloseValves();
  107. return true;
  108. }
  109. protected bool OpenValve(ValveType vlv, bool bOpen)
  110. {
  111. _chamber.OpenValve(vlv, bOpen);
  112. Notify($"{(bOpen ? "打开" : "关闭")} {vlv} 阀");
  113. return true;
  114. }
  115. protected bool CheckValve(ValveType vlv, bool bOpen)
  116. {
  117. return _chamber.CheckValveSwitchStatus(vlv, bOpen);
  118. }
  119. protected bool ATM2(bool on)
  120. {
  121. Notify($"等待 ATM 信号 {(on ? "ON" : "OFF")}");
  122. return true;
  123. }
  124. protected bool CheckATM2(bool on)
  125. {
  126. return on ? _chamber.IsATM : !_chamber.IsATM;
  127. }
  128. protected bool WaitPressure(int targetPressure, bool morethan)
  129. {
  130. Notify($"等待压力{(morethan ? "上升" : "下降")} 到 {targetPressure:N} mTorr");
  131. return true;
  132. }
  133. protected bool CheckPressure(int targetPressure, bool morethan)
  134. {
  135. bool res = morethan ? _chamber.ChamberPressure > targetPressure : _chamber.ChamberPressure < targetPressure;
  136. if (res)
  137. {
  138. Notify($"压力已经到达 {targetPressure:N} mTorr");
  139. }
  140. return res;
  141. }
  142. protected bool Foreline(uint target)
  143. {
  144. Notify($"Check foreline pressure, 目标 {target} mTorr");
  145. return true;
  146. }
  147. protected bool CheckForeline(uint target)
  148. {
  149. return _chamber.ForelinePressure < target;
  150. }
  151. protected bool CheckVAC()
  152. {
  153. return _chamber.IsVAC;
  154. }
  155. protected bool SetLiftPinUpDown(EnumDualPM pos, bool isUp)
  156. {
  157. if (pos == EnumDualPM.Left || pos == EnumDualPM.Both)
  158. {
  159. Notify($"设置 lift pin 1 {_chamber.Name} " + (isUp ? "升" : "降"));
  160. if (!_chamber.SetLiftPin1(isUp ? MovementPosition.Up : MovementPosition.Down, out string reason))
  161. {
  162. Stop(reason);
  163. return false;
  164. }
  165. }
  166. if (pos == EnumDualPM.Right || pos == EnumDualPM.Both)
  167. {
  168. Notify($"设置 lift pin 2 {_chamber.Name} " + (isUp ? "升" : "降"));
  169. if (!_chamber.SetLiftPin2(isUp ? MovementPosition.Up : MovementPosition.Down, out string reason))
  170. {
  171. Stop(reason);
  172. return false;
  173. }
  174. }
  175. return true;
  176. }
  177. protected bool ChecktLiftPinUpDown(EnumDualPM pos, bool isUp)
  178. {
  179. return ((pos != EnumDualPM.Left && pos != EnumDualPM.Both) || (isUp ? _chamber.CheckLift1Up() : _chamber.CheckLift1Down())) &&
  180. ((pos != EnumDualPM.Right && pos != EnumDualPM.Both) || (isUp ? _chamber.CheckLift2Up() : _chamber.CheckLift2Down()));
  181. }
  182. protected bool SetSlitDoor(EnumDualPM pos, bool isOpen)
  183. {
  184. if(pos == EnumDualPM.Left || pos == EnumDualPM.Both)
  185. {
  186. Notify($"设置 {_chamber.Name} Slit Door 1 {(isOpen ? "开" : "关")} ");
  187. if (!_chamber.SetSlitDoor1(isOpen, out string reason1))
  188. {
  189. Stop(reason1);
  190. return false;
  191. }
  192. }
  193. if (pos == EnumDualPM.Right || pos == EnumDualPM.Both)
  194. {
  195. Notify($"设置 {_chamber.Name} Slit Door 2 {(isOpen ? "开" : "关")} ");
  196. if (!_chamber.SetSlitDoor2(isOpen, out string reason2))
  197. {
  198. Stop(reason2);
  199. return false;
  200. }
  201. }
  202. return true;
  203. }
  204. protected bool CheckSlitDoor(EnumDualPM pos, bool isOpen)
  205. {
  206. return ((pos != EnumDualPM.Left && pos != EnumDualPM.Both) || (isOpen ? _chamber.CheckSlitDoor1Open() : _chamber.CheckSlitDoor1Close())) &&
  207. ((pos != EnumDualPM.Right && pos != EnumDualPM.Both) || (isOpen ? _chamber.CheckSlitDoor2Open() : _chamber.CheckSlitDoor2Close()));
  208. }
  209. protected void End(int id)
  210. {
  211. bool Func()
  212. {
  213. double duration_min = counter.GetElapseTime();
  214. TimeSpan ts = TimeSpan.FromMilliseconds(duration_min);
  215. string info = $"完成 in {ts.Minutes} minutes {ts.Seconds} seconds";
  216. Notify(info);
  217. //if (bUINotify)
  218. // EV.PostPopDialogMessage(EventLevel.Information, Name, $"{Module} {info} Finished");
  219. return true;
  220. }
  221. //Runner.End(id, Func, _delay_1s);
  222. }
  223. protected bool EndFunc()
  224. {
  225. double duration_min = counter.GetElapseTime();
  226. TimeSpan ts = TimeSpan.FromMilliseconds(duration_min);
  227. string info = $"完成 in {ts.Minutes} minutes {ts.Seconds} seconds";
  228. Notify(info);
  229. return true;
  230. }
  231. public virtual void Abort()
  232. {
  233. _chamber.Generator1PowerOn(false);
  234. _chamber.GeneratorBias1PowerOn(false);
  235. _chamber.Generator2PowerOn(false);
  236. _chamber.GeneratorBias2PowerOn(false);
  237. _chamber.StopAllGases();
  238. //ProcessDataRecorder.UpdateStatus(RecipeRunGuid.ToString(), SusceptorStatus.Failed.ToString(), Module);
  239. }
  240. public bool CloseValve()
  241. {
  242. Notify("Vent End Close Vent Valve");
  243. _chamber.OpenValve(ValveType.PURGE, false);
  244. _chamber.OpenValve(ValveType.FAST_VENT, false);
  245. _chamber.OpenValve(ValveType.PROCESS, false);
  246. //_chamber.OpenValve(ValveType.SOFT_PUMP, true);
  247. //_chamber.OpenValve(ValveType.FAST_PUMP, true);
  248. return true;
  249. }
  250. protected bool Pump(int target)
  251. {
  252. Notify($"Pumping to {target} mTorr");
  253. _chamber.OpenValve(ValveType.PROCESS, false);
  254. _chamber.OpenValve(ValveType.PURGE, false);
  255. _chamber.OpenValve(ValveType.FAST_VENT, false);
  256. _chamber.OpenValve(ValveType.FAST_PUMP, true);
  257. return true;
  258. }
  259. protected bool CheckPump(int target, bool isStopPumpOnceDone)
  260. {
  261. if (_chamber.ChamberPressure < target)
  262. {
  263. if (isStopPumpOnceDone)
  264. {
  265. _chamber.OpenValve(ValveType.FAST_PUMP, false);
  266. }
  267. return true;
  268. }
  269. return true;
  270. }
  271. protected bool Vent(int target)
  272. {
  273. Notify($"Venting to {target} mTorr");
  274. _chamber.OpenValve(ValveType.FAST_VENT, false);
  275. _chamber.OpenValve(ValveType.FAST_PUMP, false);
  276. _chamber.OpenValve(ValveType.PROCESS, true);
  277. _chamber.OpenValve(ValveType.PURGE, true);
  278. _chamber.OpenValve(ValveType.N2, true);
  279. return true;
  280. }
  281. protected bool CheckVent(int target, bool isStopVentOnceDone)
  282. {
  283. if (_chamber.ChamberPressurePressure > target)
  284. {
  285. if (isStopVentOnceDone)
  286. {
  287. _chamber.OpenValve(ValveType.PROCESS, false);
  288. _chamber.OpenValve(ValveType.PURGE, false);
  289. _chamber.OpenValve(ValveType.N2, false);
  290. }
  291. return true;
  292. }
  293. return false;
  294. }
  295. protected bool SetLETemp(double target1, double target2, double tolerance, bool enableLE1, bool enableLE2)
  296. {
  297. if (enableLE1)
  298. {
  299. if (_chamber.LETempFB1 > target1)
  300. {
  301. Notify($"{_chamber.LETempFB1Name}当前温度{_chamber.LETempFB1} ℃, 大于目标 {target1.ToString()} ℃");
  302. //return true;
  303. }
  304. //if (!(Math.Abs(_chamber.LETempFB1 - target1) <= tolerance))
  305. {
  306. _chamber.HeatLE1(target1);
  307. }
  308. Notify($"检查底座温度值,{_chamber.LETempFB1Name}当前温度{_chamber.LETempFB1} ℃, 目标 {target1.ToString()} ℃");
  309. }
  310. if (enableLE2)
  311. {
  312. if (_chamber.LETempFB2 > target2)
  313. {
  314. Notify($"{_chamber.LETempFB2Name}当前温度{_chamber.LETempFB2} ℃, 大于目标 {target2.ToString()} ℃");
  315. //return true;
  316. }
  317. //if (!(Math.Abs(_chamber.LETempFB2 - target2) <= tolerance))
  318. {
  319. _chamber.HeatLE2(target2);
  320. }
  321. Notify($"检查底座温度值,{_chamber.LETempFB2Name}当前温度{_chamber.LETempFB2} ℃, 目标 {target2.ToString()} ℃");
  322. }
  323. return true;
  324. }
  325. protected bool CheckLETemp(double target1, double target2, double tolerance, bool enableLE1, bool enableLE2)
  326. {
  327. return (!enableLE1 || Math.Abs(_chamber.LETempFB1 - target1) <= tolerance) &&
  328. (!enableLE2 || Math.Abs(_chamber.LETempFB2 - target2) <= tolerance);
  329. }
  330. protected bool SetCoolant1Temp(double target, double offset, double tolerance)
  331. {
  332. if (_chamber.CoolantOutletTempFB1 > target)
  333. {
  334. Notify($"水冷当前温度{_chamber.CoolantOutletTempFB1} ℃, 大于目标 {target.ToString()} ℃");
  335. //return true;
  336. }
  337. //if (!(Math.Abs(_chamber.CoolantOutletTempFB1 - target) <= tolerance))
  338. {
  339. _chamber.HeatChiller1(target, offset);
  340. }
  341. Notify($"检查水冷温度值,当前温度{_chamber.CoolantOutletTempFB1} ℃, 目标 {target.ToString()} ℃");
  342. return true;
  343. }
  344. protected bool CheckCoolant1Temp(double target, double offset, double tolerance)
  345. {
  346. return Math.Abs(_chamber.CoolantOutletTempFB1 - target) <= tolerance;
  347. }
  348. protected bool SetCoolant2Temp(double target, double offset, double tolerance)
  349. {
  350. if (_chamber.CoolantOutletTempFB2 > target)
  351. {
  352. Notify($"水冷当前温度{_chamber.CoolantOutletTempFB2} ℃, 大于目标 {target.ToString()} ℃");
  353. //return true;
  354. }
  355. //if (!(Math.Abs(_chamber.CoolantOutletTempFB2 - target) <= tolerance))
  356. {
  357. _chamber.HeatChiller2(target, offset);
  358. }
  359. Notify($"检查水冷温度值,当前温度{_chamber.CoolantOutletTempFB2} ℃, 目标 {target.ToString()} ℃");
  360. return true;
  361. }
  362. protected bool CheckCoolant2Temp(double target, double offset, double tolerance)
  363. {
  364. return Math.Abs(_chamber.CoolantOutletTempFB2 - target) <= tolerance;
  365. }
  366. }
  367. }