ProcessDefine.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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. if (ProcessUnit.MatchWorkMode == MatchWorkMode.Auto)
  189. {
  190. Chamber.SetMatchWorkMode(MatchWorkMode.Auto);
  191. }
  192. else if (ProcessUnit.MatchWorkMode == MatchWorkMode.Manual)
  193. {
  194. Chamber.SetMatchWorkMode(MatchWorkMode.Manual);
  195. }
  196. rfMatchC1.Clear();
  197. rfMatchC1.Clear();
  198. rfMatchC1C2Index = 0;
  199. return RState.Running;
  200. }
  201. private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  202. {
  203. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.Rf.PowerAlarmTime");
  204. var ProcessUnit = unit as TCPUnit;
  205. if (ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  206. {
  207. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  208. return RState.Failed;
  209. }
  210. if (step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  211. {
  212. Chamber.GeneratorSetpower(0);
  213. Chamber.GeneratorPowerOn(false);
  214. }
  215. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  216. {
  217. rfMatchC1.Add(Chamber.RFMatchC1);
  218. rfMatchC2.Add(Chamber.RFMatchC2);
  219. rfMatchC1C2Index += 1;
  220. }
  221. return RState.Running;
  222. }
  223. private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  224. {
  225. var ProcessUnit = unit as TCPUnit;
  226. if (rfMatchC1.Count >= 6)
  227. {
  228. float allValue = 0;
  229. for (int i = 4; i < rfMatchC1.Count; i++)
  230. {
  231. allValue += rfMatchC1[i];
  232. }
  233. var average = allValue / (rfMatchC1.Count - 4);
  234. ProcessUnit.AutoTuneCapPreset = (int)average;
  235. }
  236. if (rfMatchC2.Count >= 6)
  237. {
  238. float allValue = 0;
  239. for (int i = 4; i < rfMatchC2.Count; i++)
  240. {
  241. allValue += rfMatchC2[i];
  242. }
  243. var average = allValue / (rfMatchC2.Count - 4);
  244. ProcessUnit.AutoLoadCapPreset = (int)average;
  245. }
  246. rfMatchC1.Clear();
  247. rfMatchC2.Clear();
  248. rfMatchC1C2Index = 0;
  249. }
  250. private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  251. {
  252. var ProcessUnit = unit as BiasUnit;
  253. if (ProcessUnit.BiasRFPower > 5)
  254. {
  255. Chamber.GeneratorBiasPowerOn(true);
  256. if ((ProcessUnit.EnableRamp == false))
  257. {
  258. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  259. }
  260. }
  261. int p1;
  262. int p2;
  263. if (ProcessUnit.BiasTuneCapPreset > 0)
  264. {
  265. p1 = ProcessUnit.BiasTuneCapPreset;
  266. }
  267. else
  268. {
  269. p1 = ProcessUnit.AutoBiasTuneCapPreset;
  270. }
  271. if (ProcessUnit.BiasLoadCapPreset > 0)
  272. {
  273. p2 = ProcessUnit.BiasLoadCapPreset;
  274. }
  275. else
  276. {
  277. p2 = ProcessUnit.AutoBiasLoadCapPreset;
  278. }
  279. Chamber.SetBiasMatchPosition(p1, p2);
  280. if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Auto)
  281. {
  282. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Auto);
  283. }
  284. else if(ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Manual)
  285. {
  286. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Manual);
  287. }
  288. if (ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  289. {
  290. Chamber.SetBiasPulseMode(true);
  291. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  292. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  293. }
  294. else
  295. {
  296. Chamber.SetBiasPulseMode(false);
  297. }
  298. biasRfMatchC1.Clear();
  299. biasRfMatchC1.Clear();
  300. biasRfMatchC1C2Index = 0;
  301. biasRFSetPointFlag = true;
  302. return RState.Running;
  303. }
  304. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  305. {
  306. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  307. var ProcessUnit = unit as BiasUnit;
  308. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  309. {
  310. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  311. return RState.Failed;
  312. }
  313. if (step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  314. {
  315. Chamber.GeneratorBiasSetpower(0);
  316. Chamber.GeneratorBiasPowerOn(false);
  317. }
  318. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  319. {
  320. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  321. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  322. biasRfMatchC1C2Index += 1;
  323. }
  324. if (ProcessUnit.EnableRamp)
  325. {
  326. //if (step.ElapsedTime() <= 500*cycleIndex)
  327. //{
  328. // return RState.Running;
  329. //}
  330. //cycleIndex += 1;
  331. if (ProcessUnit.TargetMode == TargetMode.Cycle)
  332. {
  333. if ( biasRFSetPointFlag==true)
  334. {
  335. biasRFSetPointFlag = false;
  336. Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower + (float)((float)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((float)(loopsteps-1) / (float)(currentStepIndex))))));
  337. }
  338. //float rampFactor = (float)currentStepIndex / (float)(loopsteps-1);
  339. //double rampFactor = step.RampFactor();
  340. //Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower+ (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower)/(loopsteps)*currentStepIndex) + ((double)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((double)loopsteps)) * rampFactor));
  341. }
  342. else
  343. {
  344. //double rampFactor = step.RampFactor();
  345. //Chamber.GeneratorBiasSetpower((float)(ProcessUnit.BiasRFPower + (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) * rampFactor));
  346. }
  347. }
  348. return RState.Running;
  349. }
  350. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  351. {
  352. var ProcessUnit = unit as BiasUnit;
  353. Chamber.GeneratorBiasSetpower(0);
  354. Chamber.GeneratorBiasPowerOn(false);
  355. if (biasRfMatchC1.Count >= 6)
  356. {
  357. float allValue = 0;
  358. for (int i = 4; i < biasRfMatchC1.Count; i++)
  359. {
  360. allValue += biasRfMatchC1[i];
  361. }
  362. var average = allValue / (biasRfMatchC1.Count - 4);
  363. ProcessUnit.AutoBiasTuneCapPreset = (int)average;
  364. }
  365. if (biasRfMatchC2.Count >= 6)
  366. {
  367. float allValue = 0;
  368. for (int i = 4; i < biasRfMatchC2.Count; i++)
  369. {
  370. allValue += biasRfMatchC2[i];
  371. }
  372. var average = allValue / (biasRfMatchC2.Count - 4);
  373. ProcessUnit.AutoBiasLoadCapPreset = (int)average;
  374. }
  375. biasRfMatchC1.Clear();
  376. biasRfMatchC1.Clear();
  377. biasRfMatchC1C2Index = 0;
  378. //cycleIndex = 0;
  379. biasRFSetPointFlag = true;
  380. }
  381. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  382. {
  383. Chamber.OpenValve(ValveType.GasFinal, true);
  384. var ProcessUnit = unit as GasControlUnit;
  385. Chamber.FlowGas(0, ProcessUnit.Gas1);
  386. if (ProcessUnit.Gas1 >= 1)
  387. {
  388. Chamber.OpenValve(ValveType.PV11, true);
  389. }
  390. Chamber.FlowGas(1, ProcessUnit.Gas2);
  391. if (ProcessUnit.Gas2 >= 1)
  392. {
  393. Chamber.OpenValve(ValveType.PV21, true);
  394. }
  395. Chamber.FlowGas(2, ProcessUnit.Gas3);
  396. if (ProcessUnit.Gas3 >= 1)
  397. {
  398. Chamber.OpenValve(ValveType.PV31, true);
  399. }
  400. Chamber.FlowGas(3, ProcessUnit.Gas4);
  401. if (ProcessUnit.Gas4 >= 1)
  402. {
  403. Chamber.OpenValve(ValveType.PV41, true);
  404. }
  405. Chamber.FlowGas(4, ProcessUnit.Gas5);
  406. Chamber.FlowGas(5, ProcessUnit.Gas6);
  407. Chamber.FlowGas(6, ProcessUnit.Gas7);
  408. Chamber.FlowGas(7, ProcessUnit.Gas8);
  409. return RState.Running;
  410. }
  411. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  412. {
  413. var ProcessUnit = unit as GasControlUnit;
  414. if (ProcessUnit.EnableRamp)
  415. {
  416. double rampFactor = step.RampFactor();
  417. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  418. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  419. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  420. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  421. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  422. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  423. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  424. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  425. }
  426. return RState.Running;
  427. }
  428. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  429. {
  430. Chamber.FlowGas(0, 0);
  431. Chamber.FlowGas(1, 0);
  432. Chamber.FlowGas(2, 0);
  433. Chamber.FlowGas(3, 0);
  434. Chamber.FlowGas(4, 0);
  435. Chamber.FlowGas(5, 0);
  436. Chamber.FlowGas(6, 0);
  437. Chamber.FlowGas(7, 0);
  438. }
  439. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  440. {
  441. var ProcessUnit = unit as ESCHVUnit;
  442. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  443. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum);
  444. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  445. return RState.Running;
  446. }
  447. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  448. {
  449. if (Chamber.BackSideHeOutOfRange)
  450. {
  451. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  452. return RState.Failed;
  453. }
  454. return RState.Running;
  455. }
  456. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  457. {
  458. Chamber.SetESCClampVoltage(0);
  459. //Chamber.SetBacksideHePressure(0);
  460. Chamber.SetBacksideHeThreshold(0, 0);
  461. //Chamber.OnOffSetESCHV(false);
  462. }
  463. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  464. {
  465. var ProcessUnit = unit as ProcessKitUnit;
  466. return RState.Running;
  467. }
  468. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  469. {
  470. var ProcessUnit = unit as ProcessKitUnit;
  471. return RState.Running;
  472. }
  473. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  474. {
  475. }
  476. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  477. {
  478. Chamber.OpenValve(ValveType.GasFinal, true);
  479. var ProcessUnit = unit as Kepler2200GasControlUnit;
  480. Chamber.FlowGas(0, ProcessUnit.Gas1);
  481. if (ProcessUnit.Gas1 >= 1)
  482. {
  483. Chamber.OpenValve(ValveType.PV11, true);
  484. }
  485. Chamber.FlowGas(1, ProcessUnit.Gas2);
  486. if (ProcessUnit.Gas2 >= 1)
  487. {
  488. Chamber.OpenValve(ValveType.PV21, true);
  489. }
  490. Chamber.FlowGas(2, ProcessUnit.Gas3);
  491. if (ProcessUnit.Gas3 >= 1)
  492. {
  493. Chamber.OpenValve(ValveType.PV31, true);
  494. }
  495. Chamber.FlowGas(3, ProcessUnit.Gas4);
  496. if (ProcessUnit.Gas4 >= 1)
  497. {
  498. Chamber.OpenValve(ValveType.PV41, true);
  499. }
  500. Chamber.FlowGas(4, ProcessUnit.Gas5);
  501. Chamber.FlowGas(5, ProcessUnit.Gas6);
  502. return RState.Running;
  503. }
  504. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  505. {
  506. return RState.Running;
  507. }
  508. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  509. {
  510. Chamber.FlowGas(0, 0);
  511. Chamber.FlowGas(1, 0);
  512. Chamber.FlowGas(2, 0);
  513. Chamber.FlowGas(3, 0);
  514. Chamber.FlowGas(4, 0);
  515. Chamber.FlowGas(5, 0);
  516. }
  517. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  518. {
  519. var ProcessUnit = unit as HeaterUnit;
  520. var position= (HighTemperatureHeaterPosition)Enum.Parse(typeof(HighTemperatureHeaterPosition), ProcessUnit.SuspectPosition.ToString());
  521. Chamber.HighTemperatureHeaterGotoPosition(position);
  522. return RState.Running;
  523. }
  524. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  525. {
  526. return RState.Running;
  527. }
  528. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  529. {
  530. }
  531. public bool LoadMethods(ProcessUnitBase unit)
  532. {
  533. var className = $"{Module}.{unit.GetType().Name}";
  534. if (startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  535. {
  536. unit.starter = startHelper[className];
  537. unit.checker = checkerHelper[className];
  538. unit.end = endHelper[className];
  539. return true;
  540. }
  541. return false;
  542. }
  543. //public void loopStep(bool isloop,int loopCount,int loopIndex)
  544. //{
  545. // isLoop = isloop;
  546. // loopsteps=loopCount;
  547. // currentStepIndex = loopIndex;
  548. //}
  549. private RState stepStarter(RecipeStep step)
  550. {
  551. step.StartStepTimer();
  552. switch (step.Type)
  553. {
  554. case StepType.EndPoint:
  555. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  556. break;
  557. }
  558. return RState.Running;
  559. }
  560. private RState stepChecker(RecipeStep step)
  561. {
  562. switch (step.Type)
  563. {
  564. case StepType.Time:
  565. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  566. case StepType.OverEtch:
  567. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  568. case StepType.EndPoint:
  569. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  570. {
  571. LOG.Write(eEvent.INFO_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  572. return RState.End;
  573. }
  574. else
  575. {
  576. return Chamber.EPDCaptured ? RState.End : RState.Running;
  577. }
  578. }
  579. return RState.Running;
  580. }
  581. private RState stepEnder(RecipeStep step)
  582. {
  583. if (step.Type == StepType.EndPoint)
  584. {
  585. Chamber.EPDStepStop();
  586. }
  587. return RState.End;
  588. }
  589. public bool LoadStepFuns(RecipeStep step)
  590. {
  591. step.starter = stepStarter;
  592. step.checker = stepChecker;
  593. step.ender = stepEnder;
  594. return true;
  595. }
  596. }
  597. }