ProcessDefine.cs 37 KB

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