ProcessDefine.cs 26 KB

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