ProcessDefine.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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. biasRFSetPointFlag = true;
  281. return RState.Running;
  282. }
  283. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  284. {
  285. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  286. var ProcessUnit = unit as BiasUnit;
  287. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  288. {
  289. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  290. return RState.Failed;
  291. }
  292. if (step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  293. {
  294. Chamber.GeneratorBiasSetpower(0);
  295. Chamber.GeneratorBiasPowerOn(false);
  296. }
  297. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  298. {
  299. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  300. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  301. biasRfMatchC1C2Index += 1;
  302. }
  303. if (ProcessUnit.EnableRamp)
  304. {
  305. //if (step.ElapsedTime() <= 500*cycleIndex)
  306. //{
  307. // return RState.Running;
  308. //}
  309. //cycleIndex += 1;
  310. if (ProcessUnit.TargetMode == TargetMode.Cycle)
  311. {
  312. if ( biasRFSetPointFlag==true)
  313. {
  314. biasRFSetPointFlag = false;
  315. Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower + (float)((float)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((float)(loopsteps-1) / (float)(currentStepIndex))))));
  316. }
  317. //float rampFactor = (float)currentStepIndex / (float)(loopsteps-1);
  318. //double rampFactor = step.RampFactor();
  319. //Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower+ (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower)/(loopsteps)*currentStepIndex) + ((double)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((double)loopsteps)) * rampFactor));
  320. }
  321. else
  322. {
  323. //double rampFactor = step.RampFactor();
  324. //Chamber.GeneratorBiasSetpower((float)(ProcessUnit.BiasRFPower + (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) * rampFactor));
  325. }
  326. }
  327. return RState.Running;
  328. }
  329. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  330. {
  331. var ProcessUnit = unit as BiasUnit;
  332. Chamber.GeneratorBiasSetpower(0);
  333. Chamber.GeneratorBiasPowerOn(false);
  334. if (biasRfMatchC1.Count >= 6)
  335. {
  336. float allValue = 0;
  337. for (int i = 4; i < biasRfMatchC1.Count; i++)
  338. {
  339. allValue += biasRfMatchC1[i];
  340. }
  341. var average = allValue / (biasRfMatchC1.Count - 4);
  342. ProcessUnit.AutoBiasTuneCapPreset = (int)average;
  343. }
  344. if (biasRfMatchC2.Count >= 6)
  345. {
  346. float allValue = 0;
  347. for (int i = 4; i < biasRfMatchC2.Count; i++)
  348. {
  349. allValue += biasRfMatchC2[i];
  350. }
  351. var average = allValue / (biasRfMatchC2.Count - 4);
  352. ProcessUnit.AutoBiasLoadCapPreset = (int)average;
  353. }
  354. biasRfMatchC1.Clear();
  355. biasRfMatchC1.Clear();
  356. biasRfMatchC1C2Index = 0;
  357. //cycleIndex = 0;
  358. biasRFSetPointFlag = true;
  359. }
  360. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  361. {
  362. Chamber.OpenValve(ValveType.GasFinal, true);
  363. var ProcessUnit = unit as GasControlUnit;
  364. Chamber.FlowGas(0, ProcessUnit.Gas1);
  365. if (ProcessUnit.Gas1 >= 1)
  366. {
  367. Chamber.OpenValve(ValveType.PV11, true);
  368. }
  369. Chamber.FlowGas(1, ProcessUnit.Gas2);
  370. if (ProcessUnit.Gas2 >= 1)
  371. {
  372. Chamber.OpenValve(ValveType.PV21, true);
  373. }
  374. Chamber.FlowGas(2, ProcessUnit.Gas3);
  375. if (ProcessUnit.Gas3 >= 1)
  376. {
  377. Chamber.OpenValve(ValveType.PV31, true);
  378. }
  379. Chamber.FlowGas(3, ProcessUnit.Gas4);
  380. if (ProcessUnit.Gas4 >= 1)
  381. {
  382. Chamber.OpenValve(ValveType.PV41, true);
  383. }
  384. Chamber.FlowGas(4, ProcessUnit.Gas5);
  385. Chamber.FlowGas(5, ProcessUnit.Gas6);
  386. Chamber.FlowGas(6, ProcessUnit.Gas7);
  387. Chamber.FlowGas(7, ProcessUnit.Gas8);
  388. return RState.Running;
  389. }
  390. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  391. {
  392. var ProcessUnit = unit as GasControlUnit;
  393. if (ProcessUnit.EnableRamp)
  394. {
  395. double rampFactor = step.RampFactor();
  396. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  397. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  398. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  399. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  400. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  401. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  402. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  403. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  404. }
  405. return RState.Running;
  406. }
  407. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  408. {
  409. Chamber.FlowGas(0, 0);
  410. Chamber.FlowGas(1, 0);
  411. Chamber.FlowGas(2, 0);
  412. Chamber.FlowGas(3, 0);
  413. Chamber.FlowGas(4, 0);
  414. Chamber.FlowGas(5, 0);
  415. Chamber.FlowGas(6, 0);
  416. Chamber.FlowGas(7, 0);
  417. }
  418. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  419. {
  420. var ProcessUnit = unit as ESCHVUnit;
  421. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  422. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum);
  423. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  424. return RState.Running;
  425. }
  426. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  427. {
  428. if (Chamber.BackSideHeOutOfRange)
  429. {
  430. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  431. return RState.Failed;
  432. }
  433. return RState.Running;
  434. }
  435. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  436. {
  437. Chamber.SetESCClampVoltage(0);
  438. //Chamber.SetBacksideHePressure(0);
  439. Chamber.SetBacksideHeThreshold(0, 0);
  440. //Chamber.OnOffSetESCHV(false);
  441. }
  442. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  443. {
  444. var ProcessUnit = unit as ProcessKitUnit;
  445. return RState.Running;
  446. }
  447. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  448. {
  449. var ProcessUnit = unit as ProcessKitUnit;
  450. return RState.Running;
  451. }
  452. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  453. {
  454. }
  455. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  456. {
  457. Chamber.OpenValve(ValveType.GasFinal, true);
  458. var ProcessUnit = unit as Kepler2200GasControlUnit;
  459. Chamber.FlowGas(0, ProcessUnit.Gas1);
  460. if (ProcessUnit.Gas1 >= 1)
  461. {
  462. Chamber.OpenValve(ValveType.PV11, true);
  463. }
  464. Chamber.FlowGas(1, ProcessUnit.Gas2);
  465. if (ProcessUnit.Gas2 >= 1)
  466. {
  467. Chamber.OpenValve(ValveType.PV21, true);
  468. }
  469. Chamber.FlowGas(2, ProcessUnit.Gas3);
  470. if (ProcessUnit.Gas3 >= 1)
  471. {
  472. Chamber.OpenValve(ValveType.PV31, true);
  473. }
  474. Chamber.FlowGas(3, ProcessUnit.Gas4);
  475. if (ProcessUnit.Gas4 >= 1)
  476. {
  477. Chamber.OpenValve(ValveType.PV41, true);
  478. }
  479. Chamber.FlowGas(4, ProcessUnit.Gas5);
  480. Chamber.FlowGas(5, ProcessUnit.Gas6);
  481. return RState.Running;
  482. }
  483. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  484. {
  485. return RState.Running;
  486. }
  487. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  488. {
  489. Chamber.FlowGas(0, 0);
  490. Chamber.FlowGas(1, 0);
  491. Chamber.FlowGas(2, 0);
  492. Chamber.FlowGas(3, 0);
  493. Chamber.FlowGas(4, 0);
  494. Chamber.FlowGas(5, 0);
  495. }
  496. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  497. {
  498. return RState.Running;
  499. }
  500. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  501. {
  502. return RState.Running;
  503. }
  504. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  505. {
  506. }
  507. public bool LoadMethods(ProcessUnitBase unit)
  508. {
  509. var className = $"{Module}.{unit.GetType().Name}";
  510. if (startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  511. {
  512. unit.starter = startHelper[className];
  513. unit.checker = checkerHelper[className];
  514. unit.end = endHelper[className];
  515. return true;
  516. }
  517. return false;
  518. }
  519. //public void loopStep(bool isloop,int loopCount,int loopIndex)
  520. //{
  521. // isLoop = isloop;
  522. // loopsteps=loopCount;
  523. // currentStepIndex = loopIndex;
  524. //}
  525. private RState stepStarter(RecipeStep step)
  526. {
  527. step.StartStepTimer();
  528. switch (step.Type)
  529. {
  530. case StepType.EndPoint:
  531. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  532. break;
  533. }
  534. return RState.Running;
  535. }
  536. private RState stepChecker(RecipeStep step)
  537. {
  538. switch (step.Type)
  539. {
  540. case StepType.Time:
  541. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  542. case StepType.OverEtch:
  543. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  544. case StepType.EndPoint:
  545. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  546. {
  547. LOG.Write(eEvent.INFO_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  548. return RState.End;
  549. }
  550. else
  551. {
  552. return Chamber.EPDCaptured ? RState.End : RState.Running;
  553. }
  554. }
  555. return RState.Running;
  556. }
  557. private RState stepEnder(RecipeStep step)
  558. {
  559. if (step.Type == StepType.EndPoint)
  560. {
  561. Chamber.EPDStepStop();
  562. }
  563. return RState.End;
  564. }
  565. public bool LoadStepFuns(RecipeStep step)
  566. {
  567. step.starter = stepStarter;
  568. step.checker = stepChecker;
  569. step.ender = stepEnder;
  570. return true;
  571. }
  572. }
  573. }