ProcessDefine.cs 17 KB

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