ProcessDefine.cs 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  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. using System.Diagnostics;
  10. using MECF.Framework.Common.DBCore;
  11. //#pragma warning disable 0436
  12. namespace Venus_RT.Modules.PMs
  13. {
  14. class ProcessHelper
  15. {
  16. protected JetPMBase Chamber;
  17. private string Module;
  18. public RecipeHead m_RecipeHead;
  19. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> startHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  20. private static Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>> checkerHelper = new Dictionary<string, Func<ProcessUnitBase, RecipeStep, RState>>();
  21. private static Dictionary<string, Action<ProcessUnitBase, RecipeStep>> endHelper = new Dictionary<string, Action<ProcessUnitBase, RecipeStep>>();
  22. private List<float> rfMatchC1 = new List<float>();
  23. private List<float> rfMatchC2 = new List<float>();
  24. private int rfMatchC1C2Index = 0;
  25. private List<float> biasRfMatchC1 = new List<float>();
  26. private List<float> biasRfMatchC2 = new List<float>();
  27. private int biasRfMatchC1C2Index = 0;
  28. public bool isLoop = false;
  29. public int loopsteps = 0;
  30. public int currentStepIndex = 0;
  31. private bool biasRFSetPointFlag = true;
  32. private double _scRFPowerAlarmTime;
  33. private double _scBiasRFPowerAlarmTime;
  34. private RecipeToleranceChecker _GasFlowToleranceChecker;
  35. private RecipeToleranceChecker _RFToleranceChecker;
  36. private RecipeToleranceChecker _BiasRFToleranceChecker;
  37. //private RecipeToleranceChecker _HeliumToleranceChecker;
  38. private RecipeToleranceChecker _PressureToleranceChecker;
  39. private RecipeToleranceChecker _HighTemperatureToleranceChecker;
  40. private RecipeToleranceChecker _MagnetToleranceChecker;
  41. private bool _isEnableMatchC1C2Offset;
  42. private int _matchC1C2OffsetValue;
  43. private bool _isEnableBiasMatchC1C2Offset;
  44. private int _biasMatchC1C2OffsetValue;
  45. private int _BiasReflectPowerOverCount = 0;
  46. private bool _BiasReflectPowerOverFlag = false;
  47. private bool _isInstalledEPD;
  48. private Stopwatch _lastEPDStepTimeStopwatch;
  49. public long? lastEPDStepTime;
  50. //private Fdc _fdc;
  51. //private string _RecipeId;
  52. public int EAP_StepTime;
  53. private Stopwatch _StableStopWach = new Stopwatch();
  54. //private int _RfReflectPowerOverCounter;
  55. public ProcessHelper(JetPMBase pm)
  56. {
  57. Chamber = pm;
  58. Module = pm.Module.ToString();
  59. Init();
  60. _GasFlowToleranceChecker = new RecipeToleranceChecker(Module);
  61. _RFToleranceChecker = new RecipeToleranceChecker(Module);
  62. _BiasRFToleranceChecker = new RecipeToleranceChecker(Module);
  63. //_HeliumToleranceChecker = new RecipeToleranceChecker(Module);
  64. _PressureToleranceChecker = new RecipeToleranceChecker(Module);
  65. _HighTemperatureToleranceChecker = new RecipeToleranceChecker(Module);
  66. _MagnetToleranceChecker = new RecipeToleranceChecker(Module);
  67. if (Chamber.ChamberType == JetChamber.Kepler2300 || Chamber.ChamberType == JetChamber.VenusSE || Chamber.ChamberType == JetChamber.VenusDE)
  68. {
  69. _isInstalledEPD = SC.GetValue<bool>($"{Module}.EPD.IsEnabled");
  70. }
  71. if (_isInstalledEPD)
  72. {
  73. _lastEPDStepTimeStopwatch = new Stopwatch();
  74. }
  75. _StableStopWach.Reset();
  76. }
  77. private void Init()
  78. {
  79. startHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Start(unit, step);
  80. checkerHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_Check(unit, step);
  81. endHelper[$"{Module}.PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByPressureModeUnit_End(unit, step);
  82. startHelper[$"{Module}.Kepler2200PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200PressureByPressureModeUnit_Start(unit, step);
  83. checkerHelper[$"{Module}.Kepler2200PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200PressureByPressureModeUnit_Check(unit, step);
  84. endHelper[$"{Module}.Kepler2200PressureByPressureModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200PressureByPressureModeUnit_End(unit, step);
  85. //startHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Start(unit, step);
  86. //checkerHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_Check(unit, step);
  87. //endHelper [$"{Module}.PressureByValveModeUnit"] = (ProcessUnitBase unit, RecipeStep step) => PressureByValveModeUnit_End(unit, step);
  88. startHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Start(unit, step);
  89. checkerHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_Check(unit, step);
  90. endHelper[$"{Module}.TCPUnit"] = (ProcessUnitBase unit, RecipeStep step) => TCPUnit_End(unit, step);
  91. startHelper[$"{Module}.RFUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFUnit_Start(unit, step);
  92. checkerHelper[$"{Module}.RFUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFUnit_Check(unit, step);
  93. endHelper[$"{Module}.RFUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFUnit_End(unit, step);
  94. startHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Start(unit, step);
  95. checkerHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_Check(unit, step);
  96. endHelper[$"{Module}.BiasUnit"] = (ProcessUnitBase unit, RecipeStep step) => BiasUnit_End(unit, step);
  97. startHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Start(unit, step);
  98. checkerHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_Check(unit, step);
  99. endHelper[$"{Module}.GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => GasControlUnit_End(unit, step);
  100. startHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Start(unit, step);
  101. checkerHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_Check(unit, step);
  102. endHelper[$"{Module}.VenusSEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusSEGasControlUnit_End(unit, step);
  103. startHelper[$"{Module}.VenusDEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusDEGasControlUnit_Start(unit, step);
  104. checkerHelper[$"{Module}.VenusDEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusDEGasControlUnit_Check(unit, step);
  105. endHelper[$"{Module}.VenusDEGasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => VenusDEGasControlUnit_End(unit, step);
  106. startHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Start(unit, step);
  107. checkerHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_Check(unit, step);
  108. endHelper[$"{Module}.ESCHVUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHVUnit_End(unit, step);
  109. startHelper[$"{Module}.ESCHV8InchUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHV8InchUnit_Start(unit, step);
  110. checkerHelper[$"{Module}.ESCHV8InchUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHV8InchUnit_Check(unit, step);
  111. endHelper[$"{Module}.ESCHV8InchUnit"] = (ProcessUnitBase unit, RecipeStep step) => ESCHV8InchUnit_End(unit, step);
  112. startHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Start(unit, step);
  113. checkerHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_Check(unit, step);
  114. endHelper[$"{Module}.ProcessKitUnit"] = (ProcessUnitBase unit, RecipeStep step) => ProcessKitUnit_End(unit, step);
  115. startHelper[$"{Module}.HeliumPumpUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeliumPumpUnit_Start(unit, step);
  116. checkerHelper[$"{Module}.HeliumPumpUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeliumPumpUnit_Check(unit, step);
  117. endHelper[$"{Module}.HeliumPumpUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeliumPumpUnit_End(unit, step);
  118. startHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Start(unit, step);
  119. checkerHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_Check(unit, step);
  120. endHelper[$"{Module}.Kepler2200GasControlUnit"] = (ProcessUnitBase unit, RecipeStep step) => Kepler2200GasControlUnit_End(unit, step);
  121. startHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Start(unit, step);
  122. checkerHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_Check(unit, step);
  123. endHelper[$"{Module}.HeaterUnit"] = (ProcessUnitBase unit, RecipeStep step) => HeaterUnit_End(unit, step);
  124. startHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_Start(unit, step);
  125. checkerHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_Check(unit, step);
  126. endHelper[$"{Module}.RFBoxUnit"] = (ProcessUnitBase unit, RecipeStep step) => RFBoxUnit_End(unit, step);
  127. startHelper[$"{Module}.MagnetUnit"] = (ProcessUnitBase unit, RecipeStep step) => MagnetUnit_Start(unit, step);
  128. checkerHelper[$"{Module}.MagnetUnit"] = (ProcessUnitBase unit, RecipeStep step) => MagnetUnit_Check(unit, step);
  129. endHelper[$"{Module}.MagnetUnit"] = (ProcessUnitBase unit, RecipeStep step) => MagnetUnit_End(unit, step);
  130. //_fdc = new Fdc(Module);
  131. }
  132. private RState PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  133. {
  134. var ProcessUnit = unit as PressureByPressureModeUnit;
  135. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  136. _PressureToleranceChecker.IsStable = true;
  137. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  138. {
  139. toleranceObjects.Add(new ToleranceObject("Pressure", ProcessUnit.StartValue, ProcessUnit.StartValueWarningRange, ProcessUnit.StartValueAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  140. _PressureToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  141. }
  142. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  143. {
  144. if (Chamber.SetPVPressure(ProcessUnit.StartValue))
  145. {
  146. return RState.Running;
  147. }
  148. }
  149. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  150. {
  151. if (Chamber.SetPVPostion(ProcessUnit.StartValue))
  152. {
  153. return RState.Running;
  154. }
  155. }
  156. return RState.Failed;
  157. }
  158. private RState PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  159. {
  160. var ProcessUnit = unit as PressureByPressureModeUnit;
  161. if (ProcessUnit.EnableRamp)
  162. {
  163. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  164. {
  165. if (Chamber.SetPVPressure(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  166. return RState.Running;
  167. else
  168. return RState.Failed;
  169. }
  170. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  171. {
  172. if (Chamber.SetPVPostion(ProcessUnit.StartValue + (int)((ProcessUnit.TargetValue - ProcessUnit.StartValue) * step.RampFactor())))
  173. return RState.Running;
  174. else
  175. return RState.Failed;
  176. }
  177. }
  178. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure && ProcessUnit.ToleranceMode != ToleranceMode.None)
  179. {
  180. return _PressureToleranceChecker.Monitor(Chamber.PendulumPressure);
  181. }
  182. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve && ProcessUnit.ToleranceMode != ToleranceMode.None)
  183. {
  184. return _PressureToleranceChecker.Monitor(Chamber.PendulumPosition);
  185. }
  186. return RState.Running;
  187. }
  188. private void PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  189. {
  190. var ProcessUnit = unit as PressureByPressureModeUnit;
  191. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  192. {
  193. _PressureToleranceChecker.End();
  194. }
  195. }
  196. private RState TCPUnit_Start(ProcessUnitBase unit, RecipeStep step)
  197. {
  198. _isEnableMatchC1C2Offset = SC.GetValue<bool>($"{Module}.Match.EnableC1C2StepOffset");
  199. _matchC1C2OffsetValue = SC.GetValue<int>($"{Module}.Match.C1C2StepOffsetValue");
  200. var ProcessUnit = unit as TCPUnit;
  201. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  202. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  203. {
  204. toleranceObjects.Add(new ToleranceObject("RF", ProcessUnit.RFPower, ProcessUnit.RFPowerWarningRange, ProcessUnit.RFPowerAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  205. _RFToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  206. }
  207. float p1;
  208. float p2;
  209. if (ProcessUnit.C1 > 0)
  210. {
  211. p1 = ProcessUnit.C1;
  212. }
  213. else
  214. {
  215. p1 = ProcessUnit.AutoC1;
  216. }
  217. if (ProcessUnit.C2 > 0)
  218. {
  219. p2 = ProcessUnit.C2;
  220. }
  221. else
  222. {
  223. p2 = ProcessUnit.AutoC2;
  224. }
  225. if (_isEnableMatchC1C2Offset == false || Math.Abs(Chamber.RFMatchC1 - p1) > _matchC1C2OffsetValue || Math.Abs(Chamber.RFMatchC2 - p2) > _matchC1C2OffsetValue)
  226. {
  227. if (!Chamber.SetMatchPosition(p1, p2))
  228. {
  229. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed duo to Source RF Match Write C1 C2 failed ");
  230. return RState.Failed;
  231. }
  232. }
  233. if (ProcessUnit.RFPower > 5)
  234. {
  235. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  236. Chamber.GeneratorPowerOn(true);
  237. }
  238. else
  239. {
  240. Chamber.GeneratorSetpower(0);
  241. Chamber.GeneratorPowerOn(false);
  242. }
  243. if (ProcessUnit.MatchWorkMode == MatchWorkMode.Auto)
  244. {
  245. Chamber.SetMatchWorkMode(MatchWorkMode.Auto);
  246. }
  247. else if (ProcessUnit.MatchWorkMode == MatchWorkMode.Manual)
  248. {
  249. Chamber.SetMatchWorkMode(MatchWorkMode.Manual);
  250. }
  251. _scRFPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.Rf.ReflectPowerAlarmTime");
  252. rfMatchC1.Clear();
  253. rfMatchC1.Clear();
  254. rfMatchC1C2Index = 0;
  255. return RState.Running;
  256. }
  257. private RState TCPUnit_Check(ProcessUnitBase unit, RecipeStep step)
  258. {
  259. var ProcessUnit = unit as TCPUnit;
  260. if (ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scRFPowerAlarmTime * 1000)
  261. {
  262. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  263. return RState.Failed;
  264. }
  265. if (step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  266. {
  267. Chamber.GeneratorSetpower(0);
  268. Chamber.GeneratorPowerOn(false);
  269. return RState.Failed;
  270. }
  271. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  272. {
  273. rfMatchC1.Add(Chamber.RFMatchC1);
  274. rfMatchC2.Add(Chamber.RFMatchC2);
  275. rfMatchC1C2Index += 1;
  276. }
  277. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  278. {
  279. return _RFToleranceChecker.Monitor(Chamber.ForwardPower);
  280. }
  281. return RState.Running;
  282. }
  283. private void TCPUnit_End(ProcessUnitBase unit, RecipeStep step)
  284. {
  285. var ProcessUnit = unit as TCPUnit;
  286. if (rfMatchC1.Count >= 6)
  287. {
  288. float allValue = 0;
  289. for (int i = 4; i < rfMatchC1.Count; i++)
  290. {
  291. allValue += rfMatchC1[i];
  292. }
  293. var average = allValue / (rfMatchC1.Count - 4);
  294. ProcessUnit.AutoC1 = (int)average;
  295. }
  296. if (rfMatchC2.Count >= 6)
  297. {
  298. float allValue = 0;
  299. for (int i = 4; i < rfMatchC2.Count; i++)
  300. {
  301. allValue += rfMatchC2[i];
  302. }
  303. var average = allValue / (rfMatchC2.Count - 4);
  304. ProcessUnit.AutoC2 = (int)average;
  305. }
  306. rfMatchC1.Clear();
  307. rfMatchC2.Clear();
  308. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  309. {
  310. _RFToleranceChecker.End();
  311. }
  312. }
  313. private RState BiasUnit_Start(ProcessUnitBase unit, RecipeStep step)
  314. {
  315. _isEnableBiasMatchC1C2Offset = SC.GetValue<bool>($"{Module}.BiasMatch.EnableC1C2StepOffset");
  316. _biasMatchC1C2OffsetValue = SC.GetValue<int>($"{Module}.BiasMatch.C1C2StepOffsetValue");
  317. var ProcessUnit = unit as BiasUnit;
  318. _BiasReflectPowerOverCount = 0;
  319. _BiasReflectPowerOverFlag = false;
  320. float p1;
  321. float p2;
  322. if (ProcessUnit.BiasC1 > 0)
  323. {
  324. p1 = ProcessUnit.BiasC1;
  325. }
  326. else
  327. {
  328. p1 = ProcessUnit.AutoBiasC1;
  329. }
  330. if (ProcessUnit.BiasC2 > 0)
  331. {
  332. p2 = ProcessUnit.BiasC2;
  333. }
  334. else
  335. {
  336. p2 = ProcessUnit.AutoBiasC2;
  337. }
  338. if (_isEnableBiasMatchC1C2Offset == false || Math.Abs(Chamber.BiasRFMatchC1 - p1) > _biasMatchC1C2OffsetValue || Math.Abs(Chamber.BiasRFMatchC2 - p2) > _biasMatchC1C2OffsetValue)
  339. {
  340. Chamber.SetBiasMatchPosition(p1, p2);
  341. }
  342. if (ProcessUnit.BiasRFPower > 5)
  343. {
  344. Chamber.GeneratorBiasPowerOn(true);
  345. if ((ProcessUnit.EnableRamp == false))
  346. {
  347. Chamber.GeneratorBiasSetpower(ProcessUnit.BiasRFPower);
  348. }
  349. }
  350. else
  351. {
  352. Chamber.GeneratorBiasPowerOn(false);
  353. Chamber.GeneratorBiasSetpower(0);
  354. }
  355. if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Auto)
  356. {
  357. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Auto);
  358. }
  359. else if (ProcessUnit.BiasMatchWorkMode == MatchWorkMode.Manual)
  360. {
  361. Chamber.SetBiasMatchWorkMode(MatchWorkMode.Manual);
  362. }
  363. if (ProcessUnit.BiasGeneratorMode == GeneratorMode.Pulsing)
  364. {
  365. Chamber.SetBiasPulseMode(true);
  366. Chamber.SetBiasPulseRateFreq(ProcessUnit.PulseRateFreq);
  367. Chamber.SetDiasPulseDutyCycle(ProcessUnit.PulseDutyCycle);
  368. }
  369. else
  370. {
  371. Chamber.SetBiasPulseMode(false);
  372. }
  373. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  374. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  375. {
  376. toleranceObjects.Add(new ToleranceObject("BiasRF", ProcessUnit.BiasRFPower, ProcessUnit.RFPowerWarningRange, ProcessUnit.RFPowerAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  377. _BiasRFToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  378. }
  379. _scBiasRFPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.ReflectPowerAlarmTime");
  380. biasRfMatchC1.Clear();
  381. biasRfMatchC1.Clear();
  382. biasRfMatchC1C2Index = 0;
  383. biasRFSetPointFlag = true;
  384. return RState.Running;
  385. }
  386. private RState BiasUnit_Check(ProcessUnitBase unit, RecipeStep step)
  387. {
  388. //var _scPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.BiasRf.PowerAlarmTime");
  389. var ProcessUnit = unit as BiasUnit;
  390. if (ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower > ProcessUnit.BiasMaxReflectedPower && step.ElapsedTime() > _scBiasRFPowerAlarmTime * 1000)
  391. {
  392. if (!_BiasReflectPowerOverFlag)
  393. {
  394. _BiasReflectPowerOverFlag = true;
  395. LOG.Write(eEvent.WARN_PROCESS, Chamber.Module, $"Step:{step.StepNo} warning! Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower} in {_scBiasRFPowerAlarmTime}s");
  396. }
  397. ++_BiasReflectPowerOverCount;
  398. if (_BiasReflectPowerOverCount > 20)
  399. {
  400. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Bias Reflect Power:{Chamber.BiasReflectPower} exceeds the Max Limit:{ProcessUnit.BiasMaxReflectedPower} in {_scBiasRFPowerAlarmTime}s");
  401. return RState.Failed;
  402. }
  403. }
  404. if (_BiasReflectPowerOverFlag && ProcessUnit.BiasMaxReflectedPower > 0 && Chamber.BiasReflectPower < ProcessUnit.BiasMaxReflectedPower)
  405. {
  406. //标志位置为false 重新开始计算
  407. _BiasReflectPowerOverFlag = false;
  408. _BiasReflectPowerOverCount = 0;
  409. }
  410. if (m_RecipeHead.BiasRFHoldTime != null && step.ElapsedTime() > m_RecipeHead.BiasRFHoldTime * 1000)
  411. {
  412. Chamber.GeneratorBiasSetpower(0);
  413. Chamber.GeneratorBiasPowerOn(false);
  414. return RState.Failed;
  415. }
  416. if (step.ElapsedTime() > biasRfMatchC1C2Index * 1000)
  417. {
  418. biasRfMatchC1.Add(Chamber.BiasRFMatchC1);
  419. biasRfMatchC2.Add(Chamber.BiasRFMatchC2);
  420. biasRfMatchC1C2Index += 1;
  421. }
  422. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  423. {
  424. return _BiasRFToleranceChecker.Monitor(Chamber.BiasForwardPower);
  425. }
  426. if (ProcessUnit.EnableRamp)
  427. {
  428. //if (step.ElapsedTime() <= 500*cycleIndex)
  429. //{
  430. // return RState.Running;
  431. //}
  432. //cycleIndex += 1;
  433. if (ProcessUnit.TargetMode == TargetMode.Cycle)
  434. {
  435. if (biasRFSetPointFlag == true)
  436. {
  437. biasRFSetPointFlag = false;
  438. Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower + (float)((float)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((float)(loopsteps - 1) / (float)(currentStepIndex))))));
  439. }
  440. //float rampFactor = (float)currentStepIndex / (float)(loopsteps-1);
  441. //double rampFactor = step.RampFactor();
  442. //Chamber.GeneratorBiasSetpower((float)((ProcessUnit.BiasRFPower+ (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower)/(loopsteps)*currentStepIndex) + ((double)(ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) / ((double)loopsteps)) * rampFactor));
  443. }
  444. else
  445. {
  446. //double rampFactor = step.RampFactor();
  447. //Chamber.GeneratorBiasSetpower((float)(ProcessUnit.BiasRFPower + (ProcessUnit.TargetBiasRFPower - ProcessUnit.BiasRFPower) * rampFactor));
  448. }
  449. }
  450. return RState.Running;
  451. }
  452. private void BiasUnit_End(ProcessUnitBase unit, RecipeStep step)
  453. {
  454. var ProcessUnit = unit as BiasUnit;
  455. //Chamber.GeneratorBiasSetpower(0);
  456. //Chamber.GeneratorBiasPowerOn(false);
  457. if (biasRfMatchC1.Count >= 6)
  458. {
  459. float allValue = 0;
  460. for (int i = 4; i < biasRfMatchC1.Count; i++)
  461. {
  462. allValue += biasRfMatchC1[i];
  463. }
  464. var average = allValue / (biasRfMatchC1.Count - 4);
  465. ProcessUnit.AutoBiasC1 = (int)average;
  466. }
  467. if (biasRfMatchC2.Count >= 6)
  468. {
  469. float allValue = 0;
  470. for (int i = 4; i < biasRfMatchC2.Count; i++)
  471. {
  472. allValue += biasRfMatchC2[i];
  473. }
  474. var average = allValue / (biasRfMatchC2.Count - 4);
  475. ProcessUnit.AutoBiasC2 = (int)average;
  476. }
  477. biasRfMatchC1.Clear();
  478. biasRfMatchC1.Clear();
  479. biasRfMatchC1C2Index = 0;
  480. //cycleIndex = 0;
  481. biasRFSetPointFlag = true;
  482. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  483. {
  484. _BiasRFToleranceChecker.End();
  485. }
  486. }
  487. private RState GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  488. {
  489. Chamber.OpenValve(ValveType.GasFinal, true);
  490. var ProcessUnit = unit as GasControlUnit;
  491. if (ProcessUnit.Gas1 >= 1)
  492. {
  493. Chamber.FlowGas(0, ProcessUnit.Gas1);
  494. }
  495. else
  496. {
  497. Chamber.FlowGas(0, 0);
  498. }
  499. if (ProcessUnit.Gas2 >= 1)
  500. {
  501. Chamber.FlowGas(1, ProcessUnit.Gas2);
  502. }
  503. else
  504. {
  505. Chamber.FlowGas(1, 0);
  506. }
  507. if (ProcessUnit.Gas3 >= 1)
  508. {
  509. Chamber.FlowGas(2, ProcessUnit.Gas3);
  510. }
  511. else
  512. {
  513. Chamber.FlowGas(2, 0);
  514. }
  515. if (ProcessUnit.Gas4 >= 1)
  516. {
  517. Chamber.FlowGas(3, ProcessUnit.Gas4);
  518. }
  519. else
  520. {
  521. Chamber.FlowGas(3, 0);
  522. }
  523. if (ProcessUnit.Gas5 >= 1)
  524. {
  525. Chamber.FlowGas(4, ProcessUnit.Gas5);
  526. }
  527. else
  528. {
  529. Chamber.FlowGas(4, 0);
  530. }
  531. if (ProcessUnit.Gas6 >= 1)
  532. {
  533. Chamber.FlowGas(5, ProcessUnit.Gas6);
  534. }
  535. else
  536. {
  537. Chamber.FlowGas(5, 0);
  538. }
  539. if (ProcessUnit.Gas7 >= 1)
  540. {
  541. Chamber.FlowGas(6, ProcessUnit.Gas7);
  542. }
  543. else
  544. {
  545. Chamber.FlowGas(6, 0);
  546. }
  547. if (ProcessUnit.Gas8 >= 1)
  548. {
  549. Chamber.FlowGas(7, ProcessUnit.Gas8);
  550. }
  551. else
  552. {
  553. Chamber.FlowGas(7, 0);
  554. }
  555. _GasFlowToleranceChecker.IsStable = true;
  556. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  557. {
  558. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  559. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  560. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  561. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  562. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas4, ProcessUnit.Gas4WarningRange, ProcessUnit.Gas4AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  563. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  564. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  565. toleranceObjects.Add(new ToleranceObject("Gas7", ProcessUnit.Gas7, ProcessUnit.Gas7WarningRange, ProcessUnit.Gas7AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  566. toleranceObjects.Add(new ToleranceObject("Gas8", ProcessUnit.Gas8, ProcessUnit.Gas8WarningRange, ProcessUnit.Gas8AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  567. _GasFlowToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  568. }
  569. return RState.Running;
  570. }
  571. private RState GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  572. {
  573. var ProcessUnit = unit as GasControlUnit;
  574. if (ProcessUnit.EnableRamp)
  575. {
  576. double rampFactor = step.RampFactor();
  577. Chamber.FlowGas(0, ProcessUnit.Gas1 + (ProcessUnit.Gas1Target - ProcessUnit.Gas1) * rampFactor);
  578. Chamber.FlowGas(1, ProcessUnit.Gas2 + (ProcessUnit.Gas2Target - ProcessUnit.Gas2) * rampFactor);
  579. Chamber.FlowGas(2, ProcessUnit.Gas3 + (ProcessUnit.Gas3Target - ProcessUnit.Gas3) * rampFactor);
  580. Chamber.FlowGas(3, ProcessUnit.Gas4 + (ProcessUnit.Gas4Target - ProcessUnit.Gas4) * rampFactor);
  581. Chamber.FlowGas(4, ProcessUnit.Gas5 + (ProcessUnit.Gas5Target - ProcessUnit.Gas5) * rampFactor);
  582. Chamber.FlowGas(5, ProcessUnit.Gas6 + (ProcessUnit.Gas6Target - ProcessUnit.Gas6) * rampFactor);
  583. Chamber.FlowGas(6, ProcessUnit.Gas7 + (ProcessUnit.Gas7Target - ProcessUnit.Gas7) * rampFactor);
  584. Chamber.FlowGas(7, ProcessUnit.Gas8 + (ProcessUnit.Gas8Target - ProcessUnit.Gas8) * rampFactor);
  585. }
  586. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  587. {
  588. return _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack, Chamber.MFC7FeedBack, Chamber.MFC8FeedBack);
  589. }
  590. return RState.Running;
  591. }
  592. private void GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  593. {
  594. var ProcessUnit = unit as GasControlUnit;
  595. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  596. {
  597. _GasFlowToleranceChecker.End();
  598. }
  599. }
  600. private RState VenusSEGasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  601. {
  602. Chamber.OpenValve(ValveType.GasFinal, true);
  603. var ProcessUnit = unit as VenusSEGasControlUnit;
  604. Chamber.FlowGas(0, ProcessUnit.Gas1);
  605. if (ProcessUnit.Gas1 >= 1)
  606. {
  607. Chamber.OpenValve(ValveType.PV11, true);
  608. }
  609. Chamber.FlowGas(1, ProcessUnit.Gas2);
  610. if (ProcessUnit.Gas2 >= 1)
  611. {
  612. Chamber.OpenValve(ValveType.PV21, true);
  613. }
  614. Chamber.FlowGas(2, ProcessUnit.Gas3);
  615. if (ProcessUnit.Gas3 >= 1)
  616. {
  617. Chamber.OpenValve(ValveType.PV31, true);
  618. }
  619. Chamber.FlowGas(3, ProcessUnit.Gas4);
  620. if (ProcessUnit.Gas4 >= 1)
  621. {
  622. Chamber.OpenValve(ValveType.PV41, true);
  623. }
  624. Chamber.FlowGas(4, ProcessUnit.Gas5);
  625. if (ProcessUnit.Gas5 >= 1)
  626. {
  627. Chamber.OpenValve(ValveType.PV51, true);
  628. }
  629. Chamber.FlowGas(5, ProcessUnit.Gas6);
  630. if (ProcessUnit.Gas6 >= 1)
  631. {
  632. Chamber.OpenValve(ValveType.PV61, true);
  633. }
  634. Chamber.FlowGas(6, ProcessUnit.Gas7);
  635. if (ProcessUnit.Gas7 >= 1)
  636. {
  637. Chamber.OpenValve(ValveType.PV71, true);
  638. }
  639. Chamber.FlowGas(7, ProcessUnit.Gas8);
  640. if (ProcessUnit.Gas8 >= 1)
  641. {
  642. Chamber.OpenValve(ValveType.PV81, true);
  643. }
  644. Chamber.FlowGas(8, ProcessUnit.Gas9);
  645. if (ProcessUnit.Gas9 >= 1)
  646. {
  647. Chamber.OpenValve(ValveType.PV91, true);
  648. }
  649. Chamber.FlowGas(9, ProcessUnit.Gas10);
  650. if (ProcessUnit.Gas10 >= 1)
  651. {
  652. Chamber.OpenValve(ValveType.PVA1, true);
  653. }
  654. Chamber.FlowGas(10, ProcessUnit.Gas11);
  655. if (ProcessUnit.Gas11 >= 1)
  656. {
  657. Chamber.OpenValve(ValveType.PVB1, true);
  658. }
  659. Chamber.FlowGas(11, ProcessUnit.Gas12);
  660. if (ProcessUnit.Gas12 >= 1)
  661. {
  662. Chamber.OpenValve(ValveType.PVC1, true);
  663. }
  664. _GasFlowToleranceChecker.IsStable = true;
  665. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  666. {
  667. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  668. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  669. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  670. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  671. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas4, ProcessUnit.Gas4WarningRange, ProcessUnit.Gas4AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  672. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  673. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  674. toleranceObjects.Add(new ToleranceObject("Gas7", ProcessUnit.Gas7, ProcessUnit.Gas7WarningRange, ProcessUnit.Gas7AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  675. toleranceObjects.Add(new ToleranceObject("Gas8", ProcessUnit.Gas8, ProcessUnit.Gas8WarningRange, ProcessUnit.Gas8AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  676. toleranceObjects.Add(new ToleranceObject("Gas9", ProcessUnit.Gas9, ProcessUnit.Gas9WarningRange, ProcessUnit.Gas9AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  677. toleranceObjects.Add(new ToleranceObject("Gas10", ProcessUnit.Gas10, ProcessUnit.Gas10WarningRange, ProcessUnit.Gas10AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  678. toleranceObjects.Add(new ToleranceObject("Gas11", ProcessUnit.Gas11, ProcessUnit.Gas11WarningRange, ProcessUnit.Gas11AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  679. toleranceObjects.Add(new ToleranceObject("Gas12", ProcessUnit.Gas12, ProcessUnit.Gas12WarningRange, ProcessUnit.Gas12AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  680. _GasFlowToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  681. }
  682. return RState.Running;
  683. }
  684. private RState VenusSEGasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  685. {
  686. var ProcessUnit = unit as VenusSEGasControlUnit;
  687. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  688. {
  689. return _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack, Chamber.MFC7FeedBack, Chamber.MFC8FeedBack, Chamber.MFC9FeedBack, Chamber.MFC10FeedBack, Chamber.MFC11FeedBack, Chamber.MFC12FeedBack);
  690. }
  691. return RState.Running;
  692. }
  693. private void VenusSEGasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  694. {
  695. Chamber.OpenValve(ValveType.PV11, false);
  696. Chamber.OpenValve(ValveType.PV21, false);
  697. Chamber.OpenValve(ValveType.PV31, false);
  698. Chamber.OpenValve(ValveType.PV41, false);
  699. Chamber.OpenValve(ValveType.PV51, false);
  700. Chamber.OpenValve(ValveType.PV61, false);
  701. Chamber.OpenValve(ValveType.PV71, false);
  702. Chamber.OpenValve(ValveType.PV81, false);
  703. Chamber.OpenValve(ValveType.PV91, false);
  704. Chamber.OpenValve(ValveType.PVA1, false);
  705. Chamber.OpenValve(ValveType.PVB1, false);
  706. Chamber.OpenValve(ValveType.PVC1, false);
  707. Chamber.FlowGas(0, 0);
  708. Chamber.FlowGas(1, 0);
  709. Chamber.FlowGas(2, 0);
  710. Chamber.FlowGas(3, 0);
  711. Chamber.FlowGas(4, 0);
  712. Chamber.FlowGas(5, 0);
  713. Chamber.FlowGas(6, 0);
  714. Chamber.FlowGas(7, 0);
  715. Chamber.FlowGas(8, 0);
  716. Chamber.FlowGas(9, 0);
  717. Chamber.FlowGas(10, 0);
  718. Chamber.FlowGas(11, 0);
  719. Chamber.FlowGas(12, 0);
  720. var ProcessUnit = unit as VenusSEGasControlUnit;
  721. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  722. {
  723. _GasFlowToleranceChecker.End();
  724. }
  725. }
  726. private RState VenusDEGasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  727. {
  728. Chamber.OpenValve(ValveType.GasFinal, true);
  729. var ProcessUnit = unit as VenusDEGasControlUnit;
  730. Chamber.FlowGas(0, ProcessUnit.Gas1);
  731. if (ProcessUnit.Gas1 >= 1)
  732. {
  733. Chamber.OpenValve(ValveType.PV11, true);
  734. }
  735. Chamber.FlowGas(1, ProcessUnit.Gas2);
  736. if (ProcessUnit.Gas2 >= 1)
  737. {
  738. Chamber.OpenValve(ValveType.PV21, true);
  739. }
  740. Chamber.FlowGas(2, ProcessUnit.Gas3);
  741. if (ProcessUnit.Gas3 >= 1)
  742. {
  743. Chamber.OpenValve(ValveType.PV31, true);
  744. }
  745. Chamber.FlowGas(3, ProcessUnit.Gas4);
  746. if (ProcessUnit.Gas4 >= 1)
  747. {
  748. Chamber.OpenValve(ValveType.PV41, true);
  749. }
  750. Chamber.FlowGas(4, ProcessUnit.Gas5);
  751. if (ProcessUnit.Gas5 >= 1)
  752. {
  753. Chamber.OpenValve(ValveType.PV51, true);
  754. }
  755. Chamber.FlowGas(5, ProcessUnit.Gas6);
  756. if (ProcessUnit.Gas6 >= 1)
  757. {
  758. Chamber.OpenValve(ValveType.PV61, true);
  759. }
  760. Chamber.FlowGas(6, ProcessUnit.Gas7);
  761. if (ProcessUnit.Gas7 >= 1)
  762. {
  763. Chamber.OpenValve(ValveType.PV71, true);
  764. }
  765. Chamber.FlowGas(7, ProcessUnit.Gas8);
  766. if (ProcessUnit.Gas8 >= 1)
  767. {
  768. Chamber.OpenValve(ValveType.PV81, true);
  769. }
  770. Chamber.FlowGas(8, ProcessUnit.Gas9);
  771. if (ProcessUnit.Gas9 >= 1)
  772. {
  773. Chamber.OpenValve(ValveType.PV91, true);
  774. }
  775. Chamber.FlowGas(9, ProcessUnit.Gas10);
  776. if (ProcessUnit.Gas10 >= 1)
  777. {
  778. Chamber.OpenValve(ValveType.PVA1, true);
  779. }
  780. Chamber.FlowGas(10, ProcessUnit.Gas11);
  781. if (ProcessUnit.Gas11 >= 1)
  782. {
  783. Chamber.OpenValve(ValveType.PVB1, true);
  784. }
  785. Chamber.FlowGas(11, ProcessUnit.Gas12);
  786. if (ProcessUnit.Gas12 >= 1)
  787. {
  788. Chamber.OpenValve(ValveType.PVC1, true);
  789. }
  790. _GasFlowToleranceChecker.IsStable = true;
  791. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  792. {
  793. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  794. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  795. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  796. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  797. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas4, ProcessUnit.Gas4WarningRange, ProcessUnit.Gas4AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  798. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  799. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  800. toleranceObjects.Add(new ToleranceObject("Gas7", ProcessUnit.Gas7, ProcessUnit.Gas7WarningRange, ProcessUnit.Gas7AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  801. toleranceObjects.Add(new ToleranceObject("Gas8", ProcessUnit.Gas8, ProcessUnit.Gas8WarningRange, ProcessUnit.Gas8AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  802. toleranceObjects.Add(new ToleranceObject("Gas9", ProcessUnit.Gas9, ProcessUnit.Gas9WarningRange, ProcessUnit.Gas9AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  803. toleranceObjects.Add(new ToleranceObject("Gas10", ProcessUnit.Gas10, ProcessUnit.Gas10WarningRange, ProcessUnit.Gas10AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  804. toleranceObjects.Add(new ToleranceObject("Gas11", ProcessUnit.Gas11, ProcessUnit.Gas11WarningRange, ProcessUnit.Gas11AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  805. toleranceObjects.Add(new ToleranceObject("Gas12", ProcessUnit.Gas12, ProcessUnit.Gas12WarningRange, ProcessUnit.Gas12AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  806. _GasFlowToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  807. }
  808. return RState.Running;
  809. }
  810. private RState VenusDEGasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  811. {
  812. var ProcessUnit = unit as VenusDEGasControlUnit;
  813. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  814. {
  815. return _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack, Chamber.MFC7FeedBack, Chamber.MFC8FeedBack, Chamber.MFC9FeedBack, Chamber.MFC10FeedBack, Chamber.MFC11FeedBack, Chamber.MFC12FeedBack);
  816. }
  817. return RState.Running;
  818. }
  819. private void VenusDEGasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  820. {
  821. Chamber.OpenValve(ValveType.PV11, false);
  822. Chamber.OpenValve(ValveType.PV21, false);
  823. Chamber.OpenValve(ValveType.PV31, false);
  824. Chamber.OpenValve(ValveType.PV41, false);
  825. Chamber.OpenValve(ValveType.PV51, false);
  826. Chamber.OpenValve(ValveType.PV61, false);
  827. Chamber.OpenValve(ValveType.PV71, false);
  828. Chamber.OpenValve(ValveType.PV81, false);
  829. Chamber.OpenValve(ValveType.PV91, false);
  830. Chamber.OpenValve(ValveType.PVA1, false);
  831. Chamber.OpenValve(ValveType.PVB1, false);
  832. Chamber.OpenValve(ValveType.PVC1, false);
  833. Chamber.FlowGas(0, 0);
  834. Chamber.FlowGas(1, 0);
  835. Chamber.FlowGas(2, 0);
  836. Chamber.FlowGas(3, 0);
  837. Chamber.FlowGas(4, 0);
  838. Chamber.FlowGas(5, 0);
  839. Chamber.FlowGas(6, 0);
  840. Chamber.FlowGas(7, 0);
  841. Chamber.FlowGas(8, 0);
  842. Chamber.FlowGas(9, 0);
  843. Chamber.FlowGas(10, 0);
  844. Chamber.FlowGas(11, 0);
  845. Chamber.FlowGas(12, 0);
  846. var ProcessUnit = unit as VenusDEGasControlUnit;
  847. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  848. {
  849. _GasFlowToleranceChecker.End();
  850. }
  851. }
  852. private RState ESCHVUnit_Start(ProcessUnitBase unit, RecipeStep step)
  853. {
  854. var ProcessUnit = unit as ESCHVUnit;
  855. if (ProcessUnit.ESCClampValtage > 0)
  856. {
  857. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  858. }
  859. else
  860. {
  861. Chamber.SetESCClampVoltage(0);
  862. Chamber.OnOffSetESCHV(false);
  863. }
  864. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelium);
  865. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  866. //List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  867. //if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  868. //{
  869. // toleranceObjects.Add(new ToleranceObject("ESCTemperature", ProcessUnit.ESCTemperature, ProcessUnit.ESCTemperatureWarningRange, ProcessUnit.ESCTemperatureAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  870. // toleranceObjects.Add(new ToleranceObject("WallTemperature", ProcessUnit.WallTemperature, ProcessUnit.WallTemperatureWarningRange, ProcessUnit.WallTemperatureAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode));
  871. // _HeliumToleranceChecker.Start(toleranceObjects);
  872. //}
  873. return RState.Running;
  874. }
  875. private RState ESCHVUnit_Check(ProcessUnitBase unit, RecipeStep step)
  876. {
  877. var ProcessUnit = unit as ESCHVUnit;
  878. if (Chamber.BackSideHeOutOfRange && step.ElapsedTime() > ProcessUnit.CheckDelay)
  879. {
  880. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium out of range.");
  881. return RState.Failed;
  882. }
  883. //if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  884. //{
  885. // return _HeliumToleranceChecker.Monitor(Chamber.ESCTemperature,Chamber.WallTemperature);
  886. //}
  887. return RState.Running;
  888. }
  889. private void ESCHVUnit_End(ProcessUnitBase unit, RecipeStep step)
  890. {
  891. Chamber.SetBacksideHeThreshold(0, 0);
  892. //var ProcessUnit = unit as ESCHVUnit;
  893. //if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  894. //{
  895. // _HeliumToleranceChecker.End();
  896. //}
  897. }
  898. private RState ESCHV8InchUnit_Start(ProcessUnitBase unit, RecipeStep step)
  899. {
  900. var ProcessUnit = unit as ESCHV8InchUnit;
  901. if (ProcessUnit.ESCClampValtage > 0)
  902. {
  903. Chamber.SetESCClampVoltage(ProcessUnit.ESCClampValtage);
  904. }
  905. else
  906. {
  907. Chamber.SetESCClampVoltage(0);
  908. Chamber.OnOffSetESCHV(false);
  909. }
  910. Chamber.SetBacksideHePressure(ProcessUnit.BacksideHelium);
  911. Chamber.SetBacksideOutHePressure(ProcessUnit.BacksideOutHelium);
  912. Chamber.SetBacksideHeThreshold(ProcessUnit.MinHeFlow, ProcessUnit.MaxHeFlow);
  913. Chamber.SetBacksideOutHeThreshold(ProcessUnit.MinOutHeFlow, ProcessUnit.MaxOutHeFlow);
  914. return RState.Running;
  915. }
  916. private RState ESCHV8InchUnit_Check(ProcessUnitBase unit, RecipeStep step)
  917. {
  918. var ProcessUnit = unit as ESCHV8InchUnit;
  919. if (Chamber.BackSideHeOutOfRange && step.ElapsedTime() > ProcessUnit.CheckDelay)
  920. {
  921. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium1 out of range.");
  922. return RState.Failed;
  923. }
  924. if (Chamber.BackSideOutHeOutOfRange && step.ElapsedTime() > ProcessUnit.OutCheckDelay)
  925. {
  926. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, Backside Helium2 out of range.");
  927. return RState.Failed;
  928. }
  929. return RState.Running;
  930. }
  931. private void ESCHV8InchUnit_End(ProcessUnitBase unit, RecipeStep step)
  932. {
  933. Chamber.SetBacksideHeThreshold(0, 0);
  934. Chamber.SetBacksideOutHeThreshold(0, 0);
  935. }
  936. private RState ProcessKitUnit_Start(ProcessUnitBase unit, RecipeStep step)
  937. {
  938. var ProcessUnit = unit as ProcessKitUnit;
  939. if (Chamber.SetLiftPin(ProcessUnit.LiftPinPostion, out string reason))
  940. {
  941. return RState.Running;
  942. }
  943. else
  944. {
  945. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Position:{ProcessUnit.LiftPinPostion}");
  946. return RState.Failed;
  947. }
  948. }
  949. private RState ProcessKitUnit_Check(ProcessUnitBase unit, RecipeStep step)
  950. {
  951. //var ProcessUnit = unit as ProcessKitUnit;
  952. return RState.Running;
  953. }
  954. private void ProcessKitUnit_End(ProcessUnitBase unit, RecipeStep step)
  955. {
  956. }
  957. private RState HeliumPumpUnit_Start(ProcessUnitBase unit, RecipeStep step)
  958. {
  959. var ProcessUnit = unit as HeliumPumpUnit;
  960. if (!ProcessUnit.HeliumPumpState)
  961. return RState.Running;
  962. if (Chamber.ChamberWaferSize == 8)
  963. {
  964. if (Chamber.SetHeliumPump(ProcessUnit.HeliumPumpState) && Chamber.SetOutHeliumPump(ProcessUnit.HeliumPumpState))
  965. {
  966. return RState.Running;
  967. }
  968. else
  969. {
  970. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Helium Pump:{ProcessUnit.HeliumPumpState}");
  971. return RState.Failed;
  972. }
  973. }
  974. else
  975. {
  976. if (Chamber.SetHeliumPump(ProcessUnit.HeliumPumpState))
  977. {
  978. return RState.Running;
  979. }
  980. else
  981. {
  982. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Helium Pump:{ProcessUnit.HeliumPumpState}");
  983. return RState.Failed;
  984. }
  985. }
  986. }
  987. private RState HeliumPumpUnit_Check(ProcessUnitBase unit, RecipeStep step)
  988. {
  989. return RState.Running;
  990. }
  991. private void HeliumPumpUnit_End(ProcessUnitBase unit, RecipeStep step)
  992. {
  993. var ProcessUnit = unit as HeliumPumpUnit;
  994. if (!ProcessUnit.HeliumPumpState)
  995. return;
  996. if (Chamber.ChamberWaferSize == 8)
  997. {
  998. if (!Chamber.SetHeliumPump(false) || !Chamber.SetOutHeliumPump(false))
  999. {
  1000. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Helium Pump:{ProcessUnit.HeliumPumpState}");
  1001. }
  1002. }
  1003. else
  1004. {
  1005. if (!Chamber.SetHeliumPump(false))
  1006. {
  1007. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed. Target Helium Pump:{ProcessUnit.HeliumPumpState}");
  1008. }
  1009. }
  1010. }
  1011. private RState MagnetUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1012. {
  1013. var ProcessUnit = unit as MagnetUnit;
  1014. if (Chamber.MagnetSetpower(ProcessUnit.MagnetIntensity) && Chamber.SetFieldRatio(ProcessUnit.FieldRatio) && Chamber.SetWaveform(ProcessUnit.MagnetWaveform))
  1015. {
  1016. return RState.Running;
  1017. }
  1018. else
  1019. {
  1020. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed duo to Magnet Write Intensity failed");
  1021. return RState.Failed;
  1022. }
  1023. }
  1024. private RState MagnetUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1025. {
  1026. var ProcessMagnetUnit = unit as MagnetUnit;
  1027. if (ProcessMagnetUnit.ToleranceMode != ToleranceMode.None)
  1028. {
  1029. return _MagnetToleranceChecker.Monitor(Chamber.MagnetIntensity);
  1030. }
  1031. return RState.Running;
  1032. }
  1033. private void MagnetUnit_End(ProcessUnitBase unit, RecipeStep step)
  1034. {
  1035. var ProcessMagnetUnit = unit as MagnetUnit;
  1036. if (ProcessMagnetUnit.ToleranceMode != ToleranceMode.None)
  1037. {
  1038. _MagnetToleranceChecker.End();
  1039. }
  1040. }
  1041. #region Kepler2200 Units
  1042. private RState Kepler2200PressureByPressureModeUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1043. {
  1044. var ProcessUnit = unit as Kepler2200PressureByPressureModeUnit;
  1045. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  1046. _PressureToleranceChecker.IsStable = true;
  1047. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1048. {
  1049. toleranceObjects.Add(new ToleranceObject("Pressure", ProcessUnit.StartValue, ProcessUnit.StartValueWarningRange, ProcessUnit.StartValueAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1050. _PressureToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  1051. }
  1052. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure)
  1053. {
  1054. if (Chamber.SetPVPressure(ProcessUnit.StartValue))
  1055. {
  1056. return RState.Running;
  1057. }
  1058. }
  1059. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve)
  1060. {
  1061. if (Chamber.SetPVPostion(ProcessUnit.StartValue))
  1062. {
  1063. return RState.Running;
  1064. }
  1065. }
  1066. return RState.Failed;
  1067. }
  1068. private RState Kepler2200PressureByPressureModeUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1069. {
  1070. var ProcessUnit = unit as Kepler2200PressureByPressureModeUnit;
  1071. if (ProcessUnit.PressureUnitMode == PressureUnitMode.Pressure && ProcessUnit.ToleranceMode != ToleranceMode.None)
  1072. {
  1073. return _PressureToleranceChecker.Monitor(Chamber.PendulumPressure);
  1074. }
  1075. else if (ProcessUnit.PressureUnitMode == PressureUnitMode.Valve && ProcessUnit.ToleranceMode != ToleranceMode.None)
  1076. {
  1077. return _PressureToleranceChecker.Monitor(Chamber.PendulumPosition);
  1078. }
  1079. return RState.Running;
  1080. }
  1081. private void Kepler2200PressureByPressureModeUnit_End(ProcessUnitBase unit, RecipeStep step)
  1082. {
  1083. var ProcessUnit = unit as Kepler2200PressureByPressureModeUnit;
  1084. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1085. {
  1086. _PressureToleranceChecker.End();
  1087. }
  1088. }
  1089. private RState RFUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1090. {
  1091. _isEnableMatchC1C2Offset = SC.GetValue<bool>($"{Module}.Match.EnableC1C2StepOffset");
  1092. _matchC1C2OffsetValue = SC.GetValue<int>($"{Module}.Match.C1C2StepOffsetValue");
  1093. var ProcessUnit = unit as RFUnit;
  1094. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  1095. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1096. {
  1097. toleranceObjects.Add(new ToleranceObject("RFPower", ProcessUnit.RFPower, ProcessUnit.RFPowerWarningRange, ProcessUnit.RFPowerAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1098. toleranceObjects.Add(new ToleranceObject("RFReflectedPower", 0, ProcessUnit.RFReflectedPowerWarningRange, ProcessUnit.RFReflectedPowerAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1099. _RFToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  1100. }
  1101. float p1;
  1102. float p2;
  1103. if (ProcessUnit.C1 > 0)
  1104. {
  1105. p1 = ProcessUnit.C1;
  1106. }
  1107. else
  1108. {
  1109. p1 = ProcessUnit.AutoC1;
  1110. }
  1111. if (ProcessUnit.C2 > 0)
  1112. {
  1113. p2 = ProcessUnit.C2;
  1114. }
  1115. else
  1116. {
  1117. p2 = ProcessUnit.AutoC2;
  1118. }
  1119. if (_isEnableMatchC1C2Offset == false || Math.Abs(Chamber.RFMatchC1 - p1) > _matchC1C2OffsetValue || Math.Abs(Chamber.RFMatchC2 - p2) > _matchC1C2OffsetValue)
  1120. {
  1121. if (!Chamber.SetMatchPosition(p1, p2))
  1122. {
  1123. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed duo to Source RF Match Write C1 C2 failed ");
  1124. return RState.Failed;
  1125. }
  1126. }
  1127. if (ProcessUnit.RFPower > 5)
  1128. {
  1129. Chamber.GeneratorSetpower(ProcessUnit.RFPower);
  1130. Chamber.GeneratorPowerOn(true);
  1131. }
  1132. else
  1133. {
  1134. //Chamber.GeneratorSetpower(0);
  1135. Chamber.GeneratorPowerOn(false);
  1136. }
  1137. if (ProcessUnit.MatchWorkMode == MatchWorkMode.Auto)
  1138. {
  1139. Chamber.SetMatchWorkMode(MatchWorkMode.Auto);
  1140. }
  1141. else if (ProcessUnit.MatchWorkMode == MatchWorkMode.Manual)
  1142. {
  1143. Chamber.SetMatchWorkMode(MatchWorkMode.Manual);
  1144. }
  1145. _scRFPowerAlarmTime = SC.GetValue<double>($"{Chamber.Name}.Rf.ReflectPowerAlarmTime");
  1146. rfMatchC1.Clear();
  1147. rfMatchC1.Clear();
  1148. rfMatchC1C2Index = 0;
  1149. //_RfReflectPowerOverCounter = 0;
  1150. return RState.Running;
  1151. }
  1152. private RState RFUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1153. {
  1154. var ProcessUnit = unit as RFUnit;
  1155. //if (ProcessUnit.MaxReflectedPower > 0 && Chamber.ReflectPower > ProcessUnit.MaxReflectedPower && step.ElapsedTime() > _scRFPowerAlarmTime * 1000)
  1156. //{
  1157. // _RfReflectPowerOverCounter += 1;
  1158. // if (_RfReflectPowerOverCounter > 10)
  1159. // {
  1160. // LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF Reflect Power:{Chamber.ReflectPower} exceeds the Max Limit:{ProcessUnit.MaxReflectedPower}");
  1161. // return RState.Failed;
  1162. // }
  1163. //}
  1164. //else
  1165. //{
  1166. // _RfReflectPowerOverCounter = 0;
  1167. //}
  1168. if (Chamber.ForwardPower>5 && step.ElapsedTime() > m_RecipeHead.RFHoldTime * 1000)
  1169. {
  1170. Chamber.GeneratorSetpower(0);
  1171. Chamber.GeneratorPowerOn(false);
  1172. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed, RF On Over {m_RecipeHead.RFHoldTime} s");
  1173. return RState.Failed;
  1174. }
  1175. if (step.ElapsedTime() > rfMatchC1C2Index * 1000)
  1176. {
  1177. rfMatchC1.Add(Chamber.RFMatchC1);
  1178. rfMatchC2.Add(Chamber.RFMatchC2);
  1179. rfMatchC1C2Index += 1;
  1180. }
  1181. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1182. {
  1183. return _RFToleranceChecker.Monitor(Chamber.ForwardPower,Chamber.ReflectPower);
  1184. }
  1185. return RState.Running;
  1186. }
  1187. private void RFUnit_End(ProcessUnitBase unit, RecipeStep step)
  1188. {
  1189. var ProcessUnit = unit as RFUnit;
  1190. if (rfMatchC1.Count >= 6)
  1191. {
  1192. float allValue = 0;
  1193. for (int i = 4; i < rfMatchC1.Count; i++)
  1194. {
  1195. allValue += rfMatchC1[i];
  1196. }
  1197. var average = allValue / (rfMatchC1.Count - 4);
  1198. ProcessUnit.AutoC1 = (int)average;
  1199. }
  1200. if (rfMatchC2.Count >= 6)
  1201. {
  1202. float allValue = 0;
  1203. for (int i = 4; i < rfMatchC2.Count; i++)
  1204. {
  1205. allValue += rfMatchC2[i];
  1206. }
  1207. var average = allValue / (rfMatchC2.Count - 4);
  1208. ProcessUnit.AutoC2 = (int)average;
  1209. }
  1210. rfMatchC1.Clear();
  1211. rfMatchC2.Clear();
  1212. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1213. {
  1214. _RFToleranceChecker.End();
  1215. }
  1216. }
  1217. private RState Kepler2200GasControlUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1218. {
  1219. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  1220. Chamber.OpenValve(ValveType.GasFinal, true);
  1221. var ProcessUnit = unit as Kepler2200GasControlUnit;
  1222. if (ProcessUnit.Gas1 >= 1)
  1223. {
  1224. Chamber.FlowGas(0, ProcessUnit.Gas1);
  1225. }
  1226. else
  1227. {
  1228. Chamber.FlowGas(0, 0);
  1229. }
  1230. if (ProcessUnit.Gas2 >= 1)
  1231. {
  1232. Chamber.FlowGas(1, ProcessUnit.Gas2);
  1233. }
  1234. else
  1235. {
  1236. Chamber.FlowGas(1, 0);
  1237. }
  1238. if (ProcessUnit.Gas3 >= 1)
  1239. {
  1240. Chamber.FlowGas(2, ProcessUnit.Gas3);
  1241. }
  1242. else
  1243. {
  1244. Chamber.FlowGas(2, 0);
  1245. }
  1246. if (ProcessUnit.Gas4 >= 1)
  1247. {
  1248. Chamber.FlowGas(3, ProcessUnit.Gas4);
  1249. }
  1250. else
  1251. {
  1252. Chamber.FlowGas(3, 0);
  1253. }
  1254. if (ProcessUnit.Gas5 >= 1)
  1255. {
  1256. Chamber.FlowGas(4, ProcessUnit.Gas5);
  1257. }
  1258. else
  1259. {
  1260. Chamber.FlowGas(4, 0);
  1261. }
  1262. if (ProcessUnit.Gas6 >= 1)
  1263. {
  1264. Chamber.FlowGas(5, ProcessUnit.Gas6);
  1265. }
  1266. else
  1267. {
  1268. Chamber.FlowGas(5, 0);
  1269. }
  1270. if (ProcessUnit.Gas7 >= 1)
  1271. {
  1272. Chamber.FlowGas(6, ProcessUnit.Gas7);
  1273. }
  1274. else
  1275. {
  1276. Chamber.FlowGas(6, 0);
  1277. }
  1278. if (ProcessUnit.Gas8 >= 1)
  1279. {
  1280. Chamber.FlowGas(7, ProcessUnit.Gas8);
  1281. }
  1282. else
  1283. {
  1284. Chamber.FlowGas(7, 0);
  1285. }
  1286. _GasFlowToleranceChecker.IsStable = true;
  1287. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1288. {
  1289. toleranceObjects.Add(new ToleranceObject("Gas1", ProcessUnit.Gas1, ProcessUnit.Gas1WarningRange, ProcessUnit.Gas1AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1290. toleranceObjects.Add(new ToleranceObject("Gas2", ProcessUnit.Gas2, ProcessUnit.Gas2WarningRange, ProcessUnit.Gas2AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1291. toleranceObjects.Add(new ToleranceObject("Gas3", ProcessUnit.Gas3, ProcessUnit.Gas3WarningRange, ProcessUnit.Gas3AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1292. toleranceObjects.Add(new ToleranceObject("Gas4", ProcessUnit.Gas4, ProcessUnit.Gas4WarningRange, ProcessUnit.Gas4AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1293. toleranceObjects.Add(new ToleranceObject("Gas5", ProcessUnit.Gas5, ProcessUnit.Gas5WarningRange, ProcessUnit.Gas5AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1294. toleranceObjects.Add(new ToleranceObject("Gas6", ProcessUnit.Gas6, ProcessUnit.Gas6WarningRange, ProcessUnit.Gas6AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1295. toleranceObjects.Add(new ToleranceObject("Gas7", ProcessUnit.Gas7, ProcessUnit.Gas7WarningRange, ProcessUnit.Gas7AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1296. toleranceObjects.Add(new ToleranceObject("Gas8", ProcessUnit.Gas8, ProcessUnit.Gas8WarningRange, ProcessUnit.Gas8AlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1297. _GasFlowToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  1298. }
  1299. return RState.Running;
  1300. }
  1301. private RState Kepler2200GasControlUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1302. {
  1303. var ProcessUnit = unit as Kepler2200GasControlUnit;
  1304. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1305. {
  1306. return _GasFlowToleranceChecker.Monitor(Chamber.MFC1FeedBack, Chamber.MFC2FeedBack, Chamber.MFC3FeedBack, Chamber.MFC4FeedBack, Chamber.MFC5FeedBack, Chamber.MFC6FeedBack, Chamber.MFC7FeedBack, Chamber.MFC8FeedBack);
  1307. }
  1308. return RState.Running;
  1309. }
  1310. private void Kepler2200GasControlUnit_End(ProcessUnitBase unit, RecipeStep step)
  1311. {
  1312. var ProcessUnit = unit as Kepler2200GasControlUnit;
  1313. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1314. {
  1315. _GasFlowToleranceChecker.End();
  1316. }
  1317. }
  1318. private RState RFBoxUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1319. {
  1320. var ProcessUnit = unit as RFBoxUnit;
  1321. if (Chamber.SetRFBoxC1Position(ProcessUnit.C1))
  1322. {
  1323. return RState.Running;
  1324. }
  1325. else
  1326. {
  1327. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed duo to RFBox Write C1 failed ");
  1328. return RState.Failed;
  1329. }
  1330. }
  1331. private RState RFBoxUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1332. {
  1333. return RState.Running;
  1334. }
  1335. private void RFBoxUnit_End(ProcessUnitBase unit, RecipeStep step)
  1336. {
  1337. }
  1338. private RState HeaterUnit_Start(ProcessUnitBase unit, RecipeStep step)
  1339. {
  1340. var ProcessUnit = unit as HeaterUnit;
  1341. bool isAutoRatio = SC.GetValue<bool>($"{Chamber.Module}.HighTemperatureHeater.IsEnableAutoRatio");
  1342. var position = (HighTemperatureHeaterPosition)Enum.Parse(typeof(HighTemperatureHeaterPosition), ProcessUnit.SuspectPosition.ToString());
  1343. if (!Chamber.HighTemperatureHeaterGotoPosition(position))
  1344. {
  1345. return RState.Failed;
  1346. }
  1347. if (ProcessUnit.HeaterTemp > 0)
  1348. {
  1349. Chamber.SetHighTemperatureHeaterTemperature(ProcessUnit.HeaterTemp);
  1350. }
  1351. if (ProcessUnit.HeaterRatio > 0 && isAutoRatio==false)
  1352. {
  1353. Chamber.SetHighTemperatureHeaterRatio(ProcessUnit.HeaterRatio);
  1354. }
  1355. _HighTemperatureToleranceChecker.IsStable = true;
  1356. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1357. {
  1358. List<ToleranceObject> toleranceObjects = new List<ToleranceObject>();
  1359. toleranceObjects.Add(new ToleranceObject("HighTemperatureHeater Temperature", ProcessUnit.HeaterTemp, ProcessUnit.HeaterTempWarningRange, ProcessUnit.HeaterTempAlarmRange, ProcessUnit.ToleranceDelayTime, ProcessUnit.ToleranceMode, 10));
  1360. _HighTemperatureToleranceChecker.Start(toleranceObjects, step.Type == StepType.Stable);
  1361. }
  1362. return RState.Running;
  1363. }
  1364. private RState HeaterUnit_Check(ProcessUnitBase unit, RecipeStep step)
  1365. {
  1366. var ProcessUnit = unit as HeaterUnit;
  1367. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1368. {
  1369. return _HighTemperatureToleranceChecker.Monitor(Chamber.ChamberTemperature);
  1370. }
  1371. if (step.ElapsedTime() >= step.Time * 1000 - 500 && step.Type == StepType.Time)
  1372. {
  1373. if (ProcessUnit.SuspectPosition.ToString() != Chamber.HighTemperatureHeaterPosition.ToString())
  1374. {
  1375. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} failed duo to High Temperature Heater 在setp结束前未到达 {ProcessUnit.SuspectPosition.ToString()}");
  1376. return RState.Failed;
  1377. }
  1378. }
  1379. return RState.Running;
  1380. }
  1381. private void HeaterUnit_End(ProcessUnitBase unit, RecipeStep step)
  1382. {
  1383. var ProcessUnit = unit as HeaterUnit;
  1384. if (ProcessUnit.ToleranceMode != ToleranceMode.None)
  1385. {
  1386. _HighTemperatureToleranceChecker.End();
  1387. }
  1388. }
  1389. #endregion
  1390. public bool LoadMethods(ProcessUnitBase unit)
  1391. {
  1392. var className = $"{Module}.{unit.GetType().Name}";
  1393. if (startHelper.ContainsKey(className) && checkerHelper.ContainsKey(className) && endHelper.ContainsKey(className))
  1394. {
  1395. unit.starter = startHelper[className];
  1396. unit.checker = checkerHelper[className];
  1397. unit.end = endHelper[className];
  1398. return true;
  1399. }
  1400. return false;
  1401. }
  1402. //public void fdcStop()
  1403. //{
  1404. // if (m_RecipeHead.Type == RecipeType.Process)
  1405. // {
  1406. // _fdc.Stop();
  1407. // }
  1408. //}
  1409. //public void loopStep(bool isloop,int loopCount,int loopIndex)
  1410. //{
  1411. // isLoop = isloop;
  1412. // loopsteps=loopCount;
  1413. // currentStepIndex = loopIndex;
  1414. //}
  1415. private RState stepStarter(RecipeStep step)
  1416. {
  1417. step.StartStepTimer();
  1418. if (_isInstalledEPD)
  1419. {
  1420. Chamber.EPDStepStart(step.EPDConfig, step.StepNo);
  1421. if (step.Type == StepType.EndPoint)
  1422. {
  1423. _lastEPDStepTimeStopwatch.Restart();
  1424. }
  1425. }
  1426. return RState.Running;
  1427. }
  1428. private RState stepChecker(RecipeStep step)
  1429. {
  1430. switch (step.Type)
  1431. {
  1432. case StepType.Time:
  1433. //_fdc.OnMonitor();
  1434. return step.ElapsedTime() >= step.Time * 1000 ? RState.End : RState.Running;
  1435. case StepType.OverEtch:
  1436. lastEPDStepTime = step.OverEtchPercent != null ? _lastEPDStepTimeStopwatch.ElapsedMilliseconds * step.OverEtchPercent / 100 : 0;
  1437. return step.ElapsedTime() >= lastEPDStepTime ? RState.End : RState.Running;
  1438. case StepType.EndPoint:
  1439. if (step.MaxEndPointTime != null && step.ElapsedTime() > step.MaxEndPointTime * 1000)
  1440. {
  1441. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not capture endpoint signal in {step.MaxEndPointTime} seconds");
  1442. return RState.Failed;
  1443. }
  1444. else
  1445. {
  1446. if (Chamber.EPDCaptured)
  1447. {
  1448. if (step.MinEndPointTime != null && step.ElapsedTime() < step.MinEndPointTime * 1000)
  1449. {
  1450. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, capture endpoint signal less than {step.MinEndPointTime} seconds");
  1451. return RState.Failed;
  1452. }
  1453. else
  1454. {
  1455. return RState.End;
  1456. }
  1457. }
  1458. else
  1459. {
  1460. return RState.Running;
  1461. }
  1462. //return Chamber.EPDCaptured ? RState.End : RState.Running;
  1463. }
  1464. case StepType.Stable:
  1465. if (step.ElapsedTime() >= step.Time * 1000)
  1466. {
  1467. LOG.Write(eEvent.ERR_PROCESS, Chamber.Module, $"Step:{step.StepNo} timeout, did not Stable in {step.Time} seconds");
  1468. return RState.Failed;
  1469. }
  1470. else
  1471. {
  1472. if (_GasFlowToleranceChecker.IsStable && _PressureToleranceChecker.IsStable && _HighTemperatureToleranceChecker.IsStable && step.ElapsedTime() >= 2000)
  1473. {
  1474. //_StableStopWach
  1475. return RState.End;
  1476. }
  1477. else
  1478. {
  1479. //_StableStopWach.
  1480. }
  1481. }
  1482. return RState.Running;
  1483. }
  1484. return RState.Running;
  1485. }
  1486. private RState stepEnder(RecipeStep step)
  1487. {
  1488. //if (step.Type == StepType.EndPoint)
  1489. //{
  1490. // Chamber.EPDStepStop();
  1491. //}
  1492. EAP_StepTime = Convert.ToInt32(step.ElapsedTime() / 1000);
  1493. if (_isInstalledEPD)
  1494. {
  1495. Chamber.EPDStepStop();
  1496. if (step.Type == StepType.EndPoint)
  1497. {
  1498. _lastEPDStepTimeStopwatch.Stop();
  1499. }
  1500. }
  1501. //if (m_RecipeHead.Type == RecipeType.Process)
  1502. //{
  1503. // ProcessDataRecorder.StepEnd(_RecipeId, step.StepNo, _fdc.DataList);
  1504. //}
  1505. return RState.End;
  1506. }
  1507. public bool LoadStepFuns(RecipeStep step)
  1508. {
  1509. step.starter = stepStarter;
  1510. step.checker = stepChecker;
  1511. step.ender = stepEnder;
  1512. //for (int i = 0; i < step.LstUnit.Count; i++)
  1513. //{
  1514. // var items = (step.LstUnit[i] as ProcessUnitBase).GetFDCItems();
  1515. // if (items != null && items.Count > 0)
  1516. // {
  1517. // _fdc.AppendKeyValues(items);
  1518. // }
  1519. //}
  1520. return true;
  1521. }
  1522. }
  1523. }