ProcessDefine.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  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. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot;
  12. //#pragma warning disable 0436
  13. namespace Venus_RT.Modules.PMs
  14. {
  15. class ProcessHelper
  16. {
  17. protected JetPMBase Chamber;
  18. private string Module;
  19. public RecipeHead m_RecipeHead;
  20. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  21. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  22. private static Dictionary<string, Action<ProcessUnitBase, RecipeStep>> endHelper = new Dictionary<string, Action<ProcessUnitBase, RecipeStep>>();
  23. private List<float> rfMatchC1 = new List<float>();
  24. private List<float> rfMatchC2 = new List<float>();
  25. private int rfMatchC1C2Index = 0;
  26. private List<float> biasRfMatchC1 = new List<float>();
  27. private List<float> biasRfMatchC2 = new List<float>();
  28. private int biasRfMatchC1C2Index = 0;
  29. public ProcessHelper(JetPMBase pm)
  30. {
  31. Chamber = pm;
  32. Module = pm.Module.ToString() ;
  33. Init();
  34. }
  35. private void Init()
  36. {
  37. startHelper [$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Start(unit, step);
  38. checkerHelper [$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Check(unit, step);
  39. endHelper [$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_End(unit, step);
  40. //startHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Start(unit, step);
  41. //checkerHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Check(unit, step);
  42. //endHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_End(unit, step);
  43. startHelper [$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Start(unit, step);
  44. checkerHelper [$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Check(unit, step);
  45. endHelper [$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_End(unit, step);
  46. startHelper [$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Start(unit, step);
  47. checkerHelper [$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Check(unit, step);
  48. endHelper [$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_End(unit, step);
  49. startHelper [$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Start(unit, step);
  50. checkerHelper [$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Check(unit, step);
  51. endHelper [$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_End(unit, step);
  52. startHelper [$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Start(unit, step);
  53. checkerHelper [$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Check(unit, step);
  54. endHelper [$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_End(unit, step);
  55. startHelper [$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Start(unit, step);
  56. checkerHelper [$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Check(unit, step);
  57. endHelper [$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_End(unit, step);
  58. startHelper [$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Start(unit, step);
  59. checkerHelper [$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Check(unit, step);
  60. endHelper [$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_End(unit, step);
  61. startHelper [$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Start(unit, step);
  62. checkerHelper [$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Check(unit, step);
  63. endHelper [$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_End(unit, step);
  64. }
  65. private RState PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  66. {
  67. var ProcessUnit = unit as PressureByPressureModeUnit;
  68. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  69. {
  70. if (Chamber.SetPVPressure(ProcessUnit.StartValue))
  71. {
  72. return RState.Running;
  73. }
  74. }
  75. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  76. {
  77. if (Chamber.SetPVPostion(ProcessUnit.StartValue))
  78. {
  79. return RState.Running;
  80. }
  81. }
  82. return RState.Failed;
  83. }
  84. private RState PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  85. {
  86. var ProcessUnit = unit as PressureByPressureModeUnit;
  87. if(ProcessUnit.EnableRamp)
  88. {
  89. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  90. {
  91. if (Chamber.SetPVPressure(ProcessUnit.StartValue+ (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  92. return RState.Running;
  93. else
  94. return RState.Failed;
  95. }
  96. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  97. {
  98. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  99. return RState.Running;
  100. else
  101. return RState.Failed;
  102. }
  103. }
  104. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  105. {
  106. if (step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartValue)
  107. {
  108. return RState.End;
  109. }
  110. }
  111. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve )
  112. {
  113. if (step.Type == StepType.Stable && Chamber.GetPVPosition() == ProcessUnit.StartValue)
  114. {
  115. return RState.End;
  116. }
  117. }
  118. return RState.Running;
  119. }
  120. private void PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  121. {
  122. }
  123. #region Valve Mode已取消,合并到压力模式
  124. //private RState PressureByValveModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  125. //{
  126. // var ProcessUnit = unit as PressureByValveModeUnit;
  127. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition))
  128. // {
  129. // return RState.Running;
  130. // }
  131. // return RState.Failed;
  132. //}
  133. //private RState PressureByValveModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  134. //{
  135. // var ProcessUnit = unit as PressureByValveModeUnit;
  136. // if (ProcessUnit.EnableRamp)
  137. // {
  138. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
  139. // return RState.Running;
  140. // else
  141. // return RState.Failed;
  142. // }
  143. // return RState.Running;
  144. //}
  145. //private void PressureByValveModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  146. //{
  147. //}
  148. #endregion
  149. private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  150. {
  151. var ProcessUnit = unit as TCPUnit;
  152. if (ProcessUnit.RFPower > 5)
  153. {
  154. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  155. Chamber.GeneratorPowerOn(true);
  156. }
  157. else
  158. {
  159. Chamber.GeneratorSetpower(0);
  160. Chamber.GeneratorPowerOn(false);
  161. }
  162. int p1;
  163. int p2;
  164. if (ProcessUnit.TuneCapPreset > 0)
  165. {
  166. p1 = ProcessUnit.TuneCapPreset;
  167. }
  168. else
  169. {
  170. p1 = ProcessUnit.AutoTuneCapPreset;
  171. }
  172. if (ProcessUnit.LoadCapPreset > 0)
  173. {
  174. p2 = ProcessUnit.LoadCapPreset;
  175. }
  176. else
  177. {
  178. p2 = ProcessUnit.AutoLoadCapPreset;
  179. }
  180. Chamber.SetMatchPosition(p1, p2);
  181. rfMatchC1.Clear();
  182. rfMatchC1.Clear();
  183. rfMatchC1C2Index = 0;
  184. return RState.Running;
  185. }
  186. private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  187. {
  188. var _scPowerAlarmTime= SC.GetValue<double>($"{Chamber.Name}.Rf.PowerAlarmTime");
  189. var ProcessUnit = unit as TCPUnit;
  190. if(ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime*1000)
  191. {
  192. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  193. return RState.Failed;
  194. }
  195. if (step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  196. {
  197. Chamber.GeneratorSetpower(0);
  198. Chamber.GeneratorPowerOn(false);
  199. }
  200. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  201. {
  202. rfMatchC1.Add(Chamber.RFMatchC1);
  203. rfMatchC2.Add(Chamber.RFMatchC2);
  204. rfMatchC1C2Index += 1;
  205. }
  206. return RState.Running;
  207. }
  208. private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  209. {
  210. var ProcessUnit = unit as TCPUnit;
  211. if (rfMatchC1.Count >=6)
  212. {
  213. float allValue = 0;
  214. for (int i = 4; i < rfMatchC1.Count; i++)
  215. {
  216. allValue += rfMatchC1[i];
  217. }
  218. var average=allValue/ (rfMatchC1.Count-4);
  219. ProcessUnit.AutoTuneCapPreset = (int)average;
  220. }
  221. if (rfMatchC2.Count >= 6)
  222. {
  223. float allValue = 0;
  224. for (int i = 4; i < rfMatchC2.Count; i++)
  225. {
  226. allValue += rfMatchC2[i];
  227. }
  228. var average = allValue / (rfMatchC2.Count - 4);
  229. ProcessUnit.AutoLoadCapPreset = (int)average;
  230. }
  231. rfMatchC1.Clear();
  232. rfMatchC2.Clear();
  233. rfMatchC1C2Index = 0;
  234. }
  235. private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  236. {
  237. var ProcessUnit = unit as BiasUnit;
  238. if (ProcessUnit.BiasRFPower > 5)
  239. {
  240. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  241. Chamber.GeneratorBiasPowerOn(true);
  242. }
  243. int p1;
  244. int p2;
  245. if (ProcessUnit.BiasTuneCapPreset > 0)
  246. {
  247. p1 = ProcessUnit.BiasTuneCapPreset;
  248. }
  249. else
  250. {
  251. p1 = ProcessUnit.AutoBiasTuneCapPreset;
  252. }
  253. if (ProcessUnit.BiasLoadCapPreset > 0)
  254. {
  255. p2 = ProcessUnit.BiasLoadCapPreset;
  256. }
  257. else
  258. {
  259. p2 = ProcessUnit.AutoBiasLoadCapPreset;
  260. }
  261. Chamber.SetBiasMatchPosition(p1, p2);
  262. if(ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  263. {
  264. Chamber.SetBiasPulseMode(true);
  265. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  266. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  267. }
  268. biasRfMatchC1.Clear();
  269. biasRfMatchC1.Clear();
  270. biasRfMatchC1C2Index = 0;
  271. return RState.Running;
  272. }
  273. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  274. {
  275. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  276. var ProcessUnit = unit as BiasUnit;
  277. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  278. {
  279. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  280. return RState.Failed;
  281. }
  282. if (step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  283. {
  284. Chamber.GeneratorBiasSetpower(0);
  285. Chamber.GeneratorBiasPowerOn(false);
  286. }
  287. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  288. {
  289. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  290. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  291. biasRfMatchC1C2Index += 1;
  292. }
  293. return RState.Running;
  294. }
  295. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  296. {
  297. var ProcessUnit = unit as BiasUnit;
  298. Chamber.GeneratorBiasSetpower(0);
  299. Chamber.GeneratorBiasPowerOn(false);
  300. if (biasRfMatchC1.Count >= 6)
  301. {
  302. float allValue = 0;
  303. for (int i = 4; i < biasRfMatchC1.Count; i++)
  304. {
  305. allValue += biasRfMatchC1[i];
  306. }
  307. var average = allValue / (biasRfMatchC1.Count - 4);
  308. ProcessUnit.AutoBiasTuneCapPreset = (int)average;
  309. }
  310. if (biasRfMatchC2.Count >= 6)
  311. {
  312. float allValue = 0;
  313. for (int i = 4; i < biasRfMatchC2.Count; i++)
  314. {
  315. allValue += biasRfMatchC2[i];
  316. }
  317. var average = allValue / (biasRfMatchC2.Count - 4);
  318. ProcessUnit.AutoBiasLoadCapPreset = (int)average;
  319. }
  320. biasRfMatchC1.Clear();
  321. biasRfMatchC1.Clear();
  322. biasRfMatchC1C2Index = 0;
  323. }
  324. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  325. {
  326. Chamber.OpenValve(ValveType.GasFinal, true);
  327. var ProcessUnit = unit as GasControlUnit;
  328. Chamber.FlowGas(0, ProcessUnit.Gas1);
  329. if (ProcessUnit.Gas1 >= 1)
  330. {
  331. Chamber.OpenValve(ValveType.PV11, true);
  332. }
  333. Chamber.FlowGas(1, ProcessUnit.Gas2);
  334. if (ProcessUnit.Gas2 >= 1)
  335. {
  336. Chamber.OpenValve(ValveType.PV21, true);
  337. }
  338. Chamber.FlowGas(2, ProcessUnit.Gas3);
  339. if (ProcessUnit.Gas3 >= 1)
  340. {
  341. Chamber.OpenValve(ValveType.PV31,true);
  342. }
  343. Chamber.FlowGas(3, ProcessUnit.Gas4);
  344. if (ProcessUnit.Gas4 >= 1)
  345. {
  346. Chamber.OpenValve(ValveType.PV41, true);
  347. }
  348. Chamber.FlowGas(4, ProcessUnit.Gas5);
  349. Chamber.FlowGas(5, ProcessUnit.Gas6);
  350. Chamber.FlowGas(6, ProcessUnit.Gas7);
  351. Chamber.FlowGas(7, ProcessUnit.Gas8);
  352. return RState.Running;
  353. }
  354. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  355. {
  356. var ProcessUnit = unit as GasControlUnit;
  357. if(ProcessUnit.EnableRamp)
  358. {
  359. double rampFactor = step.RampFactor();
  360. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  361. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  362. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  363. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  364. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  365. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  366. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  367. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  368. }
  369. return RState.Running;
  370. }
  371. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  372. {
  373. Chamber.FlowGas(0, 0);
  374. Chamber.FlowGas(1, 0);
  375. Chamber.FlowGas(2, 0);
  376. Chamber.FlowGas(3, 0);
  377. Chamber.FlowGas(4, 0);
  378. Chamber.FlowGas(5, 0);
  379. Chamber.FlowGas(6, 0);
  380. Chamber.FlowGas(7, 0);
  381. }
  382. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  383. {
  384. var ProcessUnit = unit as ESCHVUnit;
  385. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  386. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum);
  387. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  388. return RState.Running;
  389. }
  390. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  391. {
  392. if(Chamber.BackSideHeOutOfRange)
  393. {
  394. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  395. return RState.Failed;
  396. }
  397. return RState.Running;
  398. }
  399. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  400. {
  401. Chamber.SetESCClampVoltage(0);
  402. //Chamber.SetBacksideHePressure(0);
  403. Chamber.SetBacksideHeThreshold(0, 0);
  404. }
  405. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  406. {
  407. var ProcessUnit = unit as ProcessKitUnit;
  408. return RState.Running;
  409. }
  410. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  411. {
  412. var ProcessUnit = unit as ProcessKitUnit;
  413. return RState.Running;
  414. }
  415. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  416. {
  417. }
  418. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  419. {
  420. Chamber.OpenValve(ValveType.GasFinal, true);
  421. var ProcessUnit = unit as Kepler2200GasControlUnit;
  422. Chamber.FlowGas(0, ProcessUnit.Gas1);
  423. if (ProcessUnit.Gas1 >= 1)
  424. {
  425. Chamber.OpenValve(ValveType.PV11, true);
  426. }
  427. Chamber.FlowGas(1, ProcessUnit.Gas2);
  428. if (ProcessUnit.Gas2 >= 1)
  429. {
  430. Chamber.OpenValve(ValveType.PV21, true);
  431. }
  432. Chamber.FlowGas(2, ProcessUnit.Gas3);
  433. if (ProcessUnit.Gas3 >= 1)
  434. {
  435. Chamber.OpenValve(ValveType.PV31, true);
  436. }
  437. Chamber.FlowGas(3, ProcessUnit.Gas4);
  438. if (ProcessUnit.Gas4 >= 1)
  439. {
  440. Chamber.OpenValve(ValveType.PV41, true);
  441. }
  442. Chamber.FlowGas(4, ProcessUnit.Gas5);
  443. Chamber.FlowGas(5, ProcessUnit.Gas6);
  444. return RState.Running;
  445. }
  446. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  447. {
  448. return RState.Running;
  449. }
  450. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  451. {
  452. Chamber.FlowGas(0, 0);
  453. Chamber.FlowGas(1, 0);
  454. Chamber.FlowGas(2, 0);
  455. Chamber.FlowGas(3, 0);
  456. Chamber.FlowGas(4, 0);
  457. Chamber.FlowGas(5, 0);
  458. }
  459. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  460. {
  461. return RState.Running;
  462. }
  463. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  464. {
  465. return RState.Running;
  466. }
  467. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  468. {
  469. }
  470. public bool LoadMethods(ProcessUnitBase unit)
  471. {
  472. var className = $"{Module}.{unit.GetType().Name}";
  473. if(startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  474. {
  475. unit.starter = startHelper[className];
  476. unit.checker = checkerHelper[className];
  477. unit.end = endHelper[className];
  478. return true;
  479. }
  480. return false;
  481. }
  482. private RState stepStarter(RecipeStep step)
  483. {
  484. step.StartStepTimer();
  485. switch (step.Type)
  486. {
  487. case StepType.EndPoint:
  488. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  489. break;
  490. }
  491. return RState.Running;
  492. }
  493. private RState stepChecker(RecipeStep step)
  494. {
  495. switch(step.Type)
  496. {
  497. case StepType.Time:
  498. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  499. case StepType.OverEtch:
  500. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  501. case StepType.EndPoint:
  502. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  503. {
  504. LOG.Write(eEvent.INFO_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  505. return RState.End;
  506. }
  507. else
  508. return Chamber.EPDCaptured ? RState.End : RState.Running;
  509. }
  510. return RState.Running;
  511. }
  512. private RState stepEnder(RecipeStep step)
  513. {
  514. if(step.Type == StepType.EndPoint)
  515. {
  516. Chamber.EPDStepStop();
  517. }
  518. //Chamber.GeneratorBiasPowerOn(false);
  519. //Chamber.GeneratorPowerOn(false);
  520. //Chamber.TurnPendulumValve(false);
  521. //Chamber.CloseValves();
  522. //Chamber.OpenValve(ValveType.TurboPumpPumping, true);
  523. //Chamber.OpenValve(ValveType.TurboPumpPurge, true);
  524. return RState.End;
  525. }
  526. public bool LoadStepFuns(RecipeStep step)
  527. {
  528. step.starter = stepStarter;
  529. step.checker = stepChecker;
  530. step.ender = stepEnder;
  531. return true;
  532. }
  533. }
  534. }