PMEntity.cs 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.RT.Fsm;
  8. using Aitex.Core.RT.OperationCenter;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using Aitex.Sorter.Common;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.Schedulers;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using Venus_Core;
  16. using Venus_RT.Devices;
  17. using Aitex.Core.RT.Log;
  18. using Aitex.Core.UI.DeviceControl;
  19. using MECF.Framework.Common.DataCenter;
  20. using Aitex.Core.RT.DataCollection;
  21. namespace Venus_RT.Modules.PMs
  22. {
  23. public class RecipeRunningInfo
  24. {
  25. public Guid InnerId { get; set; }
  26. public RecipeHead Head { get; set; }
  27. public List<RecipeStep> RecipeStepList { get; set; }
  28. public string RecipeName { get; set; }
  29. public DateTime BeginTime { get; set; }
  30. public DateTime EndTime { get; set; }
  31. public int StepNumber { get; set; }
  32. public string StepName { get; set; }
  33. public double StepTime { get; set; }
  34. public double StepElapseTime { get; set; }
  35. public double TotalTime { get; set; }
  36. public double TotalElapseTime { get; set; }
  37. }
  38. public class PMEntity : Entity, IModuleEntity
  39. {
  40. public enum PMStatus
  41. {
  42. Not_Ready,
  43. Ready_For_Pick,
  44. Ready_For_Place,
  45. Exchange_Ready,
  46. }
  47. public enum MSG
  48. {
  49. Home,
  50. Transfer,
  51. PrepareTransfer,
  52. PostTransfer,
  53. Reset,
  54. Abort,
  55. Error,
  56. LaunchPump,
  57. LaunchTurboPump,
  58. Pump,
  59. Vent,
  60. PumpLoadLock,
  61. VentLoadLock,
  62. PurgeLoadLock,
  63. LoadLockLeakCheck,
  64. CyclePurge,
  65. GasLinePurge,
  66. Heat,
  67. TransferHandoff,
  68. StartTransfer,
  69. LeakCheck,
  70. GasLeakCheck,
  71. MoveLiftPin,
  72. MoveGuidePin,
  73. PartialPressure,
  74. VATPerformance,
  75. LLPlace,
  76. LLPick,
  77. Process,
  78. RunRecipe,
  79. PostProcess,
  80. RecipeSkipStep,
  81. RecipeUpdate,
  82. RecipeResume,
  83. RecipePause,
  84. RecipeAbort,
  85. PreProcess,
  86. AutoMode,
  87. ManualMode,
  88. LockLid,
  89. Clean,
  90. Online,
  91. Offline,
  92. GasFlow,
  93. StopGasFlow,
  94. RfPower,
  95. MFCVerification,
  96. // exchange wafer with TM
  97. PreparePick,
  98. PreparePlace,
  99. LiftUpWafer,
  100. DropDownWafer,
  101. PickReady,
  102. PlaceReady,
  103. MaxMsg
  104. }
  105. private readonly JetPMBase _chamber;
  106. public ModuleName Module { get; }
  107. public PMStatus Status { get; private set; }
  108. private StatsDataItem _statProcessedWafer;
  109. private StatsDataItemRFAndPump _statRfOnTime;
  110. private StatsDataItemRFAndPump _statBiasRfOnTime;
  111. //private StatsDataItemRFAndPump _statPumpOnTime;
  112. private readonly PMHomeRoutine _home;
  113. private readonly StartDryPumpRoutine _startDryPumpRoutine;
  114. private readonly StartTurboPumpRoutine _startTurboPumpRoutine;
  115. private readonly VentRoutine _ventRoutine;
  116. private readonly VenusVentRoutine _venusVentRoutine;
  117. private readonly PumpDownRoutine _pumpRoutine;
  118. //private readonly LoadLockVentRoutine _ventLoadLockRoutine;
  119. //private readonly LoadLockPumpRoutine _pumpLoadLockRoutine;
  120. //private readonly LoadLockPurgeRoutine _purgeLoadLockRoutine;
  121. //private readonly LoadLockLeakCheckRoutine _loadLockLeakCheckRoutine;
  122. private readonly PMPurgeRoutine _purgeRoutine;
  123. private readonly PMGaslinePurgeRoutine _gaslinePurgeRoutine;
  124. private readonly PMLeakCheckRoutine _leakCheckRoutine;
  125. private readonly GasBoxLeakCheckRoutine _gasBoxLeakCheckRoutine;
  126. //private readonly LLPlaceRoutine _llPlaceRoutine;
  127. //private readonly LLPickRoutine _llPickRoutine;
  128. private readonly PMProcessRoutine _processRoutine;
  129. private readonly GasFlowRoutine _gasFlowRoutine;
  130. private readonly RFPowerSwitchRoutine _rfPowerRoutine;
  131. private readonly PMGasVerificationRoutine _gasVerificationRoutine;
  132. private readonly PMPartialPressureRoutine _pmPartialPressureRoutine;
  133. private readonly PMVATPerformanceRoutine _pmVATPerformanceRoutine;
  134. //private readonly PMHeatRoutine _pmHeatRoutine;
  135. private DateTime _lastProcessDone;
  136. private AutoFlag _AutoMode;
  137. private bool _isOnline = false;
  138. //private bool _isAlarm;
  139. //private DateTime _pumpStartTime;
  140. //private TimeSpan _pumpElapsedTime;
  141. //private DateTime _rfStartTime;
  142. //private DateTime _tcStartTime;
  143. //private TimeSpan _rfElapsedTime;
  144. //private TimeSpan _tcElapsedTime;
  145. //private MovementPosition _goalLiftPin;
  146. //private ushort _ActivatedActionID;
  147. //private Stopwatch _LifpinSleepTimer;
  148. private bool startControlPressureFlag = true;
  149. //private bool stopControlPressureFlag = false;
  150. private int _controlPressureSetPoint = 90;
  151. private int _controlFlowSetPoint = 90;
  152. public DateTime LastProcessDone => _lastProcessDone;
  153. public JetChamber ChamberType => _chamber.ChamberType;
  154. public bool IsIdle
  155. {
  156. get { return fsm.State == (int)PMState.Idle; }
  157. }
  158. public bool IsError
  159. {
  160. get { return fsm.State == (int)PMState.Error; }
  161. }
  162. public bool IsInit
  163. {
  164. get { return fsm.State == (int)PMState.Init; }
  165. }
  166. public bool IsBusy
  167. {
  168. get { return !IsInit && !IsError && !IsIdle; }
  169. }
  170. public bool IsProcessing
  171. {
  172. get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
  173. }
  174. public bool IsOnline
  175. {
  176. get { return _isOnline; }
  177. }
  178. public bool IsInclude
  179. {
  180. get;
  181. private set;
  182. } = true;
  183. private Dictionary<string, int> _dictRecipeTime = new Dictionary<string, int>();
  184. public override int TimeToReady
  185. {
  186. get
  187. {
  188. switch ((PMState)fsm.State)
  189. {
  190. case PMState.Processing:
  191. case PMState.Clean:
  192. if (Singleton<RouteManager>.Instance.IsAutoMode && IsOnline)
  193. {
  194. if (_dictRecipeTime.ContainsKey(_processRoutine.currentRecipeResult.RecipeName))
  195. {
  196. return Math.Max(_dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] - fsm.ElapsedTime, 0);
  197. }
  198. }
  199. break;
  200. }
  201. return int.MaxValue / 2;
  202. }
  203. }
  204. public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
  205. public bool IsSlitDoorOpen => _chamber.CheckSlitDoorOpen();
  206. public bool IsSlitDoorClose => _chamber.CheckSlitDoorClose();
  207. public bool LiftPinIsDown => _chamber.LiftPinIsDown;
  208. public bool LiftPinIsUp => _chamber.LiftPinIsUp;
  209. public double ChamberPressure => _chamber.ChamberPressure;
  210. public double ProcessPressure => _chamber.ProcessPressure;
  211. public bool IsVac => _chamber.IsVAC;
  212. public bool IsAtm => _chamber.IsATM;
  213. public float ChamberTemperature => _chamber.ChamberTemperature;
  214. public bool Check(int msg, out string reason, object[] objs)
  215. {
  216. reason = "";
  217. return true;
  218. }
  219. //
  220. private bool CheckToPostMessage(int msg, params object[] args)
  221. {
  222. if (!fsm.FindTransition(fsm.State, msg))
  223. {
  224. EV.PostWarningLog(Module.ToString(), eEvent.WARN_State, $"{Module} is in {(PMState)fsm.State} state,can not do {(MSG)msg}");
  225. return false;
  226. }
  227. fsm.PostMsg(msg, args);
  228. return true;
  229. }
  230. public int Invoke(string function, params object[] args)
  231. {
  232. switch (function)
  233. {
  234. case "Home":
  235. CheckToPostMessage((int)MSG.Home);
  236. return (int)MSG.Home;
  237. }
  238. return (int)FSM_MSG.NONE;
  239. }
  240. public bool CheckAcked(int msg)
  241. {
  242. return fsm.CheckExecuted(msg);
  243. }
  244. public void ResetRecipeTime()
  245. {
  246. _dictRecipeTime.Clear();
  247. }
  248. public bool IsPrepareTransferReady(ModuleName robot, EnumTransferType type, int slot, Hand blade)
  249. {
  250. //if (type == EnumTransferType.Pick)
  251. //{
  252. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(_chamber.Module, 0).Size);
  253. //}
  254. //else if (type == EnumTransferType.Place)
  255. //{
  256. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(robot, (int)blade).Size);
  257. //}
  258. return false;
  259. }
  260. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
  261. {
  262. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString()))
  263. return (int)MSG.PrepareTransfer;
  264. return (int)FSM_MSG.NONE;
  265. }
  266. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp)
  267. {
  268. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp))
  269. return (int)MSG.PrepareTransfer;
  270. return (int)FSM_MSG.NONE;
  271. }
  272. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp, WaferSize size)
  273. {
  274. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp, size))
  275. return (int)MSG.PrepareTransfer;
  276. return (int)FSM_MSG.NONE;
  277. }
  278. public int InvokePostTransfer(ModuleName robot, EnumTransferType type, int slot)
  279. {
  280. if (CheckToPostMessage((int)MSG.PostTransfer, type.ToString()))
  281. return (int)MSG.PostTransfer;
  282. return (int)FSM_MSG.NONE;
  283. }
  284. public int InvokeClean(string recipeName, string waferID, RecipeType recipeType)
  285. {
  286. if (CheckToPostMessage((int)MSG.Clean, recipeName, waferID, recipeType))
  287. {
  288. return (int)MSG.Clean;
  289. }
  290. return (int)FSM_MSG.NONE;
  291. }
  292. public int InvokeProcess(string recipeName, string waferID, RecipeType recipeType)
  293. {
  294. if (CheckToPostMessage((int)MSG.RunRecipe, recipeName, waferID, recipeType))
  295. return (int)MSG.RunRecipe;
  296. return (int)FSM_MSG.NONE;
  297. }
  298. public int InvokePreHeat(float temperature)
  299. {
  300. if (CheckToPostMessage((int)MSG.Heat, (double)temperature))
  301. return (int)MSG.Heat;
  302. return (int)FSM_MSG.NONE;
  303. }
  304. public void InvokeReset()
  305. {
  306. PostMsg((int)MSG.Reset);
  307. }
  308. public void SetAuto()
  309. {
  310. this._AutoMode = AutoFlag.Auto;
  311. }
  312. private bool FnSetManual(object[] param)
  313. {
  314. if (fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
  315. {
  316. EV.PostWarningLog(Module.ToString(), $"{Module} is in {(PMState)fsm.State},can not do SetAutoMode");
  317. return false;
  318. }
  319. this._AutoMode = AutoFlag.Manual;
  320. if (IsOnline)
  321. {
  322. EV.PostWarningLog(Module.ToString(), $"{Module} is online,change to offline due to the chamber change to manual mode");
  323. this._isOnline = false;
  324. }
  325. return true;
  326. }
  327. private bool FnSetInclude()
  328. {
  329. if (IsOnline == true)
  330. {
  331. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Include");
  332. return false;
  333. }
  334. IsInclude = true;
  335. LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Include Success");
  336. return true;
  337. }
  338. private bool FnSetExclude()
  339. {
  340. if (IsOnline == true)
  341. {
  342. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Exclude");
  343. return false;
  344. }
  345. IsInclude = false;
  346. LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Exclude Success");
  347. return true;
  348. }
  349. private bool FnSetOnline(object[] param)
  350. {
  351. //if (!IsAutoMode)
  352. //{
  353. // EV.PostWarningLog(Module.ToString(), $"{Module} in manual mode,can not set online.");
  354. // return false;
  355. //}
  356. if (!IsInclude)
  357. {
  358. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is excluded,can not be put online");
  359. return false;
  360. }
  361. if (!_chamber.HomeIsOK(out string reason))
  362. {
  363. LOG.Write(eEvent.WARN_PM, Module, $"{Module} {reason},can not be put online");
  364. return false;
  365. }
  366. if (!_chamber.CheckSlitDoorClose())
  367. {
  368. EV.PostWarningLog(Module.ToString(), $"{Module} slit door is open,can not set online.");
  369. return false;
  370. }
  371. this._isOnline = true;
  372. return true;
  373. }
  374. private bool FnSetOffline(object[] param)
  375. {
  376. this._isOnline = false;
  377. return true;
  378. }
  379. private List<eEvent> stopEntityId = new List<eEvent>()
  380. {
  381. eEvent.ERR_MATCH,
  382. eEvent.ERR_RF,
  383. eEvent.ERR_PENDULUM_VALVE,
  384. eEvent.ERR_DEVICE_INFO,
  385. eEvent.ERR_DRY_PUMP,
  386. eEvent.ERR_HighTemperatureHeater,
  387. eEvent.ERR_HighTemperatureHeater_SetRatio_OverRange,
  388. eEvent.ERR_HighTemperatureHeater_SetTemperature_OverRange,
  389. eEvent.ERR_HighTemperatureHeater_GoPosition1TimeOut,
  390. eEvent.ERR_HighTemperatureHeater_GoPosition2TimeOut,
  391. eEvent.ERR_HighTemperatureHeater_GoPosition3TimeOut,
  392. eEvent.ERR_HighTemperatureHeater_GoPosition4TimeOut,
  393. eEvent.ERR_HighTemperatureHeater_GoPosition5TimeOut,
  394. eEvent.ERR_HighTemperatureHeater_GoOriginTimeOut,
  395. eEvent.ERR_HighTemperatureHeater_TransferPosition,
  396. eEvent.ERR_PM_PLC_HEARTBEAT_FAIL
  397. };
  398. public PMEntity(ModuleName module)
  399. {
  400. Module = module;
  401. _chamber = DEVICE.GetDevice<JetPMBase>(Module.ToString());
  402. _home = new PMHomeRoutine(_chamber);
  403. _startDryPumpRoutine = new StartDryPumpRoutine(_chamber);
  404. _startTurboPumpRoutine = new StartTurboPumpRoutine(_chamber);
  405. _ventRoutine = new VentRoutine(_chamber);
  406. _venusVentRoutine = new VenusVentRoutine(_chamber);
  407. _pumpRoutine = new PumpDownRoutine(_chamber);
  408. //_ventLoadLockRoutine = new LoadLockVentRoutine(_chamber);
  409. //_pumpLoadLockRoutine = new LoadLockPumpRoutine(_chamber);
  410. //_purgeLoadLockRoutine = new LoadLockPurgeRoutine(_chamber);
  411. //_loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
  412. _purgeRoutine = new PMPurgeRoutine(_chamber);
  413. _gaslinePurgeRoutine = new PMGaslinePurgeRoutine(_chamber, _pumpRoutine);
  414. _leakCheckRoutine = new PMLeakCheckRoutine(_chamber);
  415. _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
  416. //_llPlaceRoutine = new LLPlaceRoutine(_chamber);
  417. //_llPickRoutine = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
  418. _processRoutine = new PMProcessRoutine(_chamber, _pumpRoutine);
  419. _gasFlowRoutine = new GasFlowRoutine(_chamber);
  420. _rfPowerRoutine = new RFPowerSwitchRoutine(_chamber, true);
  421. _gasVerificationRoutine = new PMGasVerificationRoutine(_chamber, _pumpRoutine);
  422. _pmPartialPressureRoutine = new PMPartialPressureRoutine(_chamber);
  423. _pmVATPerformanceRoutine = new PMVATPerformanceRoutine(_chamber);
  424. //_pmControlPressureRoutine = new PMControlPressureRoutine(_chamber);
  425. //_pmHeatRoutine = new PMHeatRoutine(_chamber);
  426. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  427. //Idle
  428. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  429. EnterExitTransition<PMState, FSM_MSG>(PMState.Error, fEnterError, FSM_MSG.NONE, null);
  430. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPick, fnEnterPickReady, FSM_MSG.NONE, fnExitPickReady);
  431. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPlace, fnEnterPlaceReady, FSM_MSG.NONE, fnExitPlaceReady);
  432. EnterExitTransition<PMState, FSM_MSG>(PMState.DropDownReady, fnEnterDropDownReady, FSM_MSG.NONE, fnExitDropDownReady);
  433. EnterExitTransition<PMState, FSM_MSG>(PMState.LiftUpReady, fnEnterLiftUpReady, FSM_MSG.NONE, fnExitLiftUpReady);
  434. //Home
  435. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  436. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  437. AnyStateTransition(MSG.Online, FnSetOnline, FSM_STATE.SAME);
  438. AnyStateTransition(MSG.Offline, FnSetOffline, FSM_STATE.SAME);
  439. AnyStateTransition(FSM_MSG.ALARM, FnAlarm, PMState.Error);
  440. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  441. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  442. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  443. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  444. Transition(PMState.Homing, MSG.Home, FnStartHome, PMState.Homing);
  445. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  446. Transition(PMState.Homing, MSG.Abort, FnAbortHome, PMState.Idle);
  447. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  448. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  449. //Launch DryPump sequence
  450. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  451. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  452. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  453. //Launch TurboPump sequence
  454. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  455. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  456. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  457. //vent sequence
  458. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  459. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  460. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  461. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  462. //Pump sequence
  463. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  464. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  465. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  466. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  467. //Pump Loadlock sequence
  468. //Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  469. //Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  470. //Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  471. //Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  472. //Vent Loadlock sequence
  473. //Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  474. //Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  475. //Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  476. //Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  477. // Purge LoadLock sequence
  478. //Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  479. //Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  480. //Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  481. //LoadLock Leak check sequence
  482. //Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  483. //Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  484. //Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  485. // PM Purge sequence
  486. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  487. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  488. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  489. // PM GasLine Purge sequence
  490. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  491. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  492. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  493. //PM Leak check sequence
  494. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  495. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  496. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  497. //PM GasBox Leak check sequence
  498. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  499. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  500. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  501. // PlaceWafer from LoadLock Arm sequence
  502. //Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  503. //Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  504. //Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  505. // PickWafer to LoadLock Arm sequence
  506. //Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  507. //Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  508. //Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  509. // Process
  510. Transition(PMState.Idle, MSG.RunRecipe, FnRunRecipe, PMState.Processing);
  511. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  512. Transition(PMState.Processing, MSG.Abort, FnAbortProcess, PMState.Idle);
  513. // Clean
  514. Transition(PMState.Idle, MSG.Clean, FnRunRecipe, PMState.Clean);
  515. Transition(PMState.Clean, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  516. Transition(PMState.Clean, MSG.Abort, FnAbortProcess, PMState.Idle);
  517. // Gas Flow sequence
  518. Transition(PMState.Idle, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  519. Transition(PMState.GasFlowing, MSG.GasFlow, FnAbortGasFlow, PMState.Idle);
  520. Transition(PMState.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, PMState.Idle);
  521. Transition(PMState.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, PMState.Idle);
  522. Transition(PMState.GasFlowing, MSG.Abort, FnAbortGasFlow, PMState.Idle);
  523. //RF Power sequence
  524. Transition(PMState.Idle, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  525. Transition(PMState.GasFlowing, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  526. Transition(PMState.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, PMState.Idle);
  527. Transition(PMState.RfPowering, MSG.Abort, FnAbortRfPower, PMState.Idle);
  528. //MFC verification
  529. Transition(PMState.Idle, MSG.MFCVerification, FnStartMFCVerification, PMState.MFCVerification);
  530. Transition(PMState.MFCVerification, FSM_MSG.TIMER, FnMFCVerificationTimeout, PMState.Idle);
  531. Transition(PMState.MFCVerification, MSG.Abort, FnAbortMFCVerification, PMState.Idle);
  532. //////////////////////// Exchange Wafer with TM ///////////////////////////////////////////////////////
  533. // Pick Wafer from PM
  534. Transition(PMState.Idle, MSG.PreparePick, FnStartPreparePick, PMState.PreparePick);
  535. Transition(PMState.PreparePick, MSG.Abort, FnAbortPreparePick, PMState.Idle);
  536. Transition(PMState.PreparePick, FSM_MSG.TIMER, FnPreparePickTimeout, PMState.ReadyForPick);
  537. Transition(PMState.PreparePick, MSG.PreparePick, null, PMState.PreparePick);
  538. Transition(PMState.ReadyForPick, MSG.Abort, FnAbortPick, PMState.Idle);
  539. Transition(PMState.ReadyForPick, MSG.DropDownWafer, FnStartDropDownWafer, PMState.DropDownWafer);
  540. Transition(PMState.ReadyForPick, MSG.PreparePick, null, PMState.ReadyForPick);
  541. Transition(PMState.DropDownWafer, FSM_MSG.TIMER, FnDropDownTimeout, PMState.DropDownReady);
  542. Transition(PMState.DropDownReady, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  543. Transition(PMState.ReadyForPick, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  544. Transition(PMState.FinishPick, FSM_MSG.TIMER, FnFinishPickTimeout, PMState.Idle);
  545. // Place Wafer to PM
  546. Transition(PMState.Idle, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  547. //Transition(PMState.Heating, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  548. Transition(PMState.PreparePlace, MSG.Abort, FnAbortPreparePlace, PMState.Idle);
  549. Transition(PMState.PreparePlace, FSM_MSG.TIMER, FnPreparePlaceTimeout, PMState.ReadyForPlace);
  550. Transition(PMState.PreparePlace, MSG.PreparePlace, null, PMState.PreparePlace);
  551. Transition(PMState.ReadyForPlace, MSG.LiftUpWafer, FnStartLiftUpWafer, PMState.LiftUpWafer);
  552. Transition(PMState.LiftUpWafer, FSM_MSG.TIMER, FnLiftUpTimeout, PMState.LiftUpReady);
  553. Transition(PMState.LiftUpReady, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  554. Transition(PMState.ReadyForPlace, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  555. Transition(PMState.PreparePlace, MSG.Abort, FnAortPlace, PMState.Idle);
  556. Transition(PMState.ReadyForPlace, MSG.Abort, FnAortPlace, PMState.Idle);
  557. Transition(PMState.ReadyForPlace, MSG.PreparePlace, null, PMState.ReadyForPlace);
  558. Transition(PMState.LiftUpReady, MSG.Abort, FnAortPlace, PMState.Idle);
  559. Transition(PMState.FinishPlace, FSM_MSG.TIMER, FnFinishPlaceTimeout, PMState.Idle);
  560. // Swap Wafer With PM
  561. Transition(PMState.DropDownReady, MSG.PreparePlace, FnStartSwapPlace, PMState.PreparePlace);
  562. Transition(PMState.ReadyForPick, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  563. Transition(PMState.Idle, MSG.PartialPressure, FnStartPartialPressure, PMState.PartialPressureTesting);
  564. Transition(PMState.PartialPressureTesting, FSM_MSG.TIMER, FnPartialPressureTimeout, PMState.Idle);
  565. Transition(PMState.PartialPressureTesting, MSG.Abort, FnAbortPartialPressure, PMState.Idle);
  566. Transition(PMState.Idle, MSG.VATPerformance, FnStartVATPerformance, PMState.VATPerformanceTesting);
  567. Transition(PMState.VATPerformanceTesting, FSM_MSG.TIMER, FnVATPerformanceTimeout, PMState.Idle);
  568. Transition(PMState.VATPerformanceTesting, MSG.Abort, FnAbortVATPerformance, PMState.Idle);
  569. //Transition(PMState.Idle, MSG.Heat, FnStartHeat, PMState.Heating);
  570. AnyStateTransition(FSM_MSG.TIMER, FnControlPressure, FSM_STATE.SAME);
  571. Running = true;
  572. WaferManager.Instance.SubscribeLocation(Module, 1);
  573. }
  574. protected override bool Init()
  575. {
  576. DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State)), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  577. DATA.Subscribe($"{Module}.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  578. DATA.Subscribe($"{Module}.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  579. //DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  580. DATA.Subscribe($"{Module}.PartialPressureCounter", () => _pmPartialPressureRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  581. DATA.Subscribe($"{Module}.VATPerformanceCounter", () => _pmVATPerformanceRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  582. DATA.Subscribe($"{Module}.VATPerformanceResult", () => _pmVATPerformanceRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  583. DATA.Subscribe($"{Module}.PartialPressureResult", () => _pmPartialPressureRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  584. DATA.Subscribe($"{Module}.MFCCalibrationDatas", () => _gasVerificationRoutine?._MFCCalibrationDatas, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  585. DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  586. DATA.Subscribe($"{Module}.IsAlarm", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  587. DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  588. DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  589. DATA.Subscribe($"{Module}.IsOnline", () => _isOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  590. DATA.Subscribe($"{Module}.VentingFlag", () => ChamberType == JetChamber.VenusSE || ChamberType == JetChamber.VenusDE ? _venusVentRoutine.VentingFlag : _ventRoutine.VentingFlag, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  591. //DATA.Subscribe($"{Module}.GetLeakCheckDatas", () => LeakCheckDataRecorder.GetAllLeakCheckData(Module.ToString()));
  592. DATA.Subscribe($"{Module}.CurrentRecipeResult", () => _processRoutine.currentRecipeResult, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  593. DATA.Subscribe($"{Module}.LeakCheck.Step", () => _leakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  594. DATA.Subscribe($"{Module}.GasLeakCheck.Step", () => _gasBoxLeakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  595. DATA.Subscribe($"{Module}.IsInclude", () => IsInclude, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  596. OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
  597. OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
  598. OP.Subscribe($"{Module}.{RtOperation.GasLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.GasLeakCheck, args));
  599. OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  600. OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
  601. OP.Subscribe($"{Module}.{RtOperation.StartTurboPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchTurboPump));
  602. OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  603. OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
  604. OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower));
  605. OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  606. OP.Subscribe($"{Module}.{RtOperation.VentLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.VentLoadLock));
  607. OP.Subscribe($"{Module}.{RtOperation.PurgeLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PurgeLoadLock));
  608. OP.Subscribe($"{Module}.{RtOperation.PumpLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PumpLoadLock));
  609. OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
  610. OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  611. OP.Subscribe($"{Module}.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.LLPick));
  612. OP.Subscribe($"{Module}.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.LLPlace));
  613. OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args));
  614. OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, args));
  615. OP.Subscribe($"{Module}.{RtOperation.RunCleanRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.Clean, args));
  616. OP.Subscribe($"{Module}.PartialPressureTest", (cmd, args) => CheckToPostMessage((int)MSG.PartialPressure, args[0], args[1]));
  617. OP.Subscribe($"{Module}.VATPerformanceTest", (cmd, args) => CheckToPostMessage((int)MSG.VATPerformance, args[0], args[1], args[2]));
  618. OP.Subscribe($"{Module}.GasLinePurge", (cmd, args) => CheckToPostMessage((int)MSG.GasLinePurge, args[0]));
  619. OP.Subscribe($"{Module}.ManualEndStep", (cmd, args) => ManualEndStep());
  620. OP.Subscribe($"{Module}.{RtOperation.Online}", (cmd, args) => CheckToPostMessage((int)MSG.Online));
  621. OP.Subscribe($"{Module}.{RtOperation.Offline}", (cmd, args) => CheckToPostMessage((int)MSG.Offline));
  622. OP.Subscribe($"{Module}.{RtOperation.PmError}", (cmd, args) => CheckToPostMessage((int)MSG.Error));
  623. OP.Subscribe($"{Module}.{RtOperation.Include}", (cmd, args) => FnSetInclude());
  624. OP.Subscribe($"{Module}.{RtOperation.Exclude}", (cmd, args) => FnSetExclude());
  625. OP.Subscribe($"{Module}.SubscribeStatsData", (cmd, args) =>
  626. {
  627. StatsDataManager.Instance.Subscribe(args[0].ToString(), args[1].ToString());
  628. return true;
  629. });
  630. StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount", "Processed Wafer Count", 0);
  631. if (_chamber.IsRFAble())
  632. StatsDataManager.Instance.Subscribe($"{Module}.RfOnTime", "Rf On Time");
  633. if (_chamber.IsBiasRFAble())
  634. StatsDataManager.Instance.Subscribe($"{Module}.BiasRfOnTime", "Bias Rf On Time");
  635. StatsDataManager.Instance.Subscribe($"{Module}.PumpOnTime", "Pump On Time");
  636. _statProcessedWafer = StatsDataManager.Instance.GetItem($"{Module}.ProcessedWaferCount");
  637. _statRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.RfOnTime");
  638. if (_chamber.IsBiasRFAble())
  639. _statBiasRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRfOnTime");
  640. //_statPumpOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.PumpOnTime");
  641. DATA.Subscribe($"{Module}.WaferCounter", () => _statProcessedWafer.Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  642. if (_chamber.IsRFAble())
  643. DATA.Subscribe($"{Module}.RfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.RfOnTime"));
  644. if (_chamber.IsBiasRFAble())
  645. DATA.Subscribe($"{Module}.BiasRfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.BiasRfOnTime"));
  646. //DATA.Subscribe($"{Module}.PumpOnTime", () => _statPumpOnTime.fromLastPM);
  647. if (RtInstance.ConfigType==ConfigType.Kepler2200)
  648. {
  649. LOG.ModuleErrorInterrupt += (pmname, id) => PMErrorInterrupt(pmname, id);
  650. }
  651. return true;
  652. }
  653. private void PMErrorInterrupt(ModuleName pmname, eEvent eEventid)
  654. {
  655. if (pmname != Module)
  656. {
  657. return;
  658. }
  659. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_CONTINUEPROCESS || eEventid==eEvent.ERR_SENSOR_WATERFLOW_STOP_NEXTPROCESS)
  660. {
  661. this._isOnline = false;
  662. return;
  663. }
  664. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_STOPPROCESS || eEventid == eEvent.ERR_SENSOR_WATERFLOW_STOP_CURRENTPROCESS)
  665. {
  666. if (fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.Clean)
  667. {
  668. CheckToPostMessage((int)MSG.Abort);
  669. }
  670. this._isOnline = false;
  671. return;
  672. }
  673. if (stopEntityId.Contains(eEventid) && fsm.State != (int)PMState.Error)
  674. {
  675. CheckToPostMessage((int)MSG.Error);
  676. }
  677. }
  678. private bool ManualEndStep()
  679. {
  680. _processRoutine.isMaualEndStep = true;
  681. return true;
  682. }
  683. private bool FnIdle(object[] objs)
  684. {
  685. Running = false;
  686. return true;
  687. }
  688. private bool fEnterError(object[] objs)
  689. {
  690. DataCollectionManager.Instance.ManualInsertData();
  691. return true;
  692. }
  693. private bool fnEnterPickReady(object[] objs)
  694. {
  695. Status = PMStatus.Ready_For_Pick;
  696. return true;
  697. }
  698. private bool fnExitPickReady(object[] objs)
  699. {
  700. Status = PMStatus.Not_Ready;
  701. return true;
  702. }
  703. private bool fnEnterPlaceReady(object[] objs)
  704. {
  705. Status = PMStatus.Ready_For_Place;
  706. return true;
  707. }
  708. private bool fnExitPlaceReady(object[] objs)
  709. {
  710. Status = PMStatus.Not_Ready;
  711. return true;
  712. }
  713. private bool fnEnterDropDownReady(object[] objs)
  714. {
  715. Status = PMStatus.Exchange_Ready;
  716. return true;
  717. }
  718. private bool fnExitDropDownReady(object[] objs)
  719. {
  720. Status = PMStatus.Not_Ready;
  721. return true;
  722. }
  723. private bool fnEnterLiftUpReady(object[] objs)
  724. {
  725. Status = PMStatus.Exchange_Ready;
  726. return true;
  727. }
  728. private bool fnExitLiftUpReady(object[] objs)
  729. {
  730. Status = PMStatus.Not_Ready;
  731. return true;
  732. }
  733. private bool FnAlarm(object[] objs)
  734. {
  735. if ((PMState)fsm.State == PMState.Processing)
  736. {
  737. }
  738. return true;
  739. }
  740. private bool FnError(object[] objs)
  741. {
  742. Running = false;
  743. _isOnline = false;
  744. //if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  745. // || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  746. // return false;
  747. //_chamber.CloseValves();
  748. //_chamber.GeneratorPowerOn(false);
  749. //_chamber.GeneratorBiasPowerOn(false);
  750. //_chamber.OpenValve(ValveType.TurboPumpPumping, true);
  751. //_chamber.OpenValve(ValveType.TurboPumpPurge, true);
  752. //_chamber.OnOffSetESCHV(false);
  753. _chamber.PMInError();
  754. if (IsProcessing)
  755. {
  756. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  757. }
  758. return true;
  759. }
  760. private bool FnTimeout(object[] objs)
  761. {
  762. _debugRoutine();
  763. return true;
  764. }
  765. private bool FnIdleTimeout(object[] objs)
  766. {
  767. _chamber.CheckIdleInterlock(0);
  768. //_debugRoutine();
  769. return true;
  770. }
  771. private bool FnErrorTimeout(object[] objs)
  772. {
  773. _chamber.CheckIdleInterlock(0);
  774. //_debugRoutine();
  775. return true;
  776. }
  777. private bool FnStartHome(object[] objs)
  778. {
  779. return _home.Start() == RState.Running;
  780. }
  781. private bool FnMonitorHome(object[] objs)
  782. {
  783. RState ret = _home.Monitor();
  784. if (ret == RState.Failed || ret == RState.Timeout)
  785. {
  786. PostMsg(MSG.Error);
  787. return false;
  788. }
  789. return ret == RState.End;
  790. }
  791. private bool FnAbortHome(object[] objs)
  792. {
  793. _home.Abort();
  794. return true;
  795. }
  796. private bool FnLaunchPump(object[] param)
  797. {
  798. return _startDryPumpRoutine.Start() == RState.Running;
  799. }
  800. private bool FnLaunchPumpTimeout(object[] param)
  801. {
  802. RState ret = _startDryPumpRoutine.Monitor();
  803. if (ret == RState.Failed || ret == RState.Timeout)
  804. {
  805. PostMsg(MSG.Error);
  806. return false;
  807. }
  808. return ret == RState.End;
  809. }
  810. private bool FnAbortStartPumping(object[] param)
  811. {
  812. _startDryPumpRoutine.Abort();
  813. return true;
  814. }
  815. private bool FnLaunchTurboPump(object[] param)
  816. {
  817. return _startTurboPumpRoutine.Start() == RState.Running;
  818. }
  819. private bool FnLaunchTurboPumpTimeout(object[] param)
  820. {
  821. RState ret = _startTurboPumpRoutine.Monitor();
  822. if (ret == RState.Failed || ret == RState.Timeout)
  823. {
  824. PostMsg(MSG.Error);
  825. return false;
  826. }
  827. return ret == RState.End;
  828. }
  829. private bool FnAbortStartTurboPumping(object[] param)
  830. {
  831. _startTurboPumpRoutine.Abort();
  832. return true;
  833. }
  834. private bool FnStartVent(object[] param)
  835. {
  836. switch (ChamberType)
  837. {
  838. case JetChamber.VenusSE:
  839. case JetChamber.VenusDE:
  840. return _venusVentRoutine.Start() == RState.Running;
  841. default:
  842. return _ventRoutine.Start() == RState.Running;
  843. }
  844. }
  845. private bool FnVentTimeout(object[] param)
  846. {
  847. RState ret;
  848. switch (ChamberType)
  849. {
  850. case JetChamber.VenusSE:
  851. case JetChamber.VenusDE:
  852. ret = _venusVentRoutine.Monitor();
  853. break;
  854. default:
  855. ret = _ventRoutine.Monitor();
  856. break;
  857. }
  858. if (ret == RState.Failed || ret == RState.Timeout)
  859. {
  860. PostMsg(MSG.Error);
  861. return false;
  862. }
  863. return ret == RState.End;
  864. }
  865. private bool FnVentToPumping(object[] param)
  866. {
  867. switch (ChamberType)
  868. {
  869. case JetChamber.VenusSE:
  870. case JetChamber.VenusDE:
  871. _venusVentRoutine.Abort();
  872. break;
  873. default:
  874. _ventRoutine.Abort();
  875. break;
  876. }
  877. return true; // FnStartPumpDown(param);
  878. }
  879. private bool FnAbortVent(object[] param)
  880. {
  881. switch (ChamberType)
  882. {
  883. case JetChamber.VenusSE:
  884. case JetChamber.VenusDE:
  885. _venusVentRoutine.Abort();
  886. break;
  887. default:
  888. _ventRoutine.Abort();
  889. break;
  890. }
  891. return true;
  892. }
  893. private bool FnStartPumpDown(object[] param)
  894. {
  895. return _pumpRoutine.Start() == RState.Running;
  896. }
  897. private bool FnPumpDownTimeout(object[] param)
  898. {
  899. RState ret = _pumpRoutine.Monitor();
  900. if (ret == RState.Failed || ret == RState.Timeout)
  901. {
  902. PostMsg(MSG.Error);
  903. return false;
  904. }
  905. return ret == RState.End;
  906. }
  907. private bool FnAbortPumping(object[] param)
  908. {
  909. _pumpRoutine.Abort();
  910. return true;
  911. }
  912. //private bool FnStartVentLoadlock(object[] param)
  913. //{
  914. // return _ventLoadLockRoutine.Start() == RState.Running;
  915. //}
  916. //private bool FnVentLoadLockTimeout(object[] param)
  917. //{
  918. // RState ret = _ventLoadLockRoutine.Monitor();
  919. // if (ret == RState.Failed || ret == RState.Timeout)
  920. // {
  921. // PostMsg(MSG.Error);
  922. // return false;
  923. // }
  924. // return ret == RState.End;
  925. //}
  926. //private bool FnVentLoadLockToPumpingLoadLock(object[] param)
  927. //{
  928. // _ventLoadLockRoutine.Abort();
  929. // return FnStartPumpDownLoadLock(param);
  930. //}
  931. //private bool FnAbortVentLoadLock(object[] param)
  932. //{
  933. // _ventLoadLockRoutine.Abort();
  934. // return true;
  935. //}
  936. //private bool FnStartPumpDownLoadLock(object[] param)
  937. //{
  938. // return _pumpLoadLockRoutine.Start() == RState.Running;
  939. //}
  940. //private bool FnPumpDownLoadLockTimeout(object[] param)
  941. //{
  942. // RState ret = _pumpLoadLockRoutine.Monitor();
  943. // if (ret == RState.Failed || ret == RState.Timeout)
  944. // {
  945. // PostMsg(MSG.Error);
  946. // return false;
  947. // }
  948. // return ret == RState.End;
  949. //}
  950. private bool FnPumpingToVent(object[] param)
  951. {
  952. _pumpRoutine.Abort();
  953. return FnStartVent(param);
  954. }
  955. //private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  956. //{
  957. // _pumpLoadLockRoutine.Abort();
  958. // return FnStartVentLoadlock(param);
  959. //}
  960. //private bool FnAbortPumpingLoadLock(object[] param)
  961. //{
  962. // _pumpLoadLockRoutine.Abort();
  963. // return true;
  964. //}
  965. //private bool FnStartPurgeLoadlock(object[] param)
  966. //{
  967. // return _purgeLoadLockRoutine.Start() == RState.Running;
  968. //}
  969. //private bool FnPurgeLoadLockTimeout(object[] param)
  970. //{
  971. // RState ret = _purgeLoadLockRoutine.Monitor();
  972. // if (ret == RState.Failed || ret == RState.Timeout)
  973. // {
  974. // PostMsg(MSG.Error);
  975. // return false;
  976. // }
  977. // return ret == RState.End;
  978. //}
  979. //private bool FnAbortPurgeLoadLock(object[] param)
  980. //{
  981. // _purgeLoadLockRoutine.Abort();
  982. // return true;
  983. //}
  984. //private bool FnStartLoadLockLeakCheck(object[] param)
  985. //{
  986. // return _loadLockLeakCheckRoutine.Start() == RState.Running;
  987. //}
  988. //private bool FnLoadLockLeakCheckTimeout(object[] param)
  989. //{
  990. // RState ret = _loadLockLeakCheckRoutine.Monitor();
  991. // if (ret == RState.Failed || ret == RState.Timeout)
  992. // {
  993. // PostMsg(MSG.Error);
  994. // return false;
  995. // }
  996. // return ret == RState.End;
  997. //}
  998. //private bool FnAbortLoadLockLeakCheck(object[] param)
  999. //{
  1000. // _loadLockLeakCheckRoutine.Abort();
  1001. // return true;
  1002. //}
  1003. private bool FnStartPurge(object[] param)
  1004. {
  1005. return _purgeRoutine.Start() == RState.Running;
  1006. }
  1007. private bool FnPurgeTimeout(object[] param)
  1008. {
  1009. RState ret = _purgeRoutine.Monitor();
  1010. if (ret == RState.Failed || ret == RState.Timeout)
  1011. {
  1012. PostMsg(MSG.Error);
  1013. return false;
  1014. }
  1015. return ret == RState.End;
  1016. }
  1017. private bool FnAbortPurge(object[] param)
  1018. {
  1019. _purgeRoutine.Abort();
  1020. return true;
  1021. }
  1022. private bool FnStartGasLinePurge(object[] param)
  1023. {
  1024. return _gaslinePurgeRoutine.Start(param) == RState.Running;
  1025. }
  1026. private bool FnGasLinePurgeTimeout(object[] param)
  1027. {
  1028. RState ret = _gaslinePurgeRoutine.Monitor();
  1029. if (ret == RState.Failed || ret == RState.Timeout)
  1030. {
  1031. PostMsg(MSG.Error);
  1032. return false;
  1033. }
  1034. return ret == RState.End;
  1035. }
  1036. private bool FnAbortGasLinePurge(object[] param)
  1037. {
  1038. _gaslinePurgeRoutine.Abort();
  1039. return true;
  1040. }
  1041. private bool FnStartPMLeakCheck(object[] param)
  1042. {
  1043. return _leakCheckRoutine.Start(param) == RState.Running;
  1044. }
  1045. private bool FnPMLeakCheckTimeout(object[] param)
  1046. {
  1047. RState ret = _leakCheckRoutine.Monitor();
  1048. if (ret == RState.Failed || ret == RState.Timeout)
  1049. {
  1050. PostMsg(MSG.Error);
  1051. return false;
  1052. }
  1053. return ret == RState.End;
  1054. }
  1055. private bool FnAbortPMLeakCheck(object[] param)
  1056. {
  1057. _leakCheckRoutine.Abort();
  1058. return true;
  1059. }
  1060. private bool FnStartGasBoxLeakCheck(object[] param)
  1061. {
  1062. return _gasBoxLeakCheckRoutine.Start(param) == RState.Running;
  1063. }
  1064. private bool FnGasBoxLeakCheckTimeout(object[] param)
  1065. {
  1066. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  1067. if (ret == RState.Failed || ret == RState.Timeout)
  1068. {
  1069. PostMsg(MSG.Error);
  1070. return false;
  1071. }
  1072. return ret == RState.End;
  1073. }
  1074. private bool FnAbortGasBoxLeakCheck(object[] param)
  1075. {
  1076. _gasBoxLeakCheckRoutine.Abort();
  1077. return true;
  1078. }
  1079. //private bool FnStartLLPlace(object[] param)
  1080. //{
  1081. // return _llPlaceRoutine.Start() == RState.Running;
  1082. //}
  1083. //private bool FnLLPlaceTimeout(object[] param)
  1084. //{
  1085. // RState ret = _llPlaceRoutine.Monitor();
  1086. // if (ret == RState.Failed || ret == RState.Timeout)
  1087. // {
  1088. // PostMsg(MSG.Error);
  1089. // return false;
  1090. // }
  1091. // return ret == RState.End;
  1092. //}
  1093. //private bool FnAbortLLPlace(object[] param)
  1094. //{
  1095. // _llPlaceRoutine.Abort();
  1096. // return true;
  1097. //}
  1098. //private bool FnStartLLPick(object[] param)
  1099. //{
  1100. // return _llPickRoutine.Start() == RState.Running;
  1101. //}
  1102. //private bool FnLLPickTimeout(object[] param)
  1103. //{
  1104. // RState ret = _llPickRoutine.Monitor();
  1105. // if (ret == RState.Failed || ret == RState.Timeout)
  1106. // {
  1107. // PostMsg(MSG.Error);
  1108. // return false;
  1109. // }
  1110. // return ret == RState.End;
  1111. //}
  1112. //private bool FnAbortLLPick(object[] param)
  1113. //{
  1114. // _llPickRoutine.Abort();
  1115. // return true;
  1116. //}
  1117. private bool FnRunRecipe(object[] param)
  1118. {
  1119. RState ret = _processRoutine.Start(param);
  1120. if (ret == RState.Failed || ret == RState.Timeout)
  1121. {
  1122. PostMsg(MSG.Error);
  1123. return false;
  1124. }
  1125. return ret == RState.Running;
  1126. }
  1127. private bool FnProcessTimeout(object[] param)
  1128. {
  1129. _chamber.CheckIdleInterlock(500);
  1130. RState ret = _processRoutine.Monitor();
  1131. if (ret == RState.Failed || ret == RState.Timeout)
  1132. {
  1133. PostMsg(MSG.Error);
  1134. return false;
  1135. }
  1136. if (ret == RState.End)
  1137. {
  1138. _lastProcessDone = DateTime.Now;
  1139. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1140. _dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] = fsm.ElapsedTime;
  1141. return true;
  1142. }
  1143. return false;
  1144. }
  1145. private bool FnAbortProcess(object[] param)
  1146. {
  1147. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1148. _processRoutine.Abort();
  1149. return true;
  1150. }
  1151. private bool FnStartGasFlow(object[] param)
  1152. {
  1153. return _gasFlowRoutine.Start(param) == RState.Running;
  1154. }
  1155. private bool FnGasFlowTimeout(object[] param)
  1156. {
  1157. RState ret = _gasFlowRoutine.Monitor();
  1158. if (ret == RState.Failed || ret == RState.Timeout)
  1159. {
  1160. PostMsg(MSG.Error);
  1161. return false;
  1162. }
  1163. return ret == RState.End;
  1164. }
  1165. private bool FnStopGasFlow(object[] param)
  1166. {
  1167. _gasFlowRoutine.Abort();
  1168. return true;
  1169. }
  1170. private bool FnAbortGasFlow(object[] param)
  1171. {
  1172. _gasFlowRoutine.Abort();
  1173. return true;
  1174. }
  1175. private bool FnStartRfPower(object[] param)
  1176. {
  1177. return _rfPowerRoutine.Start(param) == RState.Running;
  1178. }
  1179. private bool FnRfPowerTimeout(object[] param)
  1180. {
  1181. RState ret = _rfPowerRoutine.Monitor();
  1182. if (ret == RState.Failed || ret == RState.Timeout)
  1183. {
  1184. PostMsg(MSG.Error);
  1185. return false;
  1186. }
  1187. return ret == RState.End;
  1188. }
  1189. private bool FnAbortRfPower(object[] param)
  1190. {
  1191. _rfPowerRoutine.Abort();
  1192. if (_gasFlowRoutine._gasStatus)
  1193. {
  1194. _gasFlowRoutine.StopFlow();
  1195. }
  1196. return true;
  1197. }
  1198. private bool FnStartMFCVerification(object[] param)
  1199. {
  1200. _gasVerificationRoutine.Init((string)param[0], Convert.ToDouble(param[1]), (int)param[2]);
  1201. return _gasVerificationRoutine.Start(param) == RState.Running;
  1202. }
  1203. private bool FnMFCVerificationTimeout(object[] param)
  1204. {
  1205. RState ret = _gasVerificationRoutine.Monitor();
  1206. if (ret == RState.Failed || ret == RState.Timeout)
  1207. {
  1208. PostMsg(MSG.Error);
  1209. return false;
  1210. }
  1211. return ret == RState.End;
  1212. }
  1213. private bool FnAbortMFCVerification(object[] param)
  1214. {
  1215. _gasVerificationRoutine.Abort();
  1216. return true;
  1217. }
  1218. private bool FnControlPressure(object[] param)
  1219. {
  1220. if (RouteManager.IsATMMode)
  1221. {
  1222. return true;
  1223. }
  1224. if (IsOnline == true && fsm.State != (int)PMState.Processing && fsm.State != (int)PMState.Clean)
  1225. {
  1226. if (startControlPressureFlag == true)
  1227. {
  1228. startControlPressureFlag = false;
  1229. if (_chamber.GetPVPosition() <= 0)
  1230. {
  1231. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to pendulum valve is not Open");
  1232. return false;
  1233. }
  1234. if (_chamber.IsTurboPumpRunning == false)
  1235. {
  1236. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to turbo pump is not Open");
  1237. return false;
  1238. }
  1239. _controlPressureSetPoint = SC.GetValue<int>($"{Module}.ControlPressureSetPoint");
  1240. _controlFlowSetPoint = SC.GetValue<int>($"{Module}.ControlPressureN2FlowSetPoint");
  1241. _chamber.StartControlPressure(_controlPressureSetPoint, _controlFlowSetPoint);
  1242. }
  1243. }
  1244. else
  1245. {
  1246. if (startControlPressureFlag == false)
  1247. {
  1248. _chamber.AbortControlPressure();
  1249. startControlPressureFlag = true;
  1250. }
  1251. }
  1252. return true;
  1253. }
  1254. #region Exchange wafer with TM
  1255. private bool FnStartPreparePick(object[] param)
  1256. {
  1257. if (!_chamber.PreparePick())
  1258. {
  1259. LOG.Write(eEvent.ERR_PM, Module, $"Prepare Pick failed");
  1260. return false;
  1261. }
  1262. return true;
  1263. }
  1264. private bool FnPreparePickTimeout(object[] param)
  1265. {
  1266. // return _chamber.WaferIsDown && IsSlitDoorOpen;
  1267. return _chamber.PreparePickIsOK();
  1268. }
  1269. private bool FnAbortPreparePick(object[] param)
  1270. {
  1271. return true;
  1272. }
  1273. private bool FnStartFinishPick(object[] param)
  1274. {
  1275. //if (!_chamber.SetSlitDoor(false, out string reason))
  1276. //{
  1277. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1278. // return false;
  1279. //}
  1280. //return true;
  1281. return _chamber.EndPick();
  1282. }
  1283. private bool FnAbortPick(object[] param)
  1284. {
  1285. return true;
  1286. }
  1287. private bool FnFinishPickTimeout(object[] param)
  1288. {
  1289. //return IsSlitDoorClose;
  1290. return _chamber.EndPickIsOK();
  1291. }
  1292. private bool FnStartDropDownWafer(object[] param)
  1293. {
  1294. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1295. {
  1296. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  1297. return false;
  1298. }
  1299. return _chamber.SetLiftPin(MovementPosition.Down, out string _);
  1300. }
  1301. private bool FnDropDownTimeout(object[] param)
  1302. {
  1303. return _chamber.LiftPinIsDown;
  1304. }
  1305. private bool FnStartPreparePlace(object[] param)
  1306. {
  1307. //if (_chamber.ChamberType == JetChamber.Venus || _chamber.ChamberType == JetChamber.Kepler2300)
  1308. //{
  1309. // if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1310. // {
  1311. // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1312. // return false;
  1313. // }
  1314. //}
  1315. if (!_chamber.PreparePlace())
  1316. {
  1317. LOG.Write(eEvent.ERR_PM, Module, $"Set Wafer Down failed");
  1318. return false;
  1319. }
  1320. //string reason = "";
  1321. //if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1322. //{
  1323. // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1324. // return false;
  1325. //}
  1326. return true;
  1327. }
  1328. private bool FnPreparePlaceTimeout(object[] param)
  1329. {
  1330. return _chamber.PreparePlaceIsOK();
  1331. }
  1332. private bool FnAbortPreparePlace(object[] param)
  1333. {
  1334. return true;
  1335. }
  1336. private bool FnStartLiftUpWafer(object[] param)
  1337. {
  1338. if (!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
  1339. {
  1340. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  1341. return false;
  1342. }
  1343. return true;
  1344. }
  1345. private bool FnLiftUpTimeout(object[] param)
  1346. {
  1347. return _chamber.LiftPinIsUp;
  1348. }
  1349. private bool FnStartFinishPlace(object[] param)
  1350. {
  1351. return _chamber.EndPlace();
  1352. }
  1353. private bool FnAortPlace(object[] param)
  1354. {
  1355. return true;
  1356. }
  1357. private bool FnFinishPlaceTimeout(object[] param)
  1358. {
  1359. //return _chamber.LiftPinIsDown && IsSlitDoorClose;
  1360. return _chamber.EndPlaceIsOK();
  1361. }
  1362. private bool FnStartSwapPlace(object[] param)
  1363. {
  1364. return true;
  1365. }
  1366. private bool FnStartPartialPressure(object[] param)
  1367. {
  1368. return _pmPartialPressureRoutine.Start(param) == RState.Running;
  1369. }
  1370. private bool FnPartialPressureTimeout(object[] param)
  1371. {
  1372. RState ret = _pmPartialPressureRoutine.Monitor();
  1373. if (ret == RState.Failed || ret == RState.Timeout)
  1374. {
  1375. PostMsg(MSG.Error);
  1376. return false;
  1377. }
  1378. return ret == RState.End;
  1379. }
  1380. private bool FnAbortPartialPressure(object[] param)
  1381. {
  1382. _pmPartialPressureRoutine.Abort();
  1383. return true;
  1384. }
  1385. private bool FnStartVATPerformance(object[] param)
  1386. {
  1387. return _pmVATPerformanceRoutine.Start(param) == RState.Running;
  1388. }
  1389. private bool FnVATPerformanceTimeout(object[] param)
  1390. {
  1391. RState ret = _pmVATPerformanceRoutine.Monitor();
  1392. if (ret == RState.Failed || ret == RState.Timeout)
  1393. {
  1394. PostMsg(MSG.Error);
  1395. return false;
  1396. }
  1397. return ret == RState.End;
  1398. }
  1399. private bool FnAbortVATPerformance(object[] param)
  1400. {
  1401. _pmVATPerformanceRoutine.Abort();
  1402. return true;
  1403. }
  1404. //private bool FnStartHeat(object[] param)
  1405. //{
  1406. // if (ChamberType == JetChamber.Kepler2200A || ChamberType == JetChamber.Kepler2200B)
  1407. // {
  1408. // _pmHeatRoutine.Start();
  1409. // }
  1410. // return true;
  1411. //}
  1412. #endregion
  1413. private void _debugRoutine()
  1414. {
  1415. int flag = 0;
  1416. // Test Home routine
  1417. if (flag == 1)
  1418. {
  1419. PostMsg(MSG.Home);
  1420. }
  1421. else if (flag == 2)
  1422. {
  1423. PostMsg(MSG.Vent);
  1424. }
  1425. else if (flag == 3)
  1426. {
  1427. PostMsg(MSG.Pump);
  1428. }
  1429. else if (flag == 4)
  1430. {
  1431. PostMsg(MSG.PumpLoadLock);
  1432. }
  1433. else if (flag == 5)
  1434. {
  1435. PostMsg(MSG.VentLoadLock);
  1436. }
  1437. else if (flag == 6)
  1438. {
  1439. PostMsg(MSG.PurgeLoadLock);
  1440. }
  1441. else if (flag == 7)
  1442. {
  1443. PostMsg(MSG.LaunchPump);
  1444. }
  1445. else if (flag == 8)
  1446. {
  1447. PostMsg(MSG.LaunchTurboPump);
  1448. }
  1449. else if (flag == 9)
  1450. {
  1451. PostMsg(MSG.LoadLockLeakCheck);
  1452. }
  1453. else if (flag == 10)
  1454. {
  1455. PostMsg(MSG.CyclePurge);
  1456. }
  1457. else if (flag == 11)
  1458. {
  1459. PostMsg(MSG.GasLinePurge);
  1460. }
  1461. else if (flag == 12)
  1462. {
  1463. PostMsg(MSG.LeakCheck);
  1464. }
  1465. else if (flag == 13)
  1466. {
  1467. PostMsg(MSG.GasLeakCheck);
  1468. }
  1469. else if (flag == 14)
  1470. {
  1471. PostMsg(MSG.LLPlace);
  1472. }
  1473. else if (flag == 15)
  1474. {
  1475. PostMsg(MSG.LLPick);
  1476. }
  1477. else if (flag == 16)
  1478. {
  1479. PostMsg(MSG.RunRecipe, "7777");
  1480. }
  1481. else if (flag == 17)
  1482. {
  1483. PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
  1484. }
  1485. }
  1486. }
  1487. }