ProcessDefine.cs 26 KB

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