ProcessDefine.cs 16 KB

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