ProcessDefine.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Start(unit, step);
  60. checkerHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Check(unit, step);
  61. endHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_End(unit, step);
  62. startHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Start(unit, step);
  63. checkerHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Check(unit, step);
  64. endHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_End(unit, step);
  65. startHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Start(unit, step);
  66. checkerHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Check(unit, step);
  67. endHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_End(unit, step);
  68. startHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Start(unit, step);
  69. checkerHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Check(unit, step);
  70. endHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_End(unit, step);
  71. startHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Start(unit, step);
  72. checkerHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Check(unit, step);
  73. endHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_End(unit, step);
  74. }
  75. private RState PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  76. {
  77. var ProcessUnit = unit as PressureByPressureModeUnit;
  78. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  79. {
  80. if (Chamber.SetPVPressure(ProcessUnit.StartValue))
  81. {
  82. return RState.Running;
  83. }
  84. }
  85. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  86. {
  87. if (Chamber.SetPVPostion(ProcessUnit.StartValue))
  88. {
  89. return RState.Running;
  90. }
  91. }
  92. return RState.Failed;
  93. }
  94. private RState PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  95. {
  96. var ProcessUnit = unit as PressureByPressureModeUnit;
  97. if (ProcessUnit.EnableRamp)
  98. {
  99. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  100. {
  101. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  102. return RState.Running;
  103. else
  104. return RState.Failed;
  105. }
  106. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  107. {
  108. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  109. return RState.Running;
  110. else
  111. return RState.Failed;
  112. }
  113. }
  114. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  115. {
  116. if (step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartValue)
  117. {
  118. return RState.End;
  119. }
  120. }
  121. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  122. {
  123. if (step.Type == StepType.Stable && Chamber.GetPVPosition() == ProcessUnit.StartValue)
  124. {
  125. return RState.End;
  126. }
  127. }
  128. return RState.Running;
  129. }
  130. private void PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  131. {
  132. }
  133. #region Valve Mode已取消,合并到压力模式
  134. //private RState PressureByValveModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  135. //{
  136. // var ProcessUnit = unit as PressureByValveModeUnit;
  137. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition))
  138. // {
  139. // return RState.Running;
  140. // }
  141. // return RState.Failed;
  142. //}
  143. //private RState PressureByValveModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  144. //{
  145. // var ProcessUnit = unit as PressureByValveModeUnit;
  146. // if (ProcessUnit.EnableRamp)
  147. // {
  148. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
  149. // return RState.Running;
  150. // else
  151. // return RState.Failed;
  152. // }
  153. // return RState.Running;
  154. //}
  155. //private void PressureByValveModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  156. //{
  157. //}
  158. #endregion
  159. private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  160. {
  161. var ProcessUnit = unit as TCPUnit;
  162. if (ProcessUnit.RFPower > 5)
  163. {
  164. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  165. Chamber.GeneratorPowerOn(true);
  166. }
  167. else
  168. {
  169. Chamber.GeneratorSetpower(0);
  170. Chamber.GeneratorPowerOn(false);
  171. }
  172. int p1;
  173. int p2;
  174. if (ProcessUnit.TuneCapPreset > 0)
  175. {
  176. p1 = ProcessUnit.TuneCapPreset;
  177. }
  178. else
  179. {
  180. p1 = ProcessUnit.AutoTuneCapPreset;
  181. }
  182. if (ProcessUnit.LoadCapPreset > 0)
  183. {
  184. p2 = ProcessUnit.LoadCapPreset;
  185. }
  186. else
  187. {
  188. p2 = ProcessUnit.AutoLoadCapPreset;
  189. }
  190. Chamber.SetMatchPosition(p1, p2);
  191. if (ProcessUnit.MatchWorkMode == MatchWorkMode.Auto)
  192. {
  193. Chamber.SetMatchWorkMode(MatchWorkMode.Auto);
  194. }
  195. else if (ProcessUnit.MatchWorkMode == MatchWorkMode.Manual)
  196. {
  197. Chamber.SetMatchWorkMode(MatchWorkMode.Manual);
  198. }
  199. rfMatchC1.Clear();
  200. rfMatchC1.Clear();
  201. rfMatchC1C2Index = 0;
  202. return RState.Running;
  203. }
  204. private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  205. {
  206. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.Rf.PowerAlarmTime");
  207. var ProcessUnit = unit as TCPUnit;
  208. if (ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  209. {
  210. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  211. return RState.Failed;
  212. }
  213. if (step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  214. {
  215. Chamber.GeneratorSetpower(0);
  216. Chamber.GeneratorPowerOn(false);
  217. }
  218. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  219. {
  220. rfMatchC1.Add(Chamber.RFMatchC1);
  221. rfMatchC2.Add(Chamber.RFMatchC2);
  222. rfMatchC1C2Index += 1;
  223. }
  224. return RState.Running;
  225. }
  226. private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  227. {
  228. var ProcessUnit = unit as TCPUnit;
  229. if (rfMatchC1.Count >= 6)
  230. {
  231. float allValue = 0;
  232. for (int i = 4; i < rfMatchC1.Count; i++)
  233. {
  234. allValue += rfMatchC1[i];
  235. }
  236. var average = allValue / (rfMatchC1.Count - 4);
  237. ProcessUnit.AutoTuneCapPreset = (int)average;
  238. }
  239. if (rfMatchC2.Count >= 6)
  240. {
  241. float allValue = 0;
  242. for (int i = 4; i < rfMatchC2.Count; i++)
  243. {
  244. allValue += rfMatchC2[i];
  245. }
  246. var average = allValue / (rfMatchC2.Count - 4);
  247. ProcessUnit.AutoLoadCapPreset = (int)average;
  248. }
  249. rfMatchC1.Clear();
  250. rfMatchC2.Clear();
  251. rfMatchC1C2Index = 0;
  252. }
  253. private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  254. {
  255. var ProcessUnit = unit as BiasUnit;
  256. if (ProcessUnit.BiasRFPower > 5)
  257. {
  258. Chamber.GeneratorBiasPowerOn(true);
  259. if ((ProcessUnit.EnableRamp == false))
  260. {
  261. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  262. }
  263. }
  264. int p1;
  265. int p2;
  266. if (ProcessUnit.BiasTuneCapPreset > 0)
  267. {
  268. p1 = ProcessUnit.BiasTuneCapPreset;
  269. }
  270. else
  271. {
  272. p1 = ProcessUnit.AutoBiasTuneCapPreset;
  273. }
  274. if (ProcessUnit.BiasLoadCapPreset > 0)
  275. {
  276. p2 = ProcessUnit.BiasLoadCapPreset;
  277. }
  278. else
  279. {
  280. p2 = ProcessUnit.AutoBiasLoadCapPreset;
  281. }
  282. Chamber.SetBiasMatchPosition(p1, p2);
  283. if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Auto)
  284. {
  285. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Auto);
  286. }
  287. else if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Manual)
  288. {
  289. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Manual);
  290. }
  291. if (ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  292. {
  293. Chamber.SetBiasPulseMode(true);
  294. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  295. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  296. }
  297. else
  298. {
  299. Chamber.SetBiasPulseMode(false);
  300. }
  301. biasRfMatchC1.Clear();
  302. biasRfMatchC1.Clear();
  303. biasRfMatchC1C2Index = 0;
  304. biasRFSetPointFlag = true;
  305. return RState.Running;
  306. }
  307. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  308. {
  309. var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  310. var ProcessUnit = unit as BiasUnit;
  311. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scPowerAlarmTime * 1000)
  312. {
  313. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  314. return RState.Failed;
  315. }
  316. if (step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  317. {
  318. Chamber.GeneratorBiasSetpower(0);
  319. Chamber.GeneratorBiasPowerOn(false);
  320. }
  321. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  322. {
  323. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  324. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  325. biasRfMatchC1C2Index += 1;
  326. }
  327. if (ProcessUnit.EnableRamp)
  328. {
  329. //if (step.ElapsedTime() <= 500*cycleIndex)
  330. //{
  331. // return RState.Running;
  332. //}
  333. //cycleIndex += 1;
  334. if (ProcessUnit.TargetMode == TargetMode.Cycle)
  335. {
  336. if (biasRFSetPointFlag == true)
  337. {
  338. biasRFSetPointFlag = false;
  339. Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower + (float)((float)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((float)(loopsteps - 1) / (float)(currentStepIndex))))));
  340. }
  341. //float rampFactor = (float)currentStepIndex / (float)(loopsteps-1);
  342. //double rampFactor = step.RampFactor();
  343. //Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower+ (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower)/(loopsteps)*currentStepIndex) + ((double)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((double)loopsteps)) * rampFactor));
  344. }
  345. else
  346. {
  347. //double rampFactor = step.RampFactor();
  348. //Chamber.GeneratorBiasSetpower((float)(ProcessUnit.BiasRFPower + (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) * rampFactor));
  349. }
  350. }
  351. return RState.Running;
  352. }
  353. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  354. {
  355. var ProcessUnit = unit as BiasUnit;
  356. Chamber.GeneratorBiasSetpower(0);
  357. Chamber.GeneratorBiasPowerOn(false);
  358. if (biasRfMatchC1.Count >= 6)
  359. {
  360. float allValue = 0;
  361. for (int i = 4; i < biasRfMatchC1.Count; i++)
  362. {
  363. allValue += biasRfMatchC1[i];
  364. }
  365. var average = allValue / (biasRfMatchC1.Count - 4);
  366. ProcessUnit.AutoBiasTuneCapPreset = (int)average;
  367. }
  368. if (biasRfMatchC2.Count >= 6)
  369. {
  370. float allValue = 0;
  371. for (int i = 4; i < biasRfMatchC2.Count; i++)
  372. {
  373. allValue += biasRfMatchC2[i];
  374. }
  375. var average = allValue / (biasRfMatchC2.Count - 4);
  376. ProcessUnit.AutoBiasLoadCapPreset = (int)average;
  377. }
  378. biasRfMatchC1.Clear();
  379. biasRfMatchC1.Clear();
  380. biasRfMatchC1C2Index = 0;
  381. //cycleIndex = 0;
  382. biasRFSetPointFlag = true;
  383. }
  384. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  385. {
  386. Chamber.OpenValve(ValveType.GasFinal, true);
  387. var ProcessUnit = unit as GasControlUnit;
  388. Chamber.FlowGas(0, ProcessUnit.Gas1);
  389. if (ProcessUnit.Gas1 >= 1)
  390. {
  391. Chamber.OpenValve(ValveType.PV11, true);
  392. }
  393. Chamber.FlowGas(1, ProcessUnit.Gas2);
  394. if (ProcessUnit.Gas2 >= 1)
  395. {
  396. Chamber.OpenValve(ValveType.PV21, true);
  397. }
  398. Chamber.FlowGas(2, ProcessUnit.Gas3);
  399. if (ProcessUnit.Gas3 >= 1)
  400. {
  401. Chamber.OpenValve(ValveType.PV31, true);
  402. }
  403. Chamber.FlowGas(3, ProcessUnit.Gas4);
  404. if (ProcessUnit.Gas4 >= 1)
  405. {
  406. Chamber.OpenValve(ValveType.PV41, true);
  407. }
  408. Chamber.FlowGas(4, ProcessUnit.Gas5);
  409. Chamber.FlowGas(5, ProcessUnit.Gas6);
  410. Chamber.FlowGas(6, ProcessUnit.Gas7);
  411. Chamber.FlowGas(7, ProcessUnit.Gas8);
  412. return RState.Running;
  413. }
  414. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  415. {
  416. var ProcessUnit = unit as GasControlUnit;
  417. if (ProcessUnit.EnableRamp)
  418. {
  419. double rampFactor = step.RampFactor();
  420. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  421. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  422. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  423. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  424. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  425. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  426. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  427. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  428. }
  429. return RState.Running;
  430. }
  431. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  432. {
  433. Chamber.FlowGas(0, 0);
  434. Chamber.FlowGas(1, 0);
  435. Chamber.FlowGas(2, 0);
  436. Chamber.FlowGas(3, 0);
  437. Chamber.FlowGas(4, 0);
  438. Chamber.FlowGas(5, 0);
  439. Chamber.FlowGas(6, 0);
  440. Chamber.FlowGas(7, 0);
  441. }
  442. private RState VenusSEGasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  443. {
  444. Chamber.OpenValve(ValveType.GasFinal, true);
  445. var ProcessUnit = unit as VenusSEGasControlUnit;
  446. Chamber.FlowGas(0, ProcessUnit.Gas1);
  447. if (ProcessUnit.Gas1 >= 1)
  448. {
  449. Chamber.OpenValve(ValveType.PV11, true);
  450. }
  451. Chamber.FlowGas(1, ProcessUnit.Gas2);
  452. if (ProcessUnit.Gas2 >= 1)
  453. {
  454. Chamber.OpenValve(ValveType.PV21, true);
  455. }
  456. Chamber.FlowGas(2, ProcessUnit.Gas3);
  457. if (ProcessUnit.Gas3 >= 1)
  458. {
  459. Chamber.OpenValve(ValveType.PV31, true);
  460. }
  461. Chamber.FlowGas(3, ProcessUnit.Gas4);
  462. if (ProcessUnit.Gas4 >= 1)
  463. {
  464. Chamber.OpenValve(ValveType.PV41, true);
  465. }
  466. Chamber.FlowGas(4, ProcessUnit.Gas5);
  467. if (ProcessUnit.Gas5 >= 1)
  468. {
  469. Chamber.OpenValve(ValveType.PV51, true);
  470. }
  471. Chamber.FlowGas(5, ProcessUnit.Gas6);
  472. if (ProcessUnit.Gas6 >= 1)
  473. {
  474. Chamber.OpenValve(ValveType.PV61, true);
  475. }
  476. Chamber.FlowGas(6, ProcessUnit.Gas7);
  477. if (ProcessUnit.Gas7 >= 1)
  478. {
  479. Chamber.OpenValve(ValveType.PV71, true);
  480. }
  481. Chamber.FlowGas(7, ProcessUnit.Gas8);
  482. if (ProcessUnit.Gas8 >= 1)
  483. {
  484. Chamber.OpenValve(ValveType.PV81, true);
  485. }
  486. Chamber.FlowGas(8, ProcessUnit.Gas9);
  487. if (ProcessUnit.Gas9 >= 1)
  488. {
  489. Chamber.OpenValve(ValveType.PV91, true);
  490. }
  491. Chamber.FlowGas(9, ProcessUnit.Gas10);
  492. if (ProcessUnit.Gas10 >= 1)
  493. {
  494. Chamber.OpenValve(ValveType.PVA1, true);
  495. }
  496. Chamber.FlowGas(10, ProcessUnit.Gas11);
  497. if (ProcessUnit.Gas11 >= 1)
  498. {
  499. Chamber.OpenValve(ValveType.PVB1, true);
  500. }
  501. Chamber.FlowGas(11, ProcessUnit.Gas12);
  502. if (ProcessUnit.Gas12 >= 1)
  503. {
  504. Chamber.OpenValve(ValveType.PVC1, true);
  505. }
  506. return RState.Running;
  507. }
  508. private RState VenusSEGasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  509. {
  510. return RState.Running;
  511. }
  512. private void VenusSEGasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  513. {
  514. Chamber.FlowGas(0, 0);
  515. Chamber.FlowGas(1, 0);
  516. Chamber.FlowGas(2, 0);
  517. Chamber.FlowGas(3, 0);
  518. Chamber.FlowGas(4, 0);
  519. Chamber.FlowGas(5, 0);
  520. Chamber.FlowGas(6, 0);
  521. Chamber.FlowGas(7, 0);
  522. Chamber.FlowGas(8, 0);
  523. Chamber.FlowGas(9, 0);
  524. Chamber.FlowGas(10, 0);
  525. Chamber.FlowGas(11, 0);
  526. Chamber.FlowGas(12, 0);
  527. }
  528. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  529. {
  530. var ProcessUnit = unit as ESCHVUnit;
  531. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  532. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum);
  533. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  534. return RState.Running;
  535. }
  536. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  537. {
  538. if (Chamber.BackSideHeOutOfRange)
  539. {
  540. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  541. return RState.Failed;
  542. }
  543. return RState.Running;
  544. }
  545. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  546. {
  547. Chamber.SetESCClampVoltage(0);
  548. //Chamber.SetBacksideHePressure(0);
  549. Chamber.SetBacksideHeThreshold(0, 0);
  550. //Chamber.OnOffSetESCHV(false);
  551. }
  552. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  553. {
  554. var ProcessUnit = unit as ProcessKitUnit;
  555. if (Chamber.SetLiftPin(ProcessUnit.LiftPinPostion, out string reason))
  556. {
  557. return RState.Running;
  558. }
  559. else
  560. {
  561. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Position:{ProcessUnit.LiftPinPostion}");
  562. return RState.Failed;
  563. }
  564. }
  565. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  566. {
  567. var ProcessUnit = unit as ProcessKitUnit;
  568. return RState.Running;
  569. }
  570. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  571. {
  572. }
  573. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  574. {
  575. Chamber.OpenValve(ValveType.GasFinal, true);
  576. var ProcessUnit = unit as Kepler2200GasControlUnit;
  577. Chamber.FlowGas(0, ProcessUnit.Gas1);
  578. if (ProcessUnit.Gas1 >= 1)
  579. {
  580. Chamber.OpenValve(ValveType.PV11, true);
  581. }
  582. Chamber.FlowGas(1, ProcessUnit.Gas2);
  583. if (ProcessUnit.Gas2 >= 1)
  584. {
  585. Chamber.OpenValve(ValveType.PV21, true);
  586. }
  587. Chamber.FlowGas(2, ProcessUnit.Gas3);
  588. if (ProcessUnit.Gas3 >= 1)
  589. {
  590. Chamber.OpenValve(ValveType.PV31, true);
  591. }
  592. Chamber.FlowGas(3, ProcessUnit.Gas4);
  593. if (ProcessUnit.Gas4 >= 1)
  594. {
  595. Chamber.OpenValve(ValveType.PV41, true);
  596. }
  597. Chamber.FlowGas(4, ProcessUnit.Gas5);
  598. Chamber.FlowGas(5, ProcessUnit.Gas6);
  599. return RState.Running;
  600. }
  601. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  602. {
  603. return RState.Running;
  604. }
  605. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  606. {
  607. Chamber.FlowGas(0, 0);
  608. Chamber.FlowGas(1, 0);
  609. Chamber.FlowGas(2, 0);
  610. Chamber.FlowGas(3, 0);
  611. Chamber.FlowGas(4, 0);
  612. Chamber.FlowGas(5, 0);
  613. }
  614. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  615. {
  616. var ProcessUnit = unit as HeaterUnit;
  617. var position= (HighTemperatureHeaterPosition)Enum.Parse(typeof(HighTemperatureHeaterPosition), ProcessUnit.SuspectPosition.ToString());
  618. Chamber.HighTemperatureHeaterGotoPosition(position);
  619. return RState.Running;
  620. }
  621. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  622. {
  623. return RState.Running;
  624. }
  625. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  626. {
  627. }
  628. public bool LoadMethods(ProcessUnitBase unit)
  629. {
  630. var className = $"{Module}.{unit.GetType().Name}";
  631. if (startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  632. {
  633. unit.starter = startHelper[className];
  634. unit.checker = checkerHelper[className];
  635. unit.end = endHelper[className];
  636. return true;
  637. }
  638. return false;
  639. }
  640. //public void loopStep(bool isloop,int loopCount,int loopIndex)
  641. //{
  642. // isLoop = isloop;
  643. // loopsteps=loopCount;
  644. // currentStepIndex = loopIndex;
  645. //}
  646. private RState stepStarter(RecipeStep step)
  647. {
  648. step.StartStepTimer();
  649. switch (step.Type)
  650. {
  651. case StepType.EndPoint:
  652. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  653. break;
  654. }
  655. return RState.Running;
  656. }
  657. private RState stepChecker(RecipeStep step)
  658. {
  659. switch (step.Type)
  660. {
  661. case StepType.Time:
  662. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  663. case StepType.OverEtch:
  664. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  665. case StepType.EndPoint:
  666. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  667. {
  668. LOG.Write(eEvent.INFO_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  669. return RState.End;
  670. }
  671. else
  672. {
  673. return Chamber.EPDCaptured ? RState.End : RState.Running;
  674. }
  675. }
  676. return RState.Running;
  677. }
  678. private RState stepEnder(RecipeStep step)
  679. {
  680. if (step.Type == StepType.EndPoint)
  681. {
  682. Chamber.EPDStepStop();
  683. }
  684. return RState.End;
  685. }
  686. public bool LoadStepFuns(RecipeStep step)
  687. {
  688. step.starter = stepStarter;
  689. step.checker = stepChecker;
  690. step.ender = stepEnder;
  691. return true;
  692. }
  693. }
  694. }