ProcessDefine.cs 25 KB

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