ProcessDefine.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. using System;
  2. using System.Collections.Generic;
  3. //using System.
  4. using Venus_RT.Devices;
  5. using Aitex.Core.RT.Log;
  6. using Venus_Core;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.RT.Tolerance;
  9. //#pragma warning disable 0436
  10. namespace Venus_RT.Modules.PMs
  11. {
  12. class ProcessHelper
  13. {
  14. protected JetPMBase Chamber;
  15. private string Module;
  16. public RecipeHead m_RecipeHead;
  17. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  18. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  19. private static Dictionary<string, Action<ProcessUnitBase, RecipeStep>> endHelper = new Dictionary<string, Action<ProcessUnitBase, RecipeStep>>();
  20. private List<float> rfMatchC1 = new List<float>();
  21. private List<float> rfMatchC2 = new List<float>();
  22. private int rfMatchC1C2Index = 0;
  23. private List<float> biasRfMatchC1 = new List<float>();
  24. private List<float> biasRfMatchC2 = new List<float>();
  25. private int biasRfMatchC1C2Index = 0;
  26. public bool isLoop = false;
  27. public int loopsteps = 0;
  28. public int currentStepIndex = 0;
  29. private bool biasRFSetPointFlag = true;
  30. private double _scRFPowerAlarmTime;
  31. private double _scBiasRFPowerAlarmTime;
  32. private RecipeToleranceChecker _GasFlowToleranceChecker;
  33. private RecipeToleranceChecker _RFToleranceChecker;
  34. private RecipeToleranceChecker _BiasRFToleranceChecker;
  35. public ProcessHelper(JetPMBase pm)
  36. {
  37. Chamber = pm;
  38. Module = pm.Module.ToString();
  39. Init();
  40. _GasFlowToleranceChecker = new RecipeToleranceChecker(Module);
  41. _RFToleranceChecker = new RecipeToleranceChecker(Module);
  42. _BiasRFToleranceChecker= new RecipeToleranceChecker(Module);
  43. }
  44. private void Init()
  45. {
  46. startHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Start(unit, step);
  47. checkerHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Check(unit, step);
  48. endHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_End(unit, step);
  49. //startHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Start(unit, step);
  50. //checkerHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Check(unit, step);
  51. //endHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_End(unit, step);
  52. startHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Start(unit, step);
  53. checkerHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Check(unit, step);
  54. endHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_End(unit, step);
  55. startHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Start(unit, step);
  56. checkerHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Check(unit, step);
  57. endHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_End(unit, step);
  58. startHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Start(unit, step);
  59. checkerHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Check(unit, step);
  60. endHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_End(unit, step);
  61. startHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Start(unit, step);
  62. checkerHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Check(unit, step);
  63. endHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_End(unit, step);
  64. startHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Start(unit, step);
  65. checkerHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Check(unit, step);
  66. endHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_End(unit, step);
  67. startHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Start(unit, step);
  68. checkerHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Check(unit, step);
  69. endHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_End(unit, step);
  70. startHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Start(unit, step);
  71. checkerHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Check(unit, step);
  72. endHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_End(unit, step);
  73. startHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Start(unit, step);
  74. checkerHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Check(unit, step);
  75. endHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_End(unit, step);
  76. startHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_Start(unit, step);
  77. checkerHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_Check(unit, step);
  78. endHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_End(unit, step);
  79. }
  80. private RState PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  81. {
  82. var ProcessUnit = unit as PressureByPressureModeUnit;
  83. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  84. {
  85. if (Chamber.SetPVPressure(ProcessUnit.StartValue))
  86. {
  87. return RState.Running;
  88. }
  89. }
  90. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  91. {
  92. if (Chamber.SetPVPostion(Convert.ToInt32(ProcessUnit.StartValue)))
  93. {
  94. return RState.Running;
  95. }
  96. }
  97. return RState.Failed;
  98. }
  99. private RState PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  100. {
  101. var ProcessUnit = unit as PressureByPressureModeUnit;
  102. if (ProcessUnit.EnableRamp)
  103. {
  104. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  105. {
  106. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  107. return RState.Running;
  108. else
  109. return RState.Failed;
  110. }
  111. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  112. {
  113. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  114. return RState.Running;
  115. else
  116. return RState.Failed;
  117. }
  118. }
  119. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  120. {
  121. if (step.Type == StepType.Stable && Chamber.ChamberPressure == ProcessUnit.StartValue)
  122. {
  123. return RState.End;
  124. }
  125. }
  126. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  127. {
  128. if (step.Type == StepType.Stable && Chamber.GetPVPosition() == ProcessUnit.StartValue)
  129. {
  130. return RState.End;
  131. }
  132. }
  133. return RState.Running;
  134. }
  135. private void PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  136. {
  137. }
  138. #region Valve Mode已取消,合并到压力模式
  139. //private RState PressureByValveModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  140. //{
  141. // var ProcessUnit = unit as PressureByValveModeUnit;
  142. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition))
  143. // {
  144. // return RState.Running;
  145. // }
  146. // return RState.Failed;
  147. //}
  148. //private RState PressureByValveModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  149. //{
  150. // var ProcessUnit = unit as PressureByValveModeUnit;
  151. // if (ProcessUnit.EnableRamp)
  152. // {
  153. // if (Chamber.SetPVPostion(ProcessUnit.StartPosition + (int)((ProcessUnit.TargetPosition - ProcessUnit.StartPosition) * step.RampFactor())))
  154. // return RState.Running;
  155. // else
  156. // return RState.Failed;
  157. // }
  158. // return RState.Running;
  159. //}
  160. //private void PressureByValveModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  161. //{
  162. //}
  163. #endregion
  164. private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  165. {
  166. var ProcessUnit = unit as TCPUnit;
  167. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  168. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  169. {
  170. toleranceObjects.Add(new ToleranceObject("RF", ProcessUnit.RFPower, ProcessUnit.RFPowerWarningRange, ProcessUnit.RFPowerAlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  171. _RFToleranceChecker.Start(toleranceObjects);
  172. }
  173. int p1;
  174. int p2;
  175. if (ProcessUnit.C1 > 0)
  176. {
  177. p1 = ProcessUnit.C1;
  178. }
  179. else
  180. {
  181. p1 = ProcessUnit.AutoC1;
  182. }
  183. if (ProcessUnit.C2 > 0)
  184. {
  185. p2 = ProcessUnit.C2;
  186. }
  187. else
  188. {
  189. p2 = ProcessUnit.AutoC2;
  190. }
  191. Chamber.SetMatchPosition(p1, p2);
  192. if (ProcessUnit.RFPower > 5)
  193. {
  194. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  195. Chamber.GeneratorPowerOn(true);
  196. }
  197. else
  198. {
  199. Chamber.GeneratorSetpower(0);
  200. Chamber.GeneratorPowerOn(false);
  201. }
  202. if (ProcessUnit.MatchWorkMode == MatchWorkMode.Auto)
  203. {
  204. Chamber.SetMatchWorkMode(MatchWorkMode.Auto);
  205. }
  206. else if (ProcessUnit.MatchWorkMode == MatchWorkMode.Manual)
  207. {
  208. Chamber.SetMatchWorkMode(MatchWorkMode.Manual);
  209. }
  210. _scRFPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.Rf.PowerAlarmTime");
  211. rfMatchC1.Clear();
  212. rfMatchC1.Clear();
  213. rfMatchC1C2Index = 0;
  214. return RState.Running;
  215. }
  216. private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  217. {
  218. var ProcessUnit = unit as TCPUnit;
  219. if (ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scRFPowerAlarmTime * 1000)
  220. {
  221. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  222. return RState.Failed;
  223. }
  224. if (step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  225. {
  226. Chamber.GeneratorSetpower(0);
  227. Chamber.GeneratorPowerOn(false);
  228. }
  229. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  230. {
  231. rfMatchC1.Add(Chamber.RFMatchC1);
  232. rfMatchC2.Add(Chamber.RFMatchC2);
  233. rfMatchC1C2Index += 1;
  234. }
  235. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  236. {
  237. _RFToleranceChecker.Monitor(Chamber.ForwardPower);
  238. }
  239. return RState.Running;
  240. }
  241. private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  242. {
  243. var ProcessUnit = unit as TCPUnit;
  244. if (rfMatchC1.Count >= 6)
  245. {
  246. float allValue = 0;
  247. for (int i = 4; i < rfMatchC1.Count; i++)
  248. {
  249. allValue += rfMatchC1[i];
  250. }
  251. var average = allValue / (rfMatchC1.Count - 4);
  252. ProcessUnit.AutoC1 = (int)average;
  253. }
  254. if (rfMatchC2.Count >= 6)
  255. {
  256. float allValue = 0;
  257. for (int i = 4; i < rfMatchC2.Count; i++)
  258. {
  259. allValue += rfMatchC2[i];
  260. }
  261. var average = allValue / (rfMatchC2.Count - 4);
  262. ProcessUnit.AutoC2 = (int)average;
  263. }
  264. rfMatchC1.Clear();
  265. rfMatchC2.Clear();
  266. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  267. {
  268. _RFToleranceChecker.End();
  269. }
  270. }
  271. private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  272. {
  273. var ProcessUnit = unit as BiasUnit;
  274. int p1;
  275. int p2;
  276. if (ProcessUnit.BiasC1 > 0)
  277. {
  278. p1 = ProcessUnit.BiasC1;
  279. }
  280. else
  281. {
  282. p1 = ProcessUnit.AutoBiasC1;
  283. }
  284. if (ProcessUnit.BiasC2 > 0)
  285. {
  286. p2 = ProcessUnit.BiasC2;
  287. }
  288. else
  289. {
  290. p2 = ProcessUnit.AutoBiasC2;
  291. }
  292. Chamber.SetBiasMatchPosition(p1, p2);
  293. if (ProcessUnit.BiasRFPower > 5)
  294. {
  295. Chamber.GeneratorBiasPowerOn(true);
  296. if ((ProcessUnit.EnableRamp == false))
  297. {
  298. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  299. }
  300. }
  301. else
  302. {
  303. Chamber.GeneratorBiasPowerOn(false);
  304. Chamber.GeneratorBiasSetpower(0);
  305. }
  306. if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Auto)
  307. {
  308. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Auto);
  309. }
  310. else if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Manual)
  311. {
  312. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Manual);
  313. }
  314. if (ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  315. {
  316. Chamber.SetBiasPulseMode(true);
  317. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  318. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  319. }
  320. else
  321. {
  322. Chamber.SetBiasPulseMode(false);
  323. }
  324. _scBiasRFPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  325. biasRfMatchC1.Clear();
  326. biasRfMatchC1.Clear();
  327. biasRfMatchC1C2Index = 0;
  328. biasRFSetPointFlag = true;
  329. return RState.Running;
  330. }
  331. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  332. {
  333. //var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  334. var ProcessUnit = unit as BiasUnit;
  335. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scBiasRFPowerAlarmTime * 1000)
  336. {
  337. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower}");
  338. return RState.Failed;
  339. }
  340. if (step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  341. {
  342. Chamber.GeneratorBiasSetpower(0);
  343. Chamber.GeneratorBiasPowerOn(false);
  344. }
  345. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  346. {
  347. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  348. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  349. biasRfMatchC1C2Index += 1;
  350. }
  351. if (ProcessUnit.EnableRamp)
  352. {
  353. //if (step.ElapsedTime() <= 500*cycleIndex)
  354. //{
  355. // return RState.Running;
  356. //}
  357. //cycleIndex += 1;
  358. if (ProcessUnit.TargetMode == TargetMode.Cycle)
  359. {
  360. if (biasRFSetPointFlag == true)
  361. {
  362. biasRFSetPointFlag = false;
  363. Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower + (float)((float)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((float)(loopsteps - 1) / (float)(currentStepIndex))))));
  364. }
  365. //float rampFactor = (float)currentStepIndex / (float)(loopsteps-1);
  366. //double rampFactor = step.RampFactor();
  367. //Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower+ (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower)/(loopsteps)*currentStepIndex) + ((double)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((double)loopsteps)) * rampFactor));
  368. }
  369. else
  370. {
  371. //double rampFactor = step.RampFactor();
  372. //Chamber.GeneratorBiasSetpower((float)(ProcessUnit.BiasRFPower + (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) * rampFactor));
  373. }
  374. }
  375. return RState.Running;
  376. }
  377. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  378. {
  379. var ProcessUnit = unit as BiasUnit;
  380. //Chamber.GeneratorBiasSetpower(0);
  381. //Chamber.GeneratorBiasPowerOn(false);
  382. if (biasRfMatchC1.Count >= 6)
  383. {
  384. float allValue = 0;
  385. for (int i = 4; i < biasRfMatchC1.Count; i++)
  386. {
  387. allValue += biasRfMatchC1[i];
  388. }
  389. var average = allValue / (biasRfMatchC1.Count - 4);
  390. ProcessUnit.AutoBiasC1 = (int)average;
  391. }
  392. if (biasRfMatchC2.Count >= 6)
  393. {
  394. float allValue = 0;
  395. for (int i = 4; i < biasRfMatchC2.Count; i++)
  396. {
  397. allValue += biasRfMatchC2[i];
  398. }
  399. var average = allValue / (biasRfMatchC2.Count - 4);
  400. ProcessUnit.AutoBiasC2 = (int)average;
  401. }
  402. biasRfMatchC1.Clear();
  403. biasRfMatchC1.Clear();
  404. biasRfMatchC1C2Index = 0;
  405. //cycleIndex = 0;
  406. biasRFSetPointFlag = true;
  407. }
  408. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  409. {
  410. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  411. Chamber.OpenValve(ValveType.GasFinal, true);
  412. var ProcessUnit = unit as GasControlUnit;
  413. Chamber.FlowGas(0, ProcessUnit.Gas1);
  414. if (ProcessUnit.Gas1 >= 1 )
  415. {
  416. Chamber.OpenValve(ValveType.PV11, true);
  417. if (ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  418. {
  419. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  420. }
  421. }
  422. Chamber.FlowGas(1, ProcessUnit.Gas2);
  423. if (ProcessUnit.Gas2 >= 1 )
  424. {
  425. Chamber.OpenValve(ValveType.PV21, true);
  426. if (ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  427. {
  428. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  429. }
  430. }
  431. Chamber.FlowGas(2, ProcessUnit.Gas3);
  432. if (ProcessUnit.Gas3 >= 1)
  433. {
  434. Chamber.OpenValve(ValveType.PV31, true);
  435. if (ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  436. {
  437. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  438. }
  439. }
  440. Chamber.FlowGas(3, ProcessUnit.Gas4);
  441. if (ProcessUnit.Gas4 >= 1 )
  442. {
  443. Chamber.OpenValve(ValveType.PV41, true);
  444. if (ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  445. {
  446. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  447. }
  448. }
  449. Chamber.FlowGas(4, ProcessUnit.Gas5);
  450. Chamber.FlowGas(5, ProcessUnit.Gas6);
  451. Chamber.FlowGas(6, ProcessUnit.Gas7);
  452. Chamber.FlowGas(7, ProcessUnit.Gas8);
  453. if (ProcessUnit.Gas5 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  454. {
  455. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  456. }
  457. if (ProcessUnit.Gas6 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  458. {
  459. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  460. }
  461. if (ProcessUnit.Gas7 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  462. {
  463. toleranceObjects.Add(new ToleranceObject("Gas7", ProcessUnit.Gas7, ProcessUnit.Gas7WarningRange, ProcessUnit.Gas7AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  464. }
  465. if (ProcessUnit.Gas8 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  466. {
  467. toleranceObjects.Add(new ToleranceObject("Gas8", ProcessUnit.Gas8, ProcessUnit.Gas8WarningRange, ProcessUnit.Gas8AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  468. }
  469. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  470. {
  471. _GasFlowToleranceChecker.Start(toleranceObjects);
  472. }
  473. return RState.Running;
  474. }
  475. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  476. {
  477. var ProcessUnit = unit as GasControlUnit;
  478. if (ProcessUnit.EnableRamp)
  479. {
  480. double rampFactor = step.RampFactor();
  481. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  482. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  483. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  484. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  485. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  486. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  487. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  488. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  489. }
  490. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  491. {
  492. _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack, Chamber.MFC7FeedBack, Chamber.MFC8FeedBack);
  493. }
  494. return RState.Running;
  495. }
  496. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  497. {
  498. Chamber.FlowGas(0, 0);
  499. Chamber.FlowGas(1, 0);
  500. Chamber.FlowGas(2, 0);
  501. Chamber.FlowGas(3, 0);
  502. Chamber.FlowGas(4, 0);
  503. Chamber.FlowGas(5, 0);
  504. Chamber.FlowGas(6, 0);
  505. Chamber.FlowGas(7, 0);
  506. var ProcessUnit = unit as GasControlUnit;
  507. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  508. {
  509. _GasFlowToleranceChecker.End();
  510. }
  511. }
  512. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  513. {
  514. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  515. Chamber.OpenValve(ValveType.GasFinal, true);
  516. var ProcessUnit = unit as Kepler2200GasControlUnit;
  517. Chamber.FlowGas(0, ProcessUnit.Gas1);
  518. if (ProcessUnit.Gas1 >= 1)
  519. {
  520. Chamber.OpenValve(ValveType.PV11, true);
  521. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  522. {
  523. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  524. }
  525. }
  526. Chamber.FlowGas(1, ProcessUnit.Gas2);
  527. if (ProcessUnit.Gas2 >= 1)
  528. {
  529. Chamber.OpenValve(ValveType.PV21, true);
  530. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  531. {
  532. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  533. }
  534. }
  535. Chamber.FlowGas(2, ProcessUnit.Gas3);
  536. if (ProcessUnit.Gas3 >= 1)
  537. {
  538. Chamber.OpenValve(ValveType.PV31, true);
  539. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  540. {
  541. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  542. }
  543. }
  544. Chamber.FlowGas(3, ProcessUnit.Gas4);
  545. if (ProcessUnit.Gas4 >= 1)
  546. {
  547. Chamber.OpenValve(ValveType.PV41, true);
  548. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  549. {
  550. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas4, ProcessUnit.Gas4WarningRange, ProcessUnit.Gas4AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  551. }
  552. }
  553. Chamber.FlowGas(4, ProcessUnit.Gas5);
  554. Chamber.FlowGas(5, ProcessUnit.Gas6);
  555. if (ProcessUnit.Gas5 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  556. {
  557. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  558. }
  559. if (ProcessUnit.Gas6 >= 1 && ProcessUnit.ToleranceMode != ToleranceMode.None && ProcessUnit.ToleranceDelayTime_ms > 0)
  560. {
  561. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime_ms, ProcessUnit.ToleranceMode));
  562. }
  563. return RState.Running;
  564. }
  565. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  566. {
  567. var ProcessUnit = unit as Kepler2200GasControlUnit;
  568. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  569. {
  570. _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack);
  571. }
  572. return RState.Running;
  573. }
  574. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  575. {
  576. Chamber.FlowGas(0, 0);
  577. Chamber.FlowGas(1, 0);
  578. Chamber.FlowGas(2, 0);
  579. Chamber.FlowGas(3, 0);
  580. Chamber.FlowGas(4, 0);
  581. Chamber.FlowGas(5, 0);
  582. var ProcessUnit = unit as Kepler2200GasControlUnit;
  583. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  584. {
  585. _GasFlowToleranceChecker.End();
  586. }
  587. }
  588. private RState VenusSEGasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  589. {
  590. Chamber.OpenValve(ValveType.GasFinal, true);
  591. var ProcessUnit = unit as VenusSEGasControlUnit;
  592. Chamber.FlowGas(0, ProcessUnit.Gas1);
  593. if (ProcessUnit.Gas1 >= 1)
  594. {
  595. Chamber.OpenValve(ValveType.PV11, true);
  596. }
  597. Chamber.FlowGas(1, ProcessUnit.Gas2);
  598. if (ProcessUnit.Gas2 >= 1)
  599. {
  600. Chamber.OpenValve(ValveType.PV21, true);
  601. }
  602. Chamber.FlowGas(2, ProcessUnit.Gas3);
  603. if (ProcessUnit.Gas3 >= 1)
  604. {
  605. Chamber.OpenValve(ValveType.PV31, true);
  606. }
  607. Chamber.FlowGas(3, ProcessUnit.Gas4);
  608. if (ProcessUnit.Gas4 >= 1)
  609. {
  610. Chamber.OpenValve(ValveType.PV41, true);
  611. }
  612. Chamber.FlowGas(4, ProcessUnit.Gas5);
  613. if (ProcessUnit.Gas5 >= 1)
  614. {
  615. Chamber.OpenValve(ValveType.PV51, true);
  616. }
  617. Chamber.FlowGas(5, ProcessUnit.Gas6);
  618. if (ProcessUnit.Gas6 >= 1)
  619. {
  620. Chamber.OpenValve(ValveType.PV61, true);
  621. }
  622. Chamber.FlowGas(6, ProcessUnit.Gas7);
  623. if (ProcessUnit.Gas7 >= 1)
  624. {
  625. Chamber.OpenValve(ValveType.PV71, true);
  626. }
  627. Chamber.FlowGas(7, ProcessUnit.Gas8);
  628. if (ProcessUnit.Gas8 >= 1)
  629. {
  630. Chamber.OpenValve(ValveType.PV81, true);
  631. }
  632. Chamber.FlowGas(8, ProcessUnit.Gas9);
  633. if (ProcessUnit.Gas9 >= 1)
  634. {
  635. Chamber.OpenValve(ValveType.PV91, true);
  636. }
  637. Chamber.FlowGas(9, ProcessUnit.Gas10);
  638. if (ProcessUnit.Gas10 >= 1)
  639. {
  640. Chamber.OpenValve(ValveType.PVA1, true);
  641. }
  642. Chamber.FlowGas(10, ProcessUnit.Gas11);
  643. if (ProcessUnit.Gas11 >= 1)
  644. {
  645. Chamber.OpenValve(ValveType.PVB1, true);
  646. }
  647. Chamber.FlowGas(11, ProcessUnit.Gas12);
  648. if (ProcessUnit.Gas12 >= 1)
  649. {
  650. Chamber.OpenValve(ValveType.PVC1, true);
  651. }
  652. return RState.Running;
  653. }
  654. private RState VenusSEGasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  655. {
  656. return RState.Running;
  657. }
  658. private void VenusSEGasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  659. {
  660. Chamber.FlowGas(0, 0);
  661. Chamber.FlowGas(1, 0);
  662. Chamber.FlowGas(2, 0);
  663. Chamber.FlowGas(3, 0);
  664. Chamber.FlowGas(4, 0);
  665. Chamber.FlowGas(5, 0);
  666. Chamber.FlowGas(6, 0);
  667. Chamber.FlowGas(7, 0);
  668. Chamber.FlowGas(8, 0);
  669. Chamber.FlowGas(9, 0);
  670. Chamber.FlowGas(10, 0);
  671. Chamber.FlowGas(11, 0);
  672. Chamber.FlowGas(12, 0);
  673. }
  674. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  675. {
  676. var ProcessUnit = unit as ESCHVUnit;
  677. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  678. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelum);
  679. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  680. return RState.Running;
  681. }
  682. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  683. {
  684. if (Chamber.BackSideHeOutOfRange)
  685. {
  686. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  687. return RState.Failed;
  688. }
  689. return RState.Running;
  690. }
  691. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  692. {
  693. Chamber.SetESCClampVoltage(0);
  694. //Chamber.SetBacksideHePressure(0);
  695. Chamber.SetBacksideHeThreshold(0, 0);
  696. //Chamber.OnOffSetESCHV(false);
  697. }
  698. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  699. {
  700. var ProcessUnit = unit as ProcessKitUnit;
  701. if (Chamber.SetLiftPin(ProcessUnit.LiftPinPostion, out string reason))
  702. {
  703. return RState.Running;
  704. }
  705. else
  706. {
  707. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Position:{ProcessUnit.LiftPinPostion}");
  708. return RState.Failed;
  709. }
  710. }
  711. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  712. {
  713. var ProcessUnit = unit as ProcessKitUnit;
  714. return RState.Running;
  715. }
  716. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  717. {
  718. }
  719. private RState RFBoxUnit_Start(ProcessUnitBase unit, RecipeStep step)
  720. {
  721. return RState.Running;
  722. }
  723. private RState RFBoxUnit_Check(ProcessUnitBase unit, RecipeStep step)
  724. {
  725. return RState.Running;
  726. }
  727. private void RFBoxUnit_End(ProcessUnitBase unit, RecipeStep step)
  728. {
  729. }
  730. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  731. {
  732. var ProcessUnit = unit as HeaterUnit;
  733. var position = (HighTemperatureHeaterPosition)Enum.Parse(typeof(HighTemperatureHeaterPosition), ProcessUnit.SuspectPosition.ToString());
  734. Chamber.HighTemperatureHeaterGotoPosition(position);
  735. Chamber.SetHighTemperatureHeaterTemperature(ProcessUnit.HeaterTemp);
  736. Chamber.SetHighTemperatureHeaterRatio(ProcessUnit.HeaterRatio);
  737. return RState.Running;
  738. }
  739. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  740. {
  741. return RState.Running;
  742. }
  743. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  744. {
  745. }
  746. public bool LoadMethods(ProcessUnitBase unit)
  747. {
  748. var className = $"{Module}.{unit.GetType().Name}";
  749. if (startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  750. {
  751. unit.starter = startHelper[className];
  752. unit.checker = checkerHelper[className];
  753. unit.end = endHelper[className];
  754. return true;
  755. }
  756. return false;
  757. }
  758. //public void loopStep(bool isloop,int loopCount,int loopIndex)
  759. //{
  760. // isLoop = isloop;
  761. // loopsteps=loopCount;
  762. // currentStepIndex = loopIndex;
  763. //}
  764. private RState stepStarter(RecipeStep step)
  765. {
  766. step.StartStepTimer();
  767. switch (step.Type)
  768. {
  769. case StepType.EndPoint:
  770. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  771. break;
  772. }
  773. return RState.Running;
  774. }
  775. private RState stepChecker(RecipeStep step)
  776. {
  777. switch (step.Type)
  778. {
  779. case StepType.Time:
  780. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  781. case StepType.OverEtch:
  782. return step.ElapsedTime() >= (step.GetLastEPDStepTime() * step.OverEtchPercent / 100) ? RState.End : RState.Running;
  783. case StepType.EndPoint:
  784. if (step.ElapsedTime() > step.MaxEndPointTime * 1000)
  785. {
  786. LOG.Write(eEvent.INFO_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  787. return RState.End;
  788. }
  789. else
  790. {
  791. return Chamber.EPDCaptured ? RState.End : RState.Running;
  792. }
  793. }
  794. return RState.Running;
  795. }
  796. private RState stepEnder(RecipeStep step)
  797. {
  798. if (step.Type == StepType.EndPoint)
  799. {
  800. Chamber.EPDStepStop();
  801. }
  802. return RState.End;
  803. }
  804. public bool LoadStepFuns(RecipeStep step)
  805. {
  806. step.starter = stepStarter;
  807. step.checker = stepChecker;
  808. step.ender = stepEnder;
  809. return true;
  810. }
  811. }
  812. }