ProcessDefine.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. using System;
  2. using System.Collections.Generic;
  3. //using System.
  4. using Venus_RT.Devices;
  5. using Venus_RT.Modules;
  6. using Aitex.Core.RT.Log;
  7. using Venus_Core;
  8. using Aitex.Core.RT.SCCore;
  9. using System.Reflection;
  10. using System.Diagnostics;
  11. //#pragma warning disable 0436
  12. namespace Venus_RT.Modules.PMs
  13. {
  14. class ProcessHelper
  15. {
  16. static protected JetPM Chamber;
  17. static Stopwatch sRFStopWatch = new Stopwatch();
  18. static Stopwatch bRFStopWatch = new Stopwatch();
  19. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
  20. {
  21. {"PressureByPressureModeUnit", PressureByPressureModeUnit_Start},
  22. {"PressureByValveModeUnit", PressureByValveModeUnit_Start},
  23. {"TCPUnit", TCPUnit_Start},
  24. {"BiasUnit", BiasUnit_Start},
  25. {"GasControlUnit", GasControlUnit_Start },
  26. {"ESCHVUnit", ESCHVUnit_Start },
  27. {"ProcessKitUnit", ProcessKitUnit_Start },
  28. };
  29. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
  30. {
  31. {"PressureByPressureModeUnit", PressureByPressureModeUnit_Check},
  32. {"PressureByValveModeUnit", PressureByValveModeUnit_Check},
  33. {"TCPUnit", TCPUnit_Check},
  34. {"BiasUnit", BiasUnit_Check},
  35. {"GasControlUnit", GasControlUnit_Check},
  36. {"ESCHVUnit", ESCHVUnit_Check},
  37. {"ProcessKitUnit", ProcessKitUnit_Check}
  38. };
  39. private static Dictionary<string, Action<ProcessUnitBase, RecipeStep>> endHelper = new Dictionary<string, Action<ProcessUnitBase, RecipeStep>>
  40. {
  41. {"PressureByPressureModeUnit", PressureByPressureModeUnit_End},
  42. {"PressureByValveModeUnit", PressureByValveModeUnit_End},
  43. {"TCPUnit", TCPUnit_End},
  44. {"BiasUnit", BiasUnit_End},
  45. {"GasControlUnit", GasControlUnit_End},
  46. {"ESCHVUnit", ESCHVUnit_End},
  47. {"ProcessKitUnit", ProcessKitUnit_End}
  48. };
  49. public ProcessHelper(JetPM pm)
  50. {
  51. Chamber = pm;
  52. }
  53. static private RState PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  54. {
  55. var ProcessUnit = unit as PressureByPressureModeUnit;
  56. if (Chamber.SetPVPressure(ProcessUnit.StartPressure))
  57. {
  58. return RState.Running;
  59. }
  60. return RState.Failed;
  61. }
  62. static private RState PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  63. {
  64. var ProcessUnit = unit as PressureByPressureModeUnit;
  65. if(ProcessUnit.EnableRamp)
  66. {
  67. if (Chamber.SetPVPressure(ProcessUnit.StartPressure + (int)((ProcessUnit.TargetPressure - ProcessUnit.StartPressure) * step.RampFactor())))
  68. return RState.Running;
  69. else
  70. return RState.Failed;
  71. }
  72. if(step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartPressure)
  73. {
  74. return RState.End;
  75. }
  76. return RState.Running;
  77. }
  78. static private void PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  79. {
  80. }
  81. static private RState PressureByValveModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  82. {
  83. var ProcessUnit = unit as PressureByValveModeUnit;
  84. if(Chamber.SetPVPostion(ProcessUnit.StartPosition))
  85. {
  86. return RState.Running;
  87. }
  88. return RState.Failed;
  89. }
  90. static private RState PressureByValveModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  91. {
  92. var ProcessUnit = unit as PressureByValveModeUnit;
  93. if(ProcessUnit.EnableRamp)
  94. {
  95. if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
  96. return RState.Running;
  97. else
  98. return RState.Failed;
  99. }
  100. return RState.Running;
  101. }
  102. static private void PressureByValveModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  103. {
  104. }
  105. static private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  106. {
  107. sRFStopWatch.Restart();
  108. var ProcessUnit = unit as TCPUnit;
  109. if (ProcessUnit.RFPower > 5)
  110. {
  111. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  112. Chamber.GeneratorPowerOn(true);
  113. }
  114. Chamber.SetMatchPosition(ProcessUnit.TuneCapPreset, ProcessUnit.LoadCapPreset);
  115. return RState.Running;
  116. }
  117. static private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  118. {
  119. var _scPowerAlarmTime= SC.GetValue<double>($"{Chamber.Name}.Rf.PowerAlarmTime");
  120. var ProcessUnit = unit as TCPUnit;
  121. if(ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && sRFStopWatch.ElapsedMilliseconds > _scPowerAlarmTime*1000)
  122. {
  123. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  124. return RState.Failed;
  125. }
  126. if(step.ElapsedTime() > ProcessUnit.HoldTime * 1000)
  127. {
  128. Chamber.GeneratorSetpower(0);
  129. Chamber.GeneratorPowerOn(false);
  130. }
  131. return RState.Running;
  132. }
  133. static private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  134. {
  135. Chamber.GeneratorSetpower(0);
  136. Chamber.GeneratorPowerOn(false);
  137. }
  138. static private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  139. {
  140. bRFStopWatch.Restart();
  141. var ProcessUnit = unit as BiasUnit;
  142. if (ProcessUnit.BiasRFPower > 5)
  143. {
  144. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  145. Chamber.GeneratorBiasPowerOn(true);
  146. }
  147. Chamber.SetBiasMatchPosition(ProcessUnit.BiasTuneCapPreset, ProcessUnit.BiasLoadCapPreset);
  148. if(ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  149. {
  150. Chamber.SetBiasPulseMode(true);
  151. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  152. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  153. }
  154. return RState.Running;
  155. }
  156. static private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  157. {
  158. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  159. var ProcessUnit = unit as BiasUnit;
  160. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && bRFStopWatch.ElapsedMilliseconds > _scPowerAlarmTime * 1000)
  161. {
  162. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  163. return RState.Failed;
  164. }
  165. if (step.ElapsedTime() > ProcessUnit.BiasRFHoldTime * 1000)
  166. {
  167. Chamber.GeneratorBiasSetpower(0);
  168. Chamber.GeneratorBiasPowerOn(false);
  169. }
  170. return RState.Running;
  171. }
  172. static private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  173. {
  174. Chamber.GeneratorBiasSetpower(0);
  175. Chamber.GeneratorBiasPowerOn(false);
  176. }
  177. static private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  178. {
  179. Chamber.OpenValve(ValveType.GasFinal, true);
  180. var ProcessUnit = unit as GasControlUnit;
  181. Chamber.FlowGas(0, ProcessUnit.Gas1);
  182. if (ProcessUnit.Gas1 >= 1)
  183. {
  184. Chamber.OpenValve(ValveType.PV11, true);
  185. }
  186. Chamber.FlowGas(1, ProcessUnit.Gas2);
  187. if (ProcessUnit.Gas2 >= 1)
  188. {
  189. Chamber.OpenValve(ValveType.PV21, true);
  190. }
  191. Chamber.FlowGas(2, ProcessUnit.Gas3);
  192. if (ProcessUnit.Gas3 >= 1)
  193. {
  194. Chamber.OpenValve(ValveType.PV31,true);
  195. }
  196. Chamber.FlowGas(3, ProcessUnit.Gas4);
  197. if (ProcessUnit.Gas4 >= 1)
  198. {
  199. Chamber.OpenValve(ValveType.PV41, true);
  200. }
  201. Chamber.FlowGas(4, ProcessUnit.Gas5);
  202. Chamber.FlowGas(5, ProcessUnit.Gas6);
  203. Chamber.FlowGas(6, ProcessUnit.Gas7);
  204. Chamber.FlowGas(7, ProcessUnit.Gas8);
  205. return RState.Running;
  206. }
  207. static private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  208. {
  209. var ProcessUnit = unit as GasControlUnit;
  210. if(ProcessUnit.EnableRamp)
  211. {
  212. double rampFactor = step.RampFactor();
  213. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  214. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  215. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  216. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  217. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  218. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  219. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  220. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  221. }
  222. return RState.Running;
  223. }
  224. static private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  225. {
  226. Chamber.FlowGas(0, 0);
  227. Chamber.FlowGas(1, 0);
  228. Chamber.FlowGas(2, 0);
  229. Chamber.FlowGas(3, 0);
  230. Chamber.FlowGas(4, 0);
  231. Chamber.FlowGas(5, 0);
  232. Chamber.FlowGas(6, 0);
  233. Chamber.FlowGas(7, 0);
  234. }
  235. static private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  236. {
  237. var ProcessUnit = unit as ESCHVUnit;
  238. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  239. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum * 1000);
  240. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  241. return RState.Running;
  242. }
  243. static private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  244. {
  245. if(Chamber.BackSideHeOutOfRange)
  246. {
  247. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  248. return RState.Failed;
  249. }
  250. return RState.Running;
  251. }
  252. static private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  253. {
  254. Chamber.SetESCClampVoltage(0);
  255. //Chamber.SetBacksideHePressure(0);
  256. Chamber.SetBacksideHeThreshold(0, 0);
  257. }
  258. static private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  259. {
  260. var ProcessUnit = unit as ProcessKitUnit;
  261. return RState.Running;
  262. }
  263. static private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  264. {
  265. var ProcessUnit = unit as ProcessKitUnit;
  266. return RState.Running;
  267. }
  268. static private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  269. {
  270. }
  271. public static bool LoadMethods(ProcessUnitBase unit)
  272. {
  273. var className = unit.GetType().Name;
  274. if(startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  275. {
  276. unit.starter = startHelper[className];
  277. unit.checker = checkerHelper[className];
  278. unit.end = endHelper[className];
  279. return true;
  280. }
  281. return false;
  282. }
  283. private static RState stepStarter(RecipeStep step)
  284. {
  285. step.StartStepTimer();
  286. switch (step.Type)
  287. {
  288. case StepType.EndPoint:
  289. Chamber.EPDStepStart(step.EPDConfigName);
  290. break;
  291. }
  292. return RState.Running;
  293. }
  294. private static RState stepChecker(RecipeStep step)
  295. {
  296. switch(step.Type)
  297. {
  298. case StepType.Time:
  299. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  300. case StepType.OverEtch:
  301. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  302. case StepType.EndPoint:
  303. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  304. {
  305. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  306. return RState.Timeout;
  307. }
  308. else
  309. return Chamber.EPDCaptured ? RState.End : RState.Running;
  310. }
  311. return RState.Running;
  312. }
  313. private static RState stepEnder(RecipeStep step)
  314. {
  315. if(step.Type == StepType.EndPoint)
  316. {
  317. Chamber.EPDStepStop();
  318. }
  319. //Chamber.GeneratorBiasPowerOn(false);
  320. //Chamber.GeneratorPowerOn(false);
  321. //Chamber.TurnPendulumValve(false);
  322. //Chamber.CloseValves();
  323. //Chamber.OpenValve(ValveType.TurboPumpPumping, true);
  324. //Chamber.OpenValve(ValveType.TurboPumpPurge, true);
  325. return RState.End;
  326. }
  327. public static bool LoadStepFuns(RecipeStep step)
  328. {
  329. step.starter = stepStarter;
  330. step.checker = stepChecker;
  331. step.ender = stepEnder;
  332. return true;
  333. }
  334. }
  335. }