ProcessDefine.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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.Util;
  7. using Venus_Core;
  8. //#pragma warning disable 0436
  9. namespace Venus_RT.Modules.PMs
  10. {
  11. class ProcessHelper
  12. {
  13. static protected JetPM Chamber;
  14. private Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
  15. {
  16. {"PressureUnitByPressureMode", PressureUnitByPressureMode_Start},
  17. {"PressureUnitByValveMode", PressureUnitByValveMode_Start},
  18. {"TCPUnit", TCPUnit_Start},
  19. {"BiasUnit", BiasUnit_Start},
  20. {"GasControlUnit", GasControlUnit_Start },
  21. {"ESCHVUnit", ESCHVUnit_Start },
  22. {"ProcessKitUnit", ProcessKitUnit_Start },
  23. };
  24. private Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>
  25. {
  26. {"PressureUnitByPressureMode", PressureUnitByPressureMode_Check},
  27. {"PressureUnitByValveMode", PressureUnitByValveMode_Check},
  28. {"TCPUnit", TCPUnit_Check},
  29. {"BiasUnit", BiasUnit_Check},
  30. {"GasControlUnit", GasControlUnit_Check},
  31. {"ESCHVUnit", ESCHVUnit_Check},
  32. {"ProcessKitUnit", ProcessKitUnit_Check}
  33. };
  34. private Dictionary<string, Action<ProcessUnitBase, RecipeStep>> endHelper = new Dictionary<string, Action<ProcessUnitBase, RecipeStep>>
  35. {
  36. {"PressureUnitByPressureMode", PressureUnitByPressureMode_End},
  37. {"PressureUnitByValveMode", PressureUnitByValveMode_End},
  38. {"TCPUnit", TCPUnit_End},
  39. {"BiasUnit", BiasUnit_End},
  40. {"GasControlUnit", GasControlUnit_End},
  41. {"ESCHVUnit", ESCHVUnit_End},
  42. {"ProcessKitUnit", ProcessKitUnit_End}
  43. };
  44. public ProcessHelper(JetPM pm)
  45. {
  46. Chamber = pm;
  47. }
  48. static private RState PressureUnitByPressureMode_Start(ProcessUnitBase unit, RecipeStep step)
  49. {
  50. var ProcessUnit = unit as PressureByPressureModeUnit;
  51. if (Chamber.SetPVPressure(ProcessUnit.StartPressure))
  52. {
  53. return RState.Running;
  54. }
  55. return RState.Failed;
  56. }
  57. static private RState PressureUnitByPressureMode_Check(ProcessUnitBase unit, RecipeStep step)
  58. {
  59. var ProcessUnit = unit as PressureByPressureModeUnit;
  60. if(ProcessUnit.EnableRamp)
  61. {
  62. if (Chamber.SetPVPressure(ProcessUnit.StartPressure + (int)((ProcessUnit.TargetPressure - ProcessUnit.StartPressure) * step.RampFactor())))
  63. return RState.Running;
  64. else
  65. return RState.Failed;
  66. }
  67. if(step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartPressure)
  68. {
  69. return RState.End;
  70. }
  71. return RState.Running;
  72. }
  73. static private void PressureUnitByPressureMode_End(ProcessUnitBase unit, RecipeStep step)
  74. {
  75. }
  76. static private RState PressureUnitByValveMode_Start(ProcessUnitBase unit, RecipeStep step)
  77. {
  78. var ProcessUnit = unit as PressureByValveModeUnit;
  79. if(Chamber.SetPVPostion(ProcessUnit.StartPosition))
  80. {
  81. return RState.Running;
  82. }
  83. return RState.Failed;
  84. }
  85. static private RState PressureUnitByValveMode_Check(ProcessUnitBase unit, RecipeStep step)
  86. {
  87. var ProcessUnit = unit as PressureByValveModeUnit;
  88. if(ProcessUnit.EnableRamp)
  89. {
  90. if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
  91. return RState.Running;
  92. else
  93. return RState.Failed;
  94. }
  95. return RState.Running;
  96. }
  97. static private void PressureUnitByValveMode_End(ProcessUnitBase unit, RecipeStep step)
  98. {
  99. }
  100. static private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  101. {
  102. var ProcessUnit = unit as TCPUnit;
  103. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  104. Chamber.GeneratorPowerOn(true);
  105. Chamber.SetMatchPosition(ProcessUnit.TuneCapPreset, ProcessUnit.LoadCapPreset);
  106. return RState.Running;
  107. }
  108. static private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  109. {
  110. var ProcessUnit = unit as TCPUnit;
  111. if(ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower)
  112. {
  113. return RState.Failed;
  114. }
  115. if(step.ElapsedTime > ProcessUnit.HoldTime * 1000)
  116. {
  117. Chamber.GeneratorSetpower(0);
  118. Chamber.GeneratorPowerOn(false);
  119. }
  120. return RState.Running;
  121. }
  122. static private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  123. {
  124. Chamber.GeneratorSetpower(0);
  125. Chamber.GeneratorPowerOn(false);
  126. }
  127. static private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  128. {
  129. var ProcessUnit = unit as BiasUnit;
  130. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  131. Chamber.GeneratorBiasPowerOn(true);
  132. Chamber.SetBiasMatchPosition(ProcessUnit.BiasTuneCapPreset, ProcessUnit.BiasLoadCapPreset);
  133. if(ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  134. {
  135. Chamber.SetBiasPulseMode(true);
  136. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  137. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  138. }
  139. return RState.Running;
  140. }
  141. static private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  142. {
  143. var ProcessUnit = unit as BiasUnit;
  144. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower)
  145. {
  146. return RState.Failed;
  147. }
  148. if (step.ElapsedTime > ProcessUnit.BiasRFHoldTime * 1000)
  149. {
  150. Chamber.GeneratorBiasSetpower(0);
  151. Chamber.GeneratorBiasPowerOn(false);
  152. }
  153. return RState.Running;
  154. }
  155. static private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  156. {
  157. Chamber.GeneratorBiasSetpower(0);
  158. Chamber.GeneratorBiasPowerOn(false);
  159. }
  160. static private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  161. {
  162. var ProcessUnit = unit as GasControlUnit;
  163. Chamber.FlowGas(0, ProcessUnit.Gas1);
  164. Chamber.FlowGas(1, ProcessUnit.Gas2);
  165. Chamber.FlowGas(2, ProcessUnit.Gas3);
  166. Chamber.FlowGas(3, ProcessUnit.Gas4);
  167. Chamber.FlowGas(4, ProcessUnit.Gas5);
  168. Chamber.FlowGas(5, ProcessUnit.Gas6);
  169. Chamber.FlowGas(6, ProcessUnit.Gas7);
  170. Chamber.FlowGas(7, ProcessUnit.Gas8);
  171. return RState.Running;
  172. }
  173. static private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  174. {
  175. var ProcessUnit = unit as GasControlUnit;
  176. if(ProcessUnit.EnableRamp)
  177. {
  178. double rampFactor = step.RampFactor();
  179. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  180. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  181. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  182. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  183. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  184. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  185. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  186. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  187. }
  188. return RState.Running;
  189. }
  190. static private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  191. {
  192. Chamber.FlowGas(0, 0);
  193. Chamber.FlowGas(1, 0);
  194. Chamber.FlowGas(2, 0);
  195. Chamber.FlowGas(3, 0);
  196. Chamber.FlowGas(4, 0);
  197. Chamber.FlowGas(5, 0);
  198. Chamber.FlowGas(6, 0);
  199. Chamber.FlowGas(7, 0);
  200. }
  201. static private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  202. {
  203. var ProcessUnit = unit as ESCHVUnit;
  204. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  205. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum * 1000);
  206. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  207. return RState.Running;
  208. }
  209. static private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  210. {
  211. if(Chamber.BackSideHeOutOfRange)
  212. {
  213. return RState.Failed;
  214. }
  215. return RState.Running;
  216. }
  217. static private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  218. {
  219. Chamber.SetESCClampVoltage(0);
  220. //Chamber.SetBacksideHePressure(0);
  221. Chamber.SetBacksideHeThreshold(0, 0);
  222. }
  223. static private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  224. {
  225. var ProcessUnit = unit as ProcessKitUnit;
  226. return RState.Running;
  227. }
  228. static private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  229. {
  230. var ProcessUnit = unit as ProcessKitUnit;
  231. return RState.Running;
  232. }
  233. static private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  234. {
  235. }
  236. public bool LoadMethods(ProcessUnitBase unit)
  237. {
  238. var className = unit.GetType().Name;
  239. if(startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className))
  240. {
  241. unit.starter = startHelper[className];
  242. unit.checker = checkerHelper[className];
  243. unit.end = endHelper[className];
  244. return true;
  245. }
  246. return false;
  247. }
  248. private static RState stepStarter(RecipeStep step)
  249. {
  250. return RState.Running;
  251. }
  252. private static RState stepChecker(RecipeStep step)
  253. {
  254. switch(step.Type)
  255. {
  256. case StepType.Time:
  257. return step.ElapsedTime > step.Time ? RState.End : RState.Running;
  258. case StepType.EndPoint:
  259. return Chamber.CheckEndPoint() ? RState.End : RState.Running;
  260. }
  261. return RState.Running;
  262. }
  263. public bool LoadStepFuns(RecipeStep step)
  264. {
  265. step.starter = stepStarter;
  266. step.checker = stepChecker;
  267. return true;
  268. }
  269. #region EndPoint
  270. public static bool CheckEndPoint()
  271. {
  272. return Chamber.CheckEndPoint();
  273. }
  274. public static void StartEndPoint(string config, int index)
  275. {
  276. Chamber.StartEndPoint(config, index);
  277. }
  278. public static void StopEndPoint()
  279. {
  280. Chamber.StopEndPoint();
  281. }
  282. public static void EndPointRecipeStop()
  283. {
  284. Chamber.EndPointRecipeStop();
  285. }
  286. public static void EndPointRecipeStart(string recipeName)
  287. {
  288. Chamber.EndPointRecipeStart(recipeName);
  289. }
  290. #endregion
  291. }
  292. public class test
  293. {
  294. test()
  295. {
  296. //PressureUnitByPressureMode mode = new PressureUnitByPressureMode();
  297. //mode.Start();
  298. //mode.Run();
  299. //mode.
  300. }
  301. }
  302. }