PreProcess.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.RecipeCenter;
  6. using Aitex.Core.RT.Routine;
  7. using Aitex.Core.RT.SCCore;
  8. using MECF.Framework.Common.DBCore;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using VirgoRT.Devices;
  12. //using VirgoCommon;
  13. namespace VirgoRT.Modules.PMs
  14. {
  15. class PreProcessRoutine : PMRoutineBase
  16. {
  17. public enum Routine
  18. {
  19. DelayForTest,
  20. CheckDoor,
  21. CheckDryPump,
  22. PumpDown,
  23. //PostPumpDown,
  24. SetRfMatchMode,
  25. SetElectrodeTemp,
  26. SetHeaterTemp,
  27. SetLiftPin,
  28. //PinDownAndPump,
  29. End,
  30. }
  31. //---------------------------------Fields----------------------------------------
  32. //
  33. private readonly PumpDownRoutine _pumpRoutine;
  34. private readonly TemperatureControlRoutine _TempRoutine;
  35. private int _checkSubstrateTempTimeout = 60;
  36. private double _tolerance;
  37. private double _OffsetTemp = 0.0f;
  38. //---------------------------------Properties------------------------------------
  39. //
  40. public string CurrentRecipeBaseName { get; private set; }
  41. public string CurrentRecipeRunningName { get; private set; }
  42. public string CurrentRecipeContent { get; private set; }
  43. public string CurrentLotName { get; set; }
  44. public List<RecipeStep> CurrentRecipeStepList { get; set; }
  45. public RecipeHead CurrentRecipeHead { get; set; }
  46. private bool _withWafer;
  47. private double BasePressure
  48. {
  49. get
  50. {
  51. if (CurrentRecipeHead != null)
  52. {
  53. if (!string.IsNullOrEmpty(CurrentRecipeHead.BasePressure))
  54. {
  55. double setpoint = Convert.ToDouble(CurrentRecipeHead.BasePressure);
  56. if (setpoint > 0 && setpoint < 750000)
  57. return setpoint;
  58. }
  59. }
  60. return SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  61. }
  62. }
  63. private double PumpDownLimit
  64. {
  65. get
  66. {
  67. if (CurrentRecipeHead != null)
  68. {
  69. if (!string.IsNullOrEmpty(CurrentRecipeHead.PumpDownLimit))
  70. {
  71. double setpoint = Convert.ToDouble(CurrentRecipeHead.PumpDownLimit);
  72. if (setpoint > 0 && setpoint < 600)
  73. return setpoint;
  74. }
  75. }
  76. return SC.GetValue<double>($"{Module}.Pump.PumpTimeLimit");
  77. }
  78. }
  79. public bool PumpingPinIsUp
  80. {
  81. get
  82. {
  83. if (CurrentRecipeHead != null)
  84. {
  85. if (!string.IsNullOrEmpty(CurrentRecipeHead.PumpingPinState))
  86. {
  87. return CurrentRecipeHead.PumpingPinState == "Up" ? true : false;
  88. }
  89. }
  90. return false;
  91. }
  92. }
  93. public double SubstrateTemp
  94. {
  95. get
  96. {
  97. if (CurrentRecipeHead != null)
  98. {
  99. if (!string.IsNullOrEmpty(CurrentRecipeHead.SubstrateTemp))
  100. {
  101. double setpoint = Convert.ToDouble(CurrentRecipeHead.SubstrateTemp);
  102. if (setpoint > 0 && setpoint < 600)
  103. return setpoint;
  104. }
  105. }
  106. return 0;
  107. }
  108. }
  109. //private int PinDownPressure
  110. //{
  111. // get
  112. // {
  113. // if (CurrentRecipeHead != null)
  114. // {
  115. // if (!string.IsNullOrEmpty(CurrentRecipeHead.PinDownPressure))
  116. // {
  117. // int setpoint = Convert.ToInt32(CurrentRecipeHead.PinDownPressure);
  118. // if (setpoint > 0)
  119. // return setpoint;
  120. // }
  121. // }
  122. // return 1000;
  123. // }
  124. //}
  125. //--------------------------------Constructor------------------------------------
  126. //
  127. public PreProcessRoutine(JetPM chamber, PumpDownRoutine pdr) : base(chamber)
  128. {
  129. Name = "Pre Process";
  130. _pumpRoutine = pdr;
  131. }
  132. public void Terminate()
  133. {
  134. }
  135. public Result LoadRecipe(params object[] param)
  136. {
  137. CurrentRecipeBaseName = (string)param[0];
  138. if (param.Length > 1)
  139. WaferID = (string)param[1];
  140. else
  141. WaferID = null;
  142. if (param.Length > 2)
  143. _withWafer = (bool)param[2];
  144. else
  145. _withWafer = true;
  146. CurrentRecipeContent = RecipeFileManager.Instance.LoadRecipe("", CurrentRecipeBaseName, true);
  147. if (string.IsNullOrEmpty(CurrentRecipeContent))
  148. {
  149. EV.PostInfoLog(ModuleName.System.ToString(), $"error during read recipe file {CurrentRecipeBaseName}");
  150. return Result.FAIL;
  151. }
  152. if (!RecipeFileManager.Instance.CheckRecipe(Module, CurrentRecipeContent, out var reasons))
  153. {
  154. EV.PostAlarmLog(Module, $"recipe file content not valid {CurrentRecipeBaseName}");
  155. string info = "";
  156. foreach (var item in reasons)
  157. info += item;
  158. EV.PostPopDialogMessage(EventLevel.Alarm, "recipe file not valid", info);
  159. }
  160. CurrentRecipeRunningName = $"{CurrentRecipeBaseName}";
  161. if (!Recipe.Parse(Module, CurrentRecipeContent, out RecipeHead recipeHead, out var recipeSteps))
  162. {
  163. return Result.FAIL;
  164. }
  165. CurrentRecipeStepList = recipeSteps;
  166. CurrentRecipeHead = recipeHead;
  167. return Result.DONE;
  168. }
  169. public Result Start(params object[] param)
  170. {
  171. if (_withWafer && WaferManager.Instance.CheckNoWafer(Module.ToString(), 0))
  172. {
  173. EV.PostWarningLog(Module.ToString(), $"can not run process, no wafer at {Module}");
  174. return Result.FAIL;
  175. }
  176. if (CheckSlitDoor() != Result.RUN || CheckDryPump() != Result.RUN)
  177. {
  178. return Result.FAIL;
  179. }
  180. _chamber.SetGeneratorCommunicationMode(1); // RS232 mode
  181. _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceToTarget");
  182. _OffsetTemp = SC.GetValue<double>($"{Module}.Chiller.ChillerTemperatureOffset");
  183. try
  184. {
  185. if (BasePressure <= 0 || BasePressure >= 760000)
  186. {
  187. return Result.FAIL;
  188. }
  189. if (PumpDownLimit <= 0.01 || PumpDownLimit >= 600)
  190. {
  191. return Result.FAIL;
  192. }
  193. _checkSubstrateTempTimeout = SC.GetValue<int>($"{Module}.CheckSubstrateTempTimeout");
  194. Reset();
  195. //RecipeRunGuid = Guid.NewGuid();
  196. //ProcessDataRecorder.Start(RecipeRunGuid.ToString(), CurrentRecipeRunningName.Split('\\')[1], WaferID, CurrentRecipeRunningName.Split('\\')[0]);
  197. //RecipeFileManager.Instance.SaveRecipeHistory(ModuleName.System.ToString(), CurrentRecipeRunningName, CurrentRecipeContent);
  198. }
  199. catch (Exception ex)
  200. {
  201. LOG.Write(ex, "Preprocess Start has exception");
  202. throw ex;
  203. }
  204. Notify("开始");
  205. return Result.RUN;
  206. }
  207. public Result Monitor()
  208. {
  209. try
  210. {
  211. // pump down
  212. ExecutePumpDownRoutine((int)Routine.PumpDown, _pumpRoutine, BasePressure);
  213. SetLiftPinUpDown((int)Routine.SetLiftPin, PumpingPinIsUp, 5000);
  214. if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller"))
  215. {
  216. CheckCoolantTemp((int)Routine.CheckDoor, SubstrateTemp, _OffsetTemp, _checkSubstrateTempTimeout, _tolerance);
  217. }
  218. else
  219. {
  220. CheckSubstrateTemp((int)Routine.CheckDoor, SubstrateTemp, _checkSubstrateTempTimeout, _tolerance);
  221. }
  222. //设置RF Match Mode
  223. //SetRfMatchMode((int)Routine.SetRfMatchMode, string.Format(Resources.PreProcess_Monitor_SetRFMatchMode, _rfMatchModeDuringProcess==(int)VirgoRfMatchMode.Manual ? "Manual" : "Auto"), _rfMatchModeDuringProcess);
  224. End((int)Routine.End);
  225. }
  226. catch (RoutineBreakException)
  227. {
  228. return Result.RUN;
  229. }
  230. catch (RoutineFaildException)
  231. {
  232. return Result.FAIL;
  233. }
  234. catch (Exception ex)
  235. {
  236. Stop(ex.Message);
  237. return Result.FAIL;
  238. }
  239. Notify("结束");
  240. return Result.DONE;
  241. }
  242. public void Exit()
  243. { }
  244. }
  245. }