PMEntity.cs 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747
  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. EnterExitTransition<PMState, FSM_MSG>(PMState.LeakCheck, fnEnterLeakCheck, FSM_MSG.NONE, fnExitLeakCheck);
  435. EnterExitTransition<PMState, FSM_MSG>(PMState.GasBoxLeakCheck, fnEnterLeakCheck, FSM_MSG.NONE, fnExitLeakCheck);
  436. //Home
  437. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  438. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  439. AnyStateTransition(MSG.Online, FnSetOnline, FSM_STATE.SAME);
  440. AnyStateTransition(MSG.Offline, FnSetOffline, FSM_STATE.SAME);
  441. AnyStateTransition(FSM_MSG.ALARM, FnAlarm, PMState.Error);
  442. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  443. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  444. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  445. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  446. Transition(PMState.Homing, MSG.Home, FnStartHome, PMState.Homing);
  447. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  448. Transition(PMState.Homing, MSG.Abort, FnAbortHome, PMState.Idle);
  449. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  450. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  451. //Launch DryPump sequence
  452. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  453. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  454. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  455. //Launch TurboPump sequence
  456. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  457. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  458. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  459. //vent sequence
  460. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  461. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  462. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  463. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  464. //Pump sequence
  465. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  466. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  467. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  468. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  469. //Pump Loadlock sequence
  470. //Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  471. //Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  472. //Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  473. //Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  474. //Vent Loadlock sequence
  475. //Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  476. //Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  477. //Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  478. //Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  479. // Purge LoadLock sequence
  480. //Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  481. //Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  482. //Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  483. //LoadLock Leak check sequence
  484. //Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  485. //Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  486. //Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  487. // PM Purge sequence
  488. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  489. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  490. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  491. // PM GasLine Purge sequence
  492. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  493. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  494. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  495. //PM Leak check sequence
  496. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  497. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  498. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  499. //PM GasBox Leak check sequence
  500. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  501. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  502. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  503. // PlaceWafer from LoadLock Arm sequence
  504. //Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  505. //Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  506. //Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  507. // PickWafer to LoadLock Arm sequence
  508. //Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  509. //Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  510. //Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  511. // Process
  512. Transition(PMState.Idle, MSG.RunRecipe, FnRunRecipe, PMState.Processing);
  513. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  514. Transition(PMState.Processing, MSG.Abort, FnAbortProcess, PMState.Idle);
  515. // Clean
  516. Transition(PMState.Idle, MSG.Clean, FnRunRecipe, PMState.Clean);
  517. Transition(PMState.Clean, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  518. Transition(PMState.Clean, MSG.Abort, FnAbortProcess, PMState.Idle);
  519. // Gas Flow sequence
  520. Transition(PMState.Idle, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  521. Transition(PMState.GasFlowing, MSG.GasFlow, FnAbortGasFlow, PMState.Idle);
  522. Transition(PMState.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, PMState.Idle);
  523. Transition(PMState.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, PMState.Idle);
  524. Transition(PMState.GasFlowing, MSG.Abort, FnAbortGasFlow, PMState.Idle);
  525. //RF Power sequence
  526. Transition(PMState.Idle, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  527. Transition(PMState.GasFlowing, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  528. Transition(PMState.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, PMState.Idle);
  529. Transition(PMState.RfPowering, MSG.Abort, FnAbortRfPower, PMState.Idle);
  530. //MFC verification
  531. Transition(PMState.Idle, MSG.MFCVerification, FnStartMFCVerification, PMState.MFCVerification);
  532. Transition(PMState.MFCVerification, FSM_MSG.TIMER, FnMFCVerificationTimeout, PMState.Idle);
  533. Transition(PMState.MFCVerification, MSG.Abort, FnAbortMFCVerification, PMState.Idle);
  534. //////////////////////// Exchange Wafer with TM ///////////////////////////////////////////////////////
  535. // Pick Wafer from PM
  536. Transition(PMState.Idle, MSG.PreparePick, FnStartPreparePick, PMState.PreparePick);
  537. Transition(PMState.PreparePick, MSG.Abort, FnAbortPreparePick, PMState.Idle);
  538. Transition(PMState.PreparePick, FSM_MSG.TIMER, FnPreparePickTimeout, PMState.ReadyForPick);
  539. Transition(PMState.PreparePick, MSG.PreparePick, null, PMState.PreparePick);
  540. Transition(PMState.ReadyForPick, MSG.Abort, FnAbortPick, PMState.Idle);
  541. Transition(PMState.ReadyForPick, MSG.DropDownWafer, FnStartDropDownWafer, PMState.DropDownWafer);
  542. Transition(PMState.ReadyForPick, MSG.PreparePick, null, PMState.ReadyForPick);
  543. Transition(PMState.DropDownWafer, FSM_MSG.TIMER, FnDropDownTimeout, PMState.DropDownReady);
  544. Transition(PMState.DropDownReady, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  545. Transition(PMState.ReadyForPick, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  546. Transition(PMState.FinishPick, FSM_MSG.TIMER, FnFinishPickTimeout, PMState.Idle);
  547. // Place Wafer to PM
  548. Transition(PMState.Idle, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  549. //Transition(PMState.Heating, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  550. Transition(PMState.PreparePlace, MSG.Abort, FnAbortPreparePlace, PMState.Idle);
  551. Transition(PMState.PreparePlace, FSM_MSG.TIMER, FnPreparePlaceTimeout, PMState.ReadyForPlace);
  552. Transition(PMState.PreparePlace, MSG.PreparePlace, null, PMState.PreparePlace);
  553. Transition(PMState.ReadyForPlace, MSG.LiftUpWafer, FnStartLiftUpWafer, PMState.LiftUpWafer);
  554. Transition(PMState.LiftUpWafer, FSM_MSG.TIMER, FnLiftUpTimeout, PMState.LiftUpReady);
  555. Transition(PMState.LiftUpReady, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  556. Transition(PMState.ReadyForPlace, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  557. Transition(PMState.PreparePlace, MSG.Abort, FnAortPlace, PMState.Idle);
  558. Transition(PMState.ReadyForPlace, MSG.Abort, FnAortPlace, PMState.Idle);
  559. Transition(PMState.ReadyForPlace, MSG.PreparePlace, null, PMState.ReadyForPlace);
  560. Transition(PMState.LiftUpReady, MSG.Abort, FnAortPlace, PMState.Idle);
  561. Transition(PMState.FinishPlace, FSM_MSG.TIMER, FnFinishPlaceTimeout, PMState.Idle);
  562. // Swap Wafer With PM
  563. Transition(PMState.DropDownReady, MSG.PreparePlace, FnStartSwapPlace, PMState.PreparePlace);
  564. Transition(PMState.ReadyForPick, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  565. Transition(PMState.Idle, MSG.PartialPressure, FnStartPartialPressure, PMState.PartialPressureTesting);
  566. Transition(PMState.PartialPressureTesting, FSM_MSG.TIMER, FnPartialPressureTimeout, PMState.Idle);
  567. Transition(PMState.PartialPressureTesting, MSG.Abort, FnAbortPartialPressure, PMState.Idle);
  568. Transition(PMState.Idle, MSG.VATPerformance, FnStartVATPerformance, PMState.VATPerformanceTesting);
  569. Transition(PMState.VATPerformanceTesting, FSM_MSG.TIMER, FnVATPerformanceTimeout, PMState.Idle);
  570. Transition(PMState.VATPerformanceTesting, MSG.Abort, FnAbortVATPerformance, PMState.Idle);
  571. //Transition(PMState.Idle, MSG.Heat, FnStartHeat, PMState.Heating);
  572. AnyStateTransition(FSM_MSG.TIMER, FnControlPressure, FSM_STATE.SAME);
  573. Running = true;
  574. WaferManager.Instance.SubscribeLocation(Module, 1);
  575. }
  576. protected override bool Init()
  577. {
  578. DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State)), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  579. DATA.Subscribe($"{Module}.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  580. DATA.Subscribe($"{Module}.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  581. //DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  582. DATA.Subscribe($"{Module}.PartialPressureCounter", () => _pmPartialPressureRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  583. DATA.Subscribe($"{Module}.VATPerformanceCounter", () => _pmVATPerformanceRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  584. DATA.Subscribe($"{Module}.VATPerformanceResult", () => _pmVATPerformanceRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  585. DATA.Subscribe($"{Module}.PartialPressureResult", () => _pmPartialPressureRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  586. DATA.Subscribe($"{Module}.MFCCalibrationDatas", () => _gasVerificationRoutine?._MFCCalibrationDatas, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  587. DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  588. DATA.Subscribe($"{Module}.IsAlarm", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  589. DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  590. DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  591. DATA.Subscribe($"{Module}.IsOnline", () => _isOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  592. DATA.Subscribe($"{Module}.VentingFlag", () => ChamberType == JetChamber.VenusSE || ChamberType == JetChamber.VenusDE ? _venusVentRoutine.VentingFlag : _ventRoutine.VentingFlag, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  593. //DATA.Subscribe($"{Module}.GetLeakCheckDatas", () => LeakCheckDataRecorder.GetAllLeakCheckData(Module.ToString()));
  594. DATA.Subscribe($"{Module}.CurrentRecipeResult", () => _processRoutine.currentRecipeResult, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  595. DATA.Subscribe($"{Module}.LeakCheck.Step", () => _leakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  596. DATA.Subscribe($"{Module}.GasLeakCheck.Step", () => _gasBoxLeakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  597. DATA.Subscribe($"{Module}.IsInclude", () => IsInclude, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  598. OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
  599. OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
  600. OP.Subscribe($"{Module}.{RtOperation.GasLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.GasLeakCheck, args));
  601. OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  602. OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
  603. OP.Subscribe($"{Module}.{RtOperation.StartTurboPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchTurboPump));
  604. OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  605. OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
  606. OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower));
  607. OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  608. OP.Subscribe($"{Module}.{RtOperation.VentLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.VentLoadLock));
  609. OP.Subscribe($"{Module}.{RtOperation.PurgeLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PurgeLoadLock));
  610. OP.Subscribe($"{Module}.{RtOperation.PumpLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PumpLoadLock));
  611. OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
  612. OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  613. OP.Subscribe($"{Module}.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.LLPick));
  614. OP.Subscribe($"{Module}.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.LLPlace));
  615. OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args));
  616. OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, args));
  617. OP.Subscribe($"{Module}.{RtOperation.RunCleanRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.Clean, args));
  618. OP.Subscribe($"{Module}.PartialPressureTest", (cmd, args) => CheckToPostMessage((int)MSG.PartialPressure, args[0], args[1]));
  619. OP.Subscribe($"{Module}.VATPerformanceTest", (cmd, args) => CheckToPostMessage((int)MSG.VATPerformance, args[0], args[1], args[2]));
  620. OP.Subscribe($"{Module}.GasLinePurge", (cmd, args) => CheckToPostMessage((int)MSG.GasLinePurge, args[0]));
  621. OP.Subscribe($"{Module}.ManualEndStep", (cmd, args) => ManualEndStep());
  622. OP.Subscribe($"{Module}.{RtOperation.Online}", (cmd, args) => CheckToPostMessage((int)MSG.Online));
  623. OP.Subscribe($"{Module}.{RtOperation.Offline}", (cmd, args) => CheckToPostMessage((int)MSG.Offline));
  624. OP.Subscribe($"{Module}.{RtOperation.PmError}", (cmd, args) => CheckToPostMessage((int)MSG.Error));
  625. OP.Subscribe($"{Module}.{RtOperation.Include}", (cmd, args) => FnSetInclude());
  626. OP.Subscribe($"{Module}.{RtOperation.Exclude}", (cmd, args) => FnSetExclude());
  627. OP.Subscribe($"{Module}.SubscribeStatsData", (cmd, args) =>
  628. {
  629. StatsDataManager.Instance.Subscribe(args[0].ToString(), args[1].ToString());
  630. return true;
  631. });
  632. StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount", "Processed Wafer Count", 0);
  633. if (_chamber.IsRFAble())
  634. StatsDataManager.Instance.Subscribe($"{Module}.RfOnTime", "Rf On Time");
  635. if (_chamber.IsBiasRFAble())
  636. StatsDataManager.Instance.Subscribe($"{Module}.BiasRfOnTime", "Bias Rf On Time");
  637. StatsDataManager.Instance.Subscribe($"{Module}.PumpOnTime", "Pump On Time");
  638. _statProcessedWafer = StatsDataManager.Instance.GetItem($"{Module}.ProcessedWaferCount");
  639. _statRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.RfOnTime");
  640. if (_chamber.IsBiasRFAble())
  641. _statBiasRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRfOnTime");
  642. //_statPumpOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.PumpOnTime");
  643. DATA.Subscribe($"{Module}.WaferCounter", () => _statProcessedWafer.Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  644. if (_chamber.IsRFAble())
  645. DATA.Subscribe($"{Module}.RfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.RfOnTime"));
  646. if (_chamber.IsBiasRFAble())
  647. DATA.Subscribe($"{Module}.BiasRfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.BiasRfOnTime"));
  648. //DATA.Subscribe($"{Module}.PumpOnTime", () => _statPumpOnTime.fromLastPM);
  649. if (RtInstance.ConfigType==ConfigType.Kepler2200)
  650. {
  651. LOG.ModuleErrorInterrupt += (pmname, id) => PMErrorInterrupt(pmname, id);
  652. }
  653. return true;
  654. }
  655. private void PMErrorInterrupt(ModuleName pmname, eEvent eEventid)
  656. {
  657. if (pmname != Module)
  658. {
  659. return;
  660. }
  661. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_CONTINUEPROCESS || eEventid==eEvent.ERR_SENSOR_WATERFLOW_STOP_NEXTPROCESS)
  662. {
  663. this._isOnline = false;
  664. return;
  665. }
  666. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_STOPPROCESS || eEventid == eEvent.ERR_SENSOR_WATERFLOW_STOP_CURRENTPROCESS)
  667. {
  668. if (fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.Clean)
  669. {
  670. CheckToPostMessage((int)MSG.Abort);
  671. }
  672. this._isOnline = false;
  673. return;
  674. }
  675. if (stopEntityId.Contains(eEventid) && fsm.State != (int)PMState.Error)
  676. {
  677. CheckToPostMessage((int)MSG.Error);
  678. }
  679. }
  680. private bool ManualEndStep()
  681. {
  682. _processRoutine.isMaualEndStep = true;
  683. return true;
  684. }
  685. private bool FnIdle(object[] objs)
  686. {
  687. Running = false;
  688. return true;
  689. }
  690. private bool fEnterError(object[] objs)
  691. {
  692. DataCollectionManager.Instance.ManualInsertData();
  693. return true;
  694. }
  695. private bool fnEnterPickReady(object[] objs)
  696. {
  697. Status = PMStatus.Ready_For_Pick;
  698. return true;
  699. }
  700. private bool fnExitPickReady(object[] objs)
  701. {
  702. Status = PMStatus.Not_Ready;
  703. return true;
  704. }
  705. private bool fnEnterPlaceReady(object[] objs)
  706. {
  707. Status = PMStatus.Ready_For_Place;
  708. return true;
  709. }
  710. private bool fnExitPlaceReady(object[] objs)
  711. {
  712. Status = PMStatus.Not_Ready;
  713. return true;
  714. }
  715. private bool fnEnterDropDownReady(object[] objs)
  716. {
  717. Status = PMStatus.Exchange_Ready;
  718. return true;
  719. }
  720. private bool fnExitDropDownReady(object[] objs)
  721. {
  722. Status = PMStatus.Not_Ready;
  723. return true;
  724. }
  725. private bool fnEnterLiftUpReady(object[] objs)
  726. {
  727. Status = PMStatus.Exchange_Ready;
  728. return true;
  729. }
  730. private bool fnEnterLeakCheck(object[] objs)
  731. {
  732. _chamber.SetLeakCheckMode(true);
  733. return true;
  734. }
  735. private bool fnExitLeakCheck(object[] objs)
  736. {
  737. _chamber.SetLeakCheckMode(false);
  738. return true;
  739. }
  740. private bool fnExitLiftUpReady(object[] objs)
  741. {
  742. Status = PMStatus.Not_Ready;
  743. return true;
  744. }
  745. private bool FnAlarm(object[] objs)
  746. {
  747. if ((PMState)fsm.State == PMState.Processing)
  748. {
  749. }
  750. return true;
  751. }
  752. private bool FnError(object[] objs)
  753. {
  754. Running = false;
  755. _isOnline = false;
  756. //if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  757. // || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  758. // return false;
  759. //_chamber.CloseValves();
  760. //_chamber.GeneratorPowerOn(false);
  761. //_chamber.GeneratorBiasPowerOn(false);
  762. //_chamber.OpenValve(ValveType.TurboPumpPumping, true);
  763. //_chamber.OpenValve(ValveType.TurboPumpPurge, true);
  764. //_chamber.OnOffSetESCHV(false);
  765. _chamber.PMInError();
  766. if (IsProcessing)
  767. {
  768. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  769. }
  770. return true;
  771. }
  772. private bool FnTimeout(object[] objs)
  773. {
  774. _debugRoutine();
  775. return true;
  776. }
  777. private bool FnIdleTimeout(object[] objs)
  778. {
  779. _chamber.CheckIdleInterlock(0);
  780. //_debugRoutine();
  781. return true;
  782. }
  783. private bool FnErrorTimeout(object[] objs)
  784. {
  785. _chamber.CheckIdleInterlock(0);
  786. //_debugRoutine();
  787. return true;
  788. }
  789. private bool FnStartHome(object[] objs)
  790. {
  791. return _home.Start() == RState.Running;
  792. }
  793. private bool FnMonitorHome(object[] objs)
  794. {
  795. RState ret = _home.Monitor();
  796. if (ret == RState.Failed || ret == RState.Timeout)
  797. {
  798. PostMsg(MSG.Error);
  799. return false;
  800. }
  801. return ret == RState.End;
  802. }
  803. private bool FnAbortHome(object[] objs)
  804. {
  805. _home.Abort();
  806. return true;
  807. }
  808. private bool FnLaunchPump(object[] param)
  809. {
  810. return _startDryPumpRoutine.Start() == RState.Running;
  811. }
  812. private bool FnLaunchPumpTimeout(object[] param)
  813. {
  814. RState ret = _startDryPumpRoutine.Monitor();
  815. if (ret == RState.Failed || ret == RState.Timeout)
  816. {
  817. PostMsg(MSG.Error);
  818. return false;
  819. }
  820. return ret == RState.End;
  821. }
  822. private bool FnAbortStartPumping(object[] param)
  823. {
  824. _startDryPumpRoutine.Abort();
  825. return true;
  826. }
  827. private bool FnLaunchTurboPump(object[] param)
  828. {
  829. return _startTurboPumpRoutine.Start() == RState.Running;
  830. }
  831. private bool FnLaunchTurboPumpTimeout(object[] param)
  832. {
  833. RState ret = _startTurboPumpRoutine.Monitor();
  834. if (ret == RState.Failed || ret == RState.Timeout)
  835. {
  836. PostMsg(MSG.Error);
  837. return false;
  838. }
  839. return ret == RState.End;
  840. }
  841. private bool FnAbortStartTurboPumping(object[] param)
  842. {
  843. _startTurboPumpRoutine.Abort();
  844. return true;
  845. }
  846. private bool FnStartVent(object[] param)
  847. {
  848. switch (ChamberType)
  849. {
  850. case JetChamber.VenusSE:
  851. case JetChamber.VenusDE:
  852. return _venusVentRoutine.Start() == RState.Running;
  853. default:
  854. return _ventRoutine.Start() == RState.Running;
  855. }
  856. }
  857. private bool FnVentTimeout(object[] param)
  858. {
  859. RState ret;
  860. switch (ChamberType)
  861. {
  862. case JetChamber.VenusSE:
  863. case JetChamber.VenusDE:
  864. ret = _venusVentRoutine.Monitor();
  865. break;
  866. default:
  867. ret = _ventRoutine.Monitor();
  868. break;
  869. }
  870. if (ret == RState.Failed || ret == RState.Timeout)
  871. {
  872. PostMsg(MSG.Error);
  873. return false;
  874. }
  875. return ret == RState.End;
  876. }
  877. private bool FnVentToPumping(object[] param)
  878. {
  879. switch (ChamberType)
  880. {
  881. case JetChamber.VenusSE:
  882. case JetChamber.VenusDE:
  883. _venusVentRoutine.Abort();
  884. break;
  885. default:
  886. _ventRoutine.Abort();
  887. break;
  888. }
  889. return true; // FnStartPumpDown(param);
  890. }
  891. private bool FnAbortVent(object[] param)
  892. {
  893. switch (ChamberType)
  894. {
  895. case JetChamber.VenusSE:
  896. case JetChamber.VenusDE:
  897. _venusVentRoutine.Abort();
  898. break;
  899. default:
  900. _ventRoutine.Abort();
  901. break;
  902. }
  903. return true;
  904. }
  905. private bool FnStartPumpDown(object[] param)
  906. {
  907. return _pumpRoutine.Start() == RState.Running;
  908. }
  909. private bool FnPumpDownTimeout(object[] param)
  910. {
  911. RState ret = _pumpRoutine.Monitor();
  912. if (ret == RState.Failed || ret == RState.Timeout)
  913. {
  914. PostMsg(MSG.Error);
  915. return false;
  916. }
  917. return ret == RState.End;
  918. }
  919. private bool FnAbortPumping(object[] param)
  920. {
  921. _pumpRoutine.Abort();
  922. return true;
  923. }
  924. //private bool FnStartVentLoadlock(object[] param)
  925. //{
  926. // return _ventLoadLockRoutine.Start() == RState.Running;
  927. //}
  928. //private bool FnVentLoadLockTimeout(object[] param)
  929. //{
  930. // RState ret = _ventLoadLockRoutine.Monitor();
  931. // if (ret == RState.Failed || ret == RState.Timeout)
  932. // {
  933. // PostMsg(MSG.Error);
  934. // return false;
  935. // }
  936. // return ret == RState.End;
  937. //}
  938. //private bool FnVentLoadLockToPumpingLoadLock(object[] param)
  939. //{
  940. // _ventLoadLockRoutine.Abort();
  941. // return FnStartPumpDownLoadLock(param);
  942. //}
  943. //private bool FnAbortVentLoadLock(object[] param)
  944. //{
  945. // _ventLoadLockRoutine.Abort();
  946. // return true;
  947. //}
  948. //private bool FnStartPumpDownLoadLock(object[] param)
  949. //{
  950. // return _pumpLoadLockRoutine.Start() == RState.Running;
  951. //}
  952. //private bool FnPumpDownLoadLockTimeout(object[] param)
  953. //{
  954. // RState ret = _pumpLoadLockRoutine.Monitor();
  955. // if (ret == RState.Failed || ret == RState.Timeout)
  956. // {
  957. // PostMsg(MSG.Error);
  958. // return false;
  959. // }
  960. // return ret == RState.End;
  961. //}
  962. private bool FnPumpingToVent(object[] param)
  963. {
  964. _pumpRoutine.Abort();
  965. return FnStartVent(param);
  966. }
  967. //private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  968. //{
  969. // _pumpLoadLockRoutine.Abort();
  970. // return FnStartVentLoadlock(param);
  971. //}
  972. //private bool FnAbortPumpingLoadLock(object[] param)
  973. //{
  974. // _pumpLoadLockRoutine.Abort();
  975. // return true;
  976. //}
  977. //private bool FnStartPurgeLoadlock(object[] param)
  978. //{
  979. // return _purgeLoadLockRoutine.Start() == RState.Running;
  980. //}
  981. //private bool FnPurgeLoadLockTimeout(object[] param)
  982. //{
  983. // RState ret = _purgeLoadLockRoutine.Monitor();
  984. // if (ret == RState.Failed || ret == RState.Timeout)
  985. // {
  986. // PostMsg(MSG.Error);
  987. // return false;
  988. // }
  989. // return ret == RState.End;
  990. //}
  991. //private bool FnAbortPurgeLoadLock(object[] param)
  992. //{
  993. // _purgeLoadLockRoutine.Abort();
  994. // return true;
  995. //}
  996. //private bool FnStartLoadLockLeakCheck(object[] param)
  997. //{
  998. // return _loadLockLeakCheckRoutine.Start() == RState.Running;
  999. //}
  1000. //private bool FnLoadLockLeakCheckTimeout(object[] param)
  1001. //{
  1002. // RState ret = _loadLockLeakCheckRoutine.Monitor();
  1003. // if (ret == RState.Failed || ret == RState.Timeout)
  1004. // {
  1005. // PostMsg(MSG.Error);
  1006. // return false;
  1007. // }
  1008. // return ret == RState.End;
  1009. //}
  1010. //private bool FnAbortLoadLockLeakCheck(object[] param)
  1011. //{
  1012. // _loadLockLeakCheckRoutine.Abort();
  1013. // return true;
  1014. //}
  1015. private bool FnStartPurge(object[] param)
  1016. {
  1017. return _purgeRoutine.Start() == RState.Running;
  1018. }
  1019. private bool FnPurgeTimeout(object[] param)
  1020. {
  1021. RState ret = _purgeRoutine.Monitor();
  1022. if (ret == RState.Failed || ret == RState.Timeout)
  1023. {
  1024. PostMsg(MSG.Error);
  1025. return false;
  1026. }
  1027. return ret == RState.End;
  1028. }
  1029. private bool FnAbortPurge(object[] param)
  1030. {
  1031. _purgeRoutine.Abort();
  1032. return true;
  1033. }
  1034. private bool FnStartGasLinePurge(object[] param)
  1035. {
  1036. return _gaslinePurgeRoutine.Start(param) == RState.Running;
  1037. }
  1038. private bool FnGasLinePurgeTimeout(object[] param)
  1039. {
  1040. RState ret = _gaslinePurgeRoutine.Monitor();
  1041. if (ret == RState.Failed || ret == RState.Timeout)
  1042. {
  1043. PostMsg(MSG.Error);
  1044. return false;
  1045. }
  1046. return ret == RState.End;
  1047. }
  1048. private bool FnAbortGasLinePurge(object[] param)
  1049. {
  1050. _gaslinePurgeRoutine.Abort();
  1051. return true;
  1052. }
  1053. private bool FnStartPMLeakCheck(object[] param)
  1054. {
  1055. return _leakCheckRoutine.Start(param) == RState.Running;
  1056. }
  1057. private bool FnPMLeakCheckTimeout(object[] param)
  1058. {
  1059. RState ret = _leakCheckRoutine.Monitor();
  1060. if (ret == RState.Failed || ret == RState.Timeout)
  1061. {
  1062. PostMsg(MSG.Error);
  1063. return false;
  1064. }
  1065. return ret == RState.End;
  1066. }
  1067. private bool FnAbortPMLeakCheck(object[] param)
  1068. {
  1069. _leakCheckRoutine.Abort();
  1070. return true;
  1071. }
  1072. private bool FnStartGasBoxLeakCheck(object[] param)
  1073. {
  1074. return _gasBoxLeakCheckRoutine.Start(param) == RState.Running;
  1075. }
  1076. private bool FnGasBoxLeakCheckTimeout(object[] param)
  1077. {
  1078. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  1079. if (ret == RState.Failed || ret == RState.Timeout)
  1080. {
  1081. PostMsg(MSG.Error);
  1082. return false;
  1083. }
  1084. return ret == RState.End;
  1085. }
  1086. private bool FnAbortGasBoxLeakCheck(object[] param)
  1087. {
  1088. _gasBoxLeakCheckRoutine.Abort();
  1089. return true;
  1090. }
  1091. //private bool FnStartLLPlace(object[] param)
  1092. //{
  1093. // return _llPlaceRoutine.Start() == RState.Running;
  1094. //}
  1095. //private bool FnLLPlaceTimeout(object[] param)
  1096. //{
  1097. // RState ret = _llPlaceRoutine.Monitor();
  1098. // if (ret == RState.Failed || ret == RState.Timeout)
  1099. // {
  1100. // PostMsg(MSG.Error);
  1101. // return false;
  1102. // }
  1103. // return ret == RState.End;
  1104. //}
  1105. //private bool FnAbortLLPlace(object[] param)
  1106. //{
  1107. // _llPlaceRoutine.Abort();
  1108. // return true;
  1109. //}
  1110. //private bool FnStartLLPick(object[] param)
  1111. //{
  1112. // return _llPickRoutine.Start() == RState.Running;
  1113. //}
  1114. //private bool FnLLPickTimeout(object[] param)
  1115. //{
  1116. // RState ret = _llPickRoutine.Monitor();
  1117. // if (ret == RState.Failed || ret == RState.Timeout)
  1118. // {
  1119. // PostMsg(MSG.Error);
  1120. // return false;
  1121. // }
  1122. // return ret == RState.End;
  1123. //}
  1124. //private bool FnAbortLLPick(object[] param)
  1125. //{
  1126. // _llPickRoutine.Abort();
  1127. // return true;
  1128. //}
  1129. private bool FnRunRecipe(object[] param)
  1130. {
  1131. RState ret = _processRoutine.Start(param);
  1132. if (ret == RState.Failed || ret == RState.Timeout)
  1133. {
  1134. PostMsg(MSG.Error);
  1135. return false;
  1136. }
  1137. return ret == RState.Running;
  1138. }
  1139. private bool FnProcessTimeout(object[] param)
  1140. {
  1141. _chamber.CheckIdleInterlock(500);
  1142. RState ret = _processRoutine.Monitor();
  1143. if (ret == RState.Failed || ret == RState.Timeout)
  1144. {
  1145. PostMsg(MSG.Error);
  1146. return false;
  1147. }
  1148. if (ret == RState.End)
  1149. {
  1150. _lastProcessDone = DateTime.Now;
  1151. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1152. _dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] = fsm.ElapsedTime;
  1153. return true;
  1154. }
  1155. return false;
  1156. }
  1157. private bool FnAbortProcess(object[] param)
  1158. {
  1159. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1160. _processRoutine.Abort();
  1161. return true;
  1162. }
  1163. private bool FnStartGasFlow(object[] param)
  1164. {
  1165. return _gasFlowRoutine.Start(param) == RState.Running;
  1166. }
  1167. private bool FnGasFlowTimeout(object[] param)
  1168. {
  1169. RState ret = _gasFlowRoutine.Monitor();
  1170. if (ret == RState.Failed || ret == RState.Timeout)
  1171. {
  1172. PostMsg(MSG.Error);
  1173. return false;
  1174. }
  1175. return ret == RState.End;
  1176. }
  1177. private bool FnStopGasFlow(object[] param)
  1178. {
  1179. _gasFlowRoutine.Abort();
  1180. return true;
  1181. }
  1182. private bool FnAbortGasFlow(object[] param)
  1183. {
  1184. _gasFlowRoutine.Abort();
  1185. return true;
  1186. }
  1187. private bool FnStartRfPower(object[] param)
  1188. {
  1189. return _rfPowerRoutine.Start(param) == RState.Running;
  1190. }
  1191. private bool FnRfPowerTimeout(object[] param)
  1192. {
  1193. RState ret = _rfPowerRoutine.Monitor();
  1194. if (ret == RState.Failed || ret == RState.Timeout)
  1195. {
  1196. PostMsg(MSG.Error);
  1197. return false;
  1198. }
  1199. return ret == RState.End;
  1200. }
  1201. private bool FnAbortRfPower(object[] param)
  1202. {
  1203. _rfPowerRoutine.Abort();
  1204. if (_gasFlowRoutine._gasStatus)
  1205. {
  1206. _gasFlowRoutine.StopFlow();
  1207. }
  1208. return true;
  1209. }
  1210. private bool FnStartMFCVerification(object[] param)
  1211. {
  1212. _gasVerificationRoutine.Init((string)param[0], Convert.ToDouble(param[1]), (int)param[2]);
  1213. return _gasVerificationRoutine.Start(param) == RState.Running;
  1214. }
  1215. private bool FnMFCVerificationTimeout(object[] param)
  1216. {
  1217. RState ret = _gasVerificationRoutine.Monitor();
  1218. if (ret == RState.Failed || ret == RState.Timeout)
  1219. {
  1220. PostMsg(MSG.Error);
  1221. return false;
  1222. }
  1223. return ret == RState.End;
  1224. }
  1225. private bool FnAbortMFCVerification(object[] param)
  1226. {
  1227. _gasVerificationRoutine.Abort();
  1228. return true;
  1229. }
  1230. private bool FnControlPressure(object[] param)
  1231. {
  1232. if (RouteManager.IsATMMode)
  1233. {
  1234. return true;
  1235. }
  1236. if (IsOnline == true && fsm.State != (int)PMState.Processing && fsm.State != (int)PMState.Clean)
  1237. {
  1238. if (startControlPressureFlag == true)
  1239. {
  1240. startControlPressureFlag = false;
  1241. if (_chamber.GetPVPosition() <= 0)
  1242. {
  1243. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to pendulum valve is not Open");
  1244. return false;
  1245. }
  1246. if (_chamber.IsTurboPumpRunning == false)
  1247. {
  1248. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to turbo pump is not Open");
  1249. return false;
  1250. }
  1251. _controlPressureSetPoint = SC.GetValue<int>($"{Module}.ControlPressureSetPoint");
  1252. _controlFlowSetPoint = SC.GetValue<int>($"{Module}.ControlPressureN2FlowSetPoint");
  1253. _chamber.StartControlPressure(_controlPressureSetPoint, _controlFlowSetPoint);
  1254. }
  1255. }
  1256. else
  1257. {
  1258. if (startControlPressureFlag == false)
  1259. {
  1260. _chamber.AbortControlPressure();
  1261. startControlPressureFlag = true;
  1262. }
  1263. }
  1264. return true;
  1265. }
  1266. #region Exchange wafer with TM
  1267. private bool FnStartPreparePick(object[] param)
  1268. {
  1269. if (!_chamber.PreparePick())
  1270. {
  1271. LOG.Write(eEvent.ERR_PM, Module, $"Prepare Pick failed");
  1272. return false;
  1273. }
  1274. return true;
  1275. }
  1276. private bool FnPreparePickTimeout(object[] param)
  1277. {
  1278. // return _chamber.WaferIsDown && IsSlitDoorOpen;
  1279. return _chamber.PreparePickIsOK();
  1280. }
  1281. private bool FnAbortPreparePick(object[] param)
  1282. {
  1283. return true;
  1284. }
  1285. private bool FnStartFinishPick(object[] param)
  1286. {
  1287. //if (!_chamber.SetSlitDoor(false, out string reason))
  1288. //{
  1289. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1290. // return false;
  1291. //}
  1292. //return true;
  1293. return _chamber.EndPick();
  1294. }
  1295. private bool FnAbortPick(object[] param)
  1296. {
  1297. return true;
  1298. }
  1299. private bool FnFinishPickTimeout(object[] param)
  1300. {
  1301. //return IsSlitDoorClose;
  1302. return _chamber.EndPickIsOK();
  1303. }
  1304. private bool FnStartDropDownWafer(object[] param)
  1305. {
  1306. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1307. {
  1308. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  1309. return false;
  1310. }
  1311. return _chamber.SetLiftPin(MovementPosition.Down, out string _);
  1312. }
  1313. private bool FnDropDownTimeout(object[] param)
  1314. {
  1315. return _chamber.LiftPinIsDown;
  1316. }
  1317. private bool FnStartPreparePlace(object[] param)
  1318. {
  1319. //if (_chamber.ChamberType == JetChamber.Venus || _chamber.ChamberType == JetChamber.Kepler2300)
  1320. //{
  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. //}
  1327. if (!_chamber.PreparePlace())
  1328. {
  1329. LOG.Write(eEvent.ERR_PM, Module, $"Set Wafer Down failed");
  1330. return false;
  1331. }
  1332. //string reason = "";
  1333. //if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1334. //{
  1335. // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1336. // return false;
  1337. //}
  1338. return true;
  1339. }
  1340. private bool FnPreparePlaceTimeout(object[] param)
  1341. {
  1342. return _chamber.PreparePlaceIsOK();
  1343. }
  1344. private bool FnAbortPreparePlace(object[] param)
  1345. {
  1346. return true;
  1347. }
  1348. private bool FnStartLiftUpWafer(object[] param)
  1349. {
  1350. if (!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
  1351. {
  1352. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  1353. return false;
  1354. }
  1355. return true;
  1356. }
  1357. private bool FnLiftUpTimeout(object[] param)
  1358. {
  1359. return _chamber.LiftPinIsUp;
  1360. }
  1361. private bool FnStartFinishPlace(object[] param)
  1362. {
  1363. return _chamber.EndPlace();
  1364. }
  1365. private bool FnAortPlace(object[] param)
  1366. {
  1367. return true;
  1368. }
  1369. private bool FnFinishPlaceTimeout(object[] param)
  1370. {
  1371. //return _chamber.LiftPinIsDown && IsSlitDoorClose;
  1372. return _chamber.EndPlaceIsOK();
  1373. }
  1374. private bool FnStartSwapPlace(object[] param)
  1375. {
  1376. return true;
  1377. }
  1378. private bool FnStartPartialPressure(object[] param)
  1379. {
  1380. return _pmPartialPressureRoutine.Start(param) == RState.Running;
  1381. }
  1382. private bool FnPartialPressureTimeout(object[] param)
  1383. {
  1384. RState ret = _pmPartialPressureRoutine.Monitor();
  1385. if (ret == RState.Failed || ret == RState.Timeout)
  1386. {
  1387. PostMsg(MSG.Error);
  1388. return false;
  1389. }
  1390. return ret == RState.End;
  1391. }
  1392. private bool FnAbortPartialPressure(object[] param)
  1393. {
  1394. _pmPartialPressureRoutine.Abort();
  1395. return true;
  1396. }
  1397. private bool FnStartVATPerformance(object[] param)
  1398. {
  1399. return _pmVATPerformanceRoutine.Start(param) == RState.Running;
  1400. }
  1401. private bool FnVATPerformanceTimeout(object[] param)
  1402. {
  1403. RState ret = _pmVATPerformanceRoutine.Monitor();
  1404. if (ret == RState.Failed || ret == RState.Timeout)
  1405. {
  1406. PostMsg(MSG.Error);
  1407. return false;
  1408. }
  1409. return ret == RState.End;
  1410. }
  1411. private bool FnAbortVATPerformance(object[] param)
  1412. {
  1413. _pmVATPerformanceRoutine.Abort();
  1414. return true;
  1415. }
  1416. //private bool FnStartHeat(object[] param)
  1417. //{
  1418. // if (ChamberType == JetChamber.Kepler2200A || ChamberType == JetChamber.Kepler2200B)
  1419. // {
  1420. // _pmHeatRoutine.Start();
  1421. // }
  1422. // return true;
  1423. //}
  1424. #endregion
  1425. private void _debugRoutine()
  1426. {
  1427. int flag = 0;
  1428. // Test Home routine
  1429. if (flag == 1)
  1430. {
  1431. PostMsg(MSG.Home);
  1432. }
  1433. else if (flag == 2)
  1434. {
  1435. PostMsg(MSG.Vent);
  1436. }
  1437. else if (flag == 3)
  1438. {
  1439. PostMsg(MSG.Pump);
  1440. }
  1441. else if (flag == 4)
  1442. {
  1443. PostMsg(MSG.PumpLoadLock);
  1444. }
  1445. else if (flag == 5)
  1446. {
  1447. PostMsg(MSG.VentLoadLock);
  1448. }
  1449. else if (flag == 6)
  1450. {
  1451. PostMsg(MSG.PurgeLoadLock);
  1452. }
  1453. else if (flag == 7)
  1454. {
  1455. PostMsg(MSG.LaunchPump);
  1456. }
  1457. else if (flag == 8)
  1458. {
  1459. PostMsg(MSG.LaunchTurboPump);
  1460. }
  1461. else if (flag == 9)
  1462. {
  1463. PostMsg(MSG.LoadLockLeakCheck);
  1464. }
  1465. else if (flag == 10)
  1466. {
  1467. PostMsg(MSG.CyclePurge);
  1468. }
  1469. else if (flag == 11)
  1470. {
  1471. PostMsg(MSG.GasLinePurge);
  1472. }
  1473. else if (flag == 12)
  1474. {
  1475. PostMsg(MSG.LeakCheck);
  1476. }
  1477. else if (flag == 13)
  1478. {
  1479. PostMsg(MSG.GasLeakCheck);
  1480. }
  1481. else if (flag == 14)
  1482. {
  1483. PostMsg(MSG.LLPlace);
  1484. }
  1485. else if (flag == 15)
  1486. {
  1487. PostMsg(MSG.LLPick);
  1488. }
  1489. else if (flag == 16)
  1490. {
  1491. PostMsg(MSG.RunRecipe, "7777");
  1492. }
  1493. else if (flag == 17)
  1494. {
  1495. PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
  1496. }
  1497. }
  1498. }
  1499. }