PMEntity.cs 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using Aitex.Core.Common;
  7. using Aitex.Core.RT.DataCenter;
  8. using Aitex.Core.RT.Device;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.Fsm;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.Routine;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.Util;
  15. using Aitex.Sorter.Common;
  16. using MECF.Framework.Common.DataCenter;
  17. using MECF.Framework.Common.Equipment;
  18. using MECF.Framework.Common.Schedulers;
  19. using MECF.Framework.Common.SubstrateTrackings;
  20. using Venus_Core;
  21. using Venus_RT.Devices;
  22. using Venus_RT.Modules;
  23. using Venus_RT.Modules.PMs;
  24. using MECF.Framework.Common.Routine;
  25. using Aitex.Core.RT.Log;
  26. namespace Venus_RT.Modules.PMs
  27. {
  28. public class RecipeRunningInfo
  29. {
  30. public Guid InnerId { get; set; }
  31. public RecipeHead Head { get; set; }
  32. public List<RecipeStep> RecipeStepList { get; set; }
  33. public string RecipeName { get; set; }
  34. public DateTime BeginTime { get; set; }
  35. public DateTime EndTime { get; set; }
  36. public int StepNumber { get; set; }
  37. public string StepName { get; set; }
  38. public double StepTime { get; set; }
  39. public double StepElapseTime { get; set; }
  40. public double TotalTime { get; set; }
  41. public double TotalElapseTime { get; set; }
  42. }
  43. public class PMEntity : Entity, IModuleEntity
  44. {
  45. public enum PMStatus
  46. {
  47. Not_Ready,
  48. Ready_For_Pick,
  49. Ready_For_Place,
  50. Exchange_Ready,
  51. }
  52. public enum MSG
  53. {
  54. Home,
  55. Transfer,
  56. PrepareTransfer,
  57. PostTransfer,
  58. Reset,
  59. Abort,
  60. Error,
  61. LaunchPump,
  62. LaunchTurboPump,
  63. Pump,
  64. Vent,
  65. PumpLoadLock,
  66. VentLoadLock,
  67. PurgeLoadLock,
  68. LoadLockLeakCheck,
  69. CyclePurge,
  70. GasLinePurge,
  71. Heat,
  72. TransferHandoff,
  73. StartTransfer,
  74. LeakCheck,
  75. GasLeakCheck,
  76. MoveLiftPin,
  77. MoveGuidePin,
  78. LLPlace,
  79. LLPick,
  80. Process,
  81. RunRecipe,
  82. PostProcess,
  83. RecipeSkipStep,
  84. RecipeUpdate,
  85. RecipeResume,
  86. RecipePause,
  87. RecipeAbort,
  88. PreProcess,
  89. AutoMode,
  90. ManualMode,
  91. LockLid,
  92. Clean,
  93. Online,
  94. Offline,
  95. GasFlow,
  96. StopGasFlow,
  97. RfPower,
  98. MFCVerification,
  99. // exchange wafer with TM
  100. PreparePick,
  101. PreparePlace,
  102. LiftUpWafer,
  103. DropDownWafer,
  104. PickReady,
  105. PlaceReady,
  106. MaxMsg
  107. }
  108. private readonly JetPM _chamber;
  109. public ModuleName Module { get; }
  110. public PMStatus Status { get; private set; }
  111. public Action<bool, bool> TransferPrepared;
  112. private readonly PMHomeRoutine _home;
  113. private readonly StartDryPumpRoutine _startDryPumpRoutine;
  114. private readonly StartTurboPumpRoutine _startTurboPumpRoutine;
  115. private readonly VentRoutine _ventRoutine;
  116. private readonly PumpDownRoutine _pumpRoutine;
  117. private readonly LoadLockVentRoutine _ventLoadLockRoutine;
  118. private readonly LoadLockPumpRoutine _pumpLoadLockRoutine;
  119. private readonly LoadLockPurgeRoutine _purgeLoadLockRoutine;
  120. private readonly LoadLockLeakCheckRoutine _loadLockLeakCheckRoutine;
  121. private readonly PMPurgeRoutine _purgeRoutine;
  122. private readonly PMGaslinePurgeRoutine _gaslinePurgeRoutine;
  123. private readonly PMLeakCheckRoutine _leakCheckRoutine;
  124. private readonly GasBoxLeakCheckRoutine _gasBoxLeakCheckRoutine;
  125. private readonly LLPlaceRoutine _llPlaceRoutine;
  126. private readonly LLPickRoutine _llPickRoutine;
  127. private readonly PMProcessRoutine _processRoutine;
  128. private readonly GasFlowRoutine _gasFlowRoutine;
  129. private readonly RFPowerSwitchRoutine _rfPowerRoutine;
  130. private readonly PMGasVerificationRoutine _gasVerificationRoutine;
  131. private AutoFlag _AutoMode;
  132. private bool _isOnline = false;
  133. //private bool _isAlarm;
  134. //private DateTime _pumpStartTime;
  135. //private TimeSpan _pumpElapsedTime;
  136. //private DateTime _rfStartTime;
  137. //private DateTime _tcStartTime;
  138. //private TimeSpan _rfElapsedTime;
  139. //private TimeSpan _tcElapsedTime;
  140. //private MovementPosition _goalLiftPin;
  141. //private ushort _ActivatedActionID;
  142. //private Stopwatch _LifpinSleepTimer;
  143. public bool IsIdle
  144. {
  145. get { return fsm.State == (int)PMState.Idle; }
  146. }
  147. public bool IsError
  148. {
  149. get { return fsm.State == (int)PMState.Error; }
  150. }
  151. public bool IsInit
  152. {
  153. get { return fsm.State == (int)PMState.Init; }
  154. }
  155. public bool IsBusy
  156. {
  157. get { return !IsInit && !IsError && !IsIdle; }
  158. }
  159. public bool IsProcessing
  160. {
  161. get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
  162. }
  163. public bool IsOnline
  164. {
  165. get { return _isOnline; }
  166. }
  167. public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
  168. public bool IsSlitDoorOpen => _chamber.CheckSlitDoorOpen();
  169. public bool IsSlitDoorClose => _chamber.CheckSlitDoorClose();
  170. public bool LiftPinIsDown => _chamber.LiftPinIsDown;
  171. public bool LiftPinIsUp => _chamber.LiftPinIsUp;
  172. public bool Check(int msg, out string reason, object[] objs)
  173. {
  174. reason = "";
  175. return true;
  176. }
  177. //
  178. private bool CheckToPostMessage(int msg, params object[] args)
  179. {
  180. if (!fsm.FindTransition(fsm.State, msg))
  181. {
  182. EV.PostWarningLog(Module.ToString(), eEvent.WARN_State, $"{Module} is in { (PMState)fsm.State} state,can not do {(MSG)msg}");
  183. return false;
  184. }
  185. fsm.PostMsg(msg, args);
  186. return true;
  187. }
  188. public int Invoke(string function, params object[] args)
  189. {
  190. switch (function)
  191. {
  192. case "Home":
  193. CheckToPostMessage((int)MSG.Home);
  194. return (int)MSG.Home;
  195. }
  196. return (int)FSM_MSG.NONE;
  197. }
  198. public bool CheckAcked(int msg)
  199. {
  200. return fsm.CheckExecuted(msg);
  201. }
  202. public bool IsPrepareTransferReady(ModuleName robot, EnumTransferType type, int slot, Hand blade)
  203. {
  204. //if (type == EnumTransferType.Pick)
  205. //{
  206. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(_chamber.Module, 0).Size);
  207. //}
  208. //else if (type == EnumTransferType.Place)
  209. //{
  210. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(robot, (int)blade).Size);
  211. //}
  212. return false;
  213. }
  214. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
  215. {
  216. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString()))
  217. return (int)MSG.PrepareTransfer;
  218. return (int)FSM_MSG.NONE;
  219. }
  220. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp)
  221. {
  222. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp))
  223. return (int)MSG.PrepareTransfer;
  224. return (int)FSM_MSG.NONE;
  225. }
  226. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp, WaferSize size)
  227. {
  228. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp, size))
  229. return (int)MSG.PrepareTransfer;
  230. return (int)FSM_MSG.NONE;
  231. }
  232. public int InvokePostTransfer(ModuleName robot, EnumTransferType type, int slot)
  233. {
  234. if (CheckToPostMessage((int)MSG.PostTransfer, type.ToString()))
  235. return (int)MSG.PostTransfer;
  236. return (int)FSM_MSG.NONE;
  237. }
  238. public int InvokeClean(string recipeName, string waferID, bool withWafer)
  239. {
  240. if (CheckToPostMessage((int)MSG.Clean, recipeName, waferID, withWafer))
  241. {
  242. return (int)MSG.Clean;
  243. }
  244. return (int)FSM_MSG.NONE;
  245. }
  246. public int InvokeProcess(string recipeName, string waferID, bool withWafer)
  247. {
  248. if (CheckToPostMessage((int)MSG.RunRecipe, recipeName, waferID, withWafer))
  249. return (int)MSG.RunRecipe;
  250. return (int)FSM_MSG.NONE;
  251. }
  252. public int InvokePreHeat(float temperature)
  253. {
  254. if (CheckToPostMessage((int)MSG.Heat, (double)temperature))
  255. return (int)MSG.Heat;
  256. return (int)FSM_MSG.NONE;
  257. }
  258. public void InvokeReset()
  259. {
  260. PostMsg((int)MSG.Reset);
  261. }
  262. public void SetAuto()
  263. {
  264. this._AutoMode = AutoFlag.Auto;
  265. }
  266. private bool FnSetManual(object[] param)
  267. {
  268. if (fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
  269. {
  270. EV.PostWarningLog(Module.ToString(), $"{Module} is in {(PMState)fsm.State},can not do SetAutoMode");
  271. return false;
  272. }
  273. this._AutoMode = AutoFlag.Manual;
  274. if (IsOnline)
  275. {
  276. EV.PostWarningLog(Module.ToString(), $"{Module} is online,change to offline due to the chamber change to manual mode");
  277. this._isOnline = false;
  278. }
  279. return true;
  280. }
  281. private bool FnSetOnline(object[] param)
  282. {
  283. if (!IsAutoMode)
  284. {
  285. EV.PostWarningLog(Module.ToString(), $"{Module} in manual mode,can not set online.");
  286. return false;
  287. }
  288. if (!_chamber.CheckSlitDoorClose())
  289. {
  290. EV.PostWarningLog(Module.ToString(), $"{Module} slit door is open,can not set online.");
  291. return false;
  292. }
  293. this._isOnline = true;
  294. return true;
  295. }
  296. private bool FnSetOffline(object[] param)
  297. {
  298. this._isOnline = false;
  299. return true;
  300. }
  301. public PMEntity(ModuleName module)
  302. {
  303. Module = module;
  304. _chamber = DEVICE.GetDevice<JetPM>(Module.ToString());
  305. _home = new PMHomeRoutine(_chamber);
  306. _startDryPumpRoutine = new StartDryPumpRoutine(_chamber);
  307. _startTurboPumpRoutine = new StartTurboPumpRoutine(_chamber);
  308. _ventRoutine = new VentRoutine(_chamber);
  309. _pumpRoutine = new PumpDownRoutine(_chamber);
  310. _ventLoadLockRoutine = new LoadLockVentRoutine(_chamber);
  311. _pumpLoadLockRoutine = new LoadLockPumpRoutine(_chamber);
  312. _purgeLoadLockRoutine = new LoadLockPurgeRoutine(_chamber);
  313. _loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
  314. _purgeRoutine = new PMPurgeRoutine(_chamber);
  315. _gaslinePurgeRoutine = new PMGaslinePurgeRoutine(_chamber);
  316. _leakCheckRoutine = new PMLeakCheckRoutine(_chamber);
  317. _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
  318. _llPlaceRoutine = new LLPlaceRoutine(_chamber);
  319. _llPickRoutine = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
  320. _processRoutine = new PMProcessRoutine(_chamber, _pumpRoutine);
  321. _gasFlowRoutine = new GasFlowRoutine(_chamber);
  322. _rfPowerRoutine = new RFPowerSwitchRoutine(_chamber, true);
  323. _gasVerificationRoutine = new PMGasVerificationRoutine(_chamber);
  324. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  325. //Idle
  326. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  327. EnterExitTransition<PMState, FSM_MSG>(PMState.Error, fEnterError, FSM_MSG.NONE, null);
  328. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPick, fnEnterPickReady, FSM_MSG.NONE, fnExitPickReady);
  329. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPlace, fnEnterPlaceReady, FSM_MSG.NONE, fnExitPlaceReady);
  330. EnterExitTransition<PMState, FSM_MSG>(PMState.DropDownReady, fnEnterDropDownReady, FSM_MSG.NONE, fnExitDropDownReady);
  331. EnterExitTransition<PMState, FSM_MSG>(PMState.LiftUpReady, fnEnterLiftUpReady, FSM_MSG.NONE, fnExitLiftUpReady);
  332. //Home
  333. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  334. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  335. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  336. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  337. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  338. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  339. Transition(PMState.Homing, MSG.Home, FnStartHome, PMState.Homing);
  340. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  341. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  342. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  343. //Launch DryPump sequence
  344. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  345. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  346. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  347. //Launch TurboPump sequence
  348. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  349. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  350. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  351. //vent sequence
  352. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  353. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  354. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  355. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  356. //Pump sequence
  357. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  358. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  359. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  360. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  361. //Pump Loadlock sequence
  362. Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  363. Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  364. Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  365. Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  366. //Vent Loadlock sequence
  367. Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  368. Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  369. Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  370. Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  371. // Purge LoadLock sequence
  372. Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  373. Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  374. Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  375. //LoadLock Leak check sequence
  376. Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  377. Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  378. Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  379. // PM Purge sequence
  380. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  381. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  382. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  383. // PM GasLine Purge sequence
  384. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  385. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  386. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  387. //PM Leak check sequence
  388. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  389. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  390. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  391. //PM GasBox Leak check sequence
  392. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  393. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  394. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  395. // PlaceWafer from LoadLock Arm sequence
  396. Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  397. Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  398. Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  399. // PickWafer to LoadLock Arm sequence
  400. Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  401. Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  402. Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  403. // Process
  404. Transition(PMState.Idle, MSG.RunRecipe, FnRunRecipe, PMState.Processing);
  405. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  406. Transition(PMState.Processing, MSG.Abort, FnAbortProcess, PMState.Idle);
  407. // Gas Flow sequence
  408. Transition(PMState.Idle, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  409. Transition(PMState.GasFlowing, MSG.GasFlow, FnAbortGasFlow, PMState.Idle);
  410. Transition(PMState.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, PMState.Idle);
  411. Transition(PMState.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, PMState.Idle);
  412. Transition(PMState.GasFlowing, MSG.Abort, FnAbortGasFlow, PMState.Idle);
  413. //RF Power sequence
  414. Transition(PMState.Idle, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  415. Transition(PMState.GasFlowing, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  416. Transition(PMState.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, PMState.Idle);
  417. Transition(PMState.RfPowering, MSG.Abort, FnAbortRfPower, PMState.Idle);
  418. //MFC verification
  419. Transition(PMState.Idle, MSG.MFCVerification, FnStartMFCVerification, PMState.MFCVerification);
  420. Transition(PMState.MFCVerification, FSM_MSG.TIMER, FnMFCVerificationTimeout, PMState.Idle);
  421. Transition(PMState.MFCVerification, MSG.Abort, FnAbortMFCVerification, PMState.Idle);
  422. //////////////////////// Exchange Wafer with TM ///////////////////////////////////////////////////////
  423. // Pick Wafer from PM
  424. Transition(PMState.Idle, MSG.PreparePick, FnStartPreparePick, PMState.PreparePick);
  425. Transition(PMState.PreparePick, MSG.Abort, FnAbortPreparePick, PMState.Idle);
  426. Transition(PMState.PreparePick, FSM_MSG.TIMER, FnPreparePickTimeout, PMState.ReadyForPick);
  427. Transition(PMState.ReadyForPick, MSG.Abort, FnAbortPick, PMState.Idle);
  428. Transition(PMState.ReadyForPick, MSG.DropDownWafer, FnStartDropDownWafer, PMState.DropDownWafer);
  429. Transition(PMState.DropDownWafer, FSM_MSG.TIMER, FnDropDownTimeout, PMState.DropDownReady);
  430. Transition(PMState.DropDownReady, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  431. Transition(PMState.FinishPick, FSM_MSG.TIMER, FnFinishPickTimeout, PMState.Idle);
  432. // Place Wafer to PM
  433. Transition(PMState.Idle, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  434. Transition(PMState.PreparePlace, MSG.Abort, FnAbortPreparePlace, PMState.Idle);
  435. Transition(PMState.PreparePlace, FSM_MSG.TIMER, FnPreparePlaceTimeout, PMState.ReadyForPlace);
  436. Transition(PMState.ReadyForPlace, MSG.LiftUpWafer, FnStartLiftUpWafer, PMState.LiftUpWafer);
  437. Transition(PMState.LiftUpWafer, FSM_MSG.TIMER, FnLiftUpTimeout, PMState.LiftUpReady);
  438. Transition(PMState.LiftUpReady, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  439. Transition(PMState.ReadyForPlace, MSG.Abort, FnAortPlace, PMState.Idle);
  440. Transition(PMState.FinishPlace, FSM_MSG.TIMER, FnFinishPlaceTimeout, PMState.Idle);
  441. // Swap Wafer With PM
  442. Transition(PMState.DropDownReady, MSG.PreparePlace, FnStartSwapPlace, PMState.PreparePlace);
  443. Running = true;
  444. WaferManager.Instance.SubscribeLocation(Module, 1);
  445. //WaferManager.Instance.SubscribeLocation(ModuleName.LLA, 1);
  446. }
  447. protected override bool Init()
  448. {
  449. DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State).ToString()));
  450. DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter);
  451. OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
  452. OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
  453. OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  454. OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
  455. OP.Subscribe($"{Module}.{RtOperation.StartTurboPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchTurboPump));
  456. OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  457. OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
  458. OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower));
  459. OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  460. OP.Subscribe($"{Module}.{RtOperation.VentLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.VentLoadLock));
  461. OP.Subscribe($"{Module}.{RtOperation.PurgeLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PurgeLoadLock));
  462. OP.Subscribe($"{Module}.{RtOperation.PumpLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PumpLoadLock));
  463. OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
  464. OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  465. OP.Subscribe($"{Module}.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.LLPick));
  466. OP.Subscribe($"{Module}.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.LLPlace));
  467. OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args[0], args[1], args[2]));
  468. OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, args[0]));
  469. return true;
  470. }
  471. private bool FnIdle(object[] objs)
  472. {
  473. Running = false;
  474. return true;
  475. }
  476. private bool fEnterError(object[] objs)
  477. {
  478. return true;
  479. }
  480. private bool fnEnterPickReady(object[] objs)
  481. {
  482. Status = PMStatus.Ready_For_Pick;
  483. return true;
  484. }
  485. private bool fnExitPickReady(object[] objs)
  486. {
  487. Status = PMStatus.Not_Ready;
  488. return true;
  489. }
  490. private bool fnEnterPlaceReady(object[] objs)
  491. {
  492. Status = PMStatus.Ready_For_Place;
  493. return true;
  494. }
  495. private bool fnExitPlaceReady(object[] objs)
  496. {
  497. Status = PMStatus.Not_Ready;
  498. return true;
  499. }
  500. private bool fnEnterDropDownReady(object[] objs)
  501. {
  502. Status = PMStatus.Exchange_Ready;
  503. return true;
  504. }
  505. private bool fnExitDropDownReady(object[] objs)
  506. {
  507. Status = PMStatus.Not_Ready;
  508. return true;
  509. }
  510. private bool fnEnterLiftUpReady(object[] objs)
  511. {
  512. Status = PMStatus.Exchange_Ready;
  513. return true;
  514. }
  515. private bool fnExitLiftUpReady(object[] objs)
  516. {
  517. Status = PMStatus.Not_Ready;
  518. return true;
  519. }
  520. private bool FnError(object[] objs)
  521. {
  522. Running = false;
  523. if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  524. || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  525. return false;
  526. if (IsProcessing)
  527. {
  528. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  529. }
  530. return true;
  531. }
  532. private bool FnTimeout(object[] objs)
  533. {
  534. _debugRoutine();
  535. return true;
  536. }
  537. private bool FnIdleTimeout(object[] objs)
  538. {
  539. _chamber.CheckIdleInterlock();
  540. //_debugRoutine();
  541. return true;
  542. }
  543. private bool FnErrorTimeout(object[] objs)
  544. {
  545. //_debugRoutine();
  546. return true;
  547. }
  548. private bool FnStartHome(object[] objs)
  549. {
  550. return _home.Start() == RState.Running;
  551. }
  552. private bool FnMonitorHome(object[] objs)
  553. {
  554. RState ret = _home.Monitor();
  555. if (ret == RState.Failed || ret == RState.Timeout)
  556. {
  557. PostMsg(MSG.Error);
  558. return false;
  559. }
  560. return ret == RState.End;
  561. }
  562. private bool FnLaunchPump(object[] param)
  563. {
  564. return _startDryPumpRoutine.Start() == RState.Running;
  565. }
  566. private bool FnLaunchPumpTimeout(object[] param)
  567. {
  568. RState ret = _startDryPumpRoutine.Monitor();
  569. if (ret == RState.Failed || ret == RState.Timeout)
  570. {
  571. PostMsg(MSG.Error);
  572. return false;
  573. }
  574. return ret == RState.End;
  575. }
  576. private bool FnAbortStartPumping(object[] param)
  577. {
  578. _startDryPumpRoutine.Abort();
  579. return true;
  580. }
  581. private bool FnLaunchTurboPump(object[] param)
  582. {
  583. return _startTurboPumpRoutine.Start() == RState.Running;
  584. }
  585. private bool FnLaunchTurboPumpTimeout(object[] param)
  586. {
  587. RState ret = _startTurboPumpRoutine.Monitor();
  588. if (ret == RState.Failed || ret == RState.Timeout)
  589. {
  590. PostMsg(MSG.Error);
  591. return false;
  592. }
  593. return ret == RState.End;
  594. }
  595. private bool FnAbortStartTurboPumping(object[] param)
  596. {
  597. _startTurboPumpRoutine.Abort();
  598. return true;
  599. }
  600. private bool FnStartVent(object[] param)
  601. {
  602. return _ventRoutine.Start() == RState.Running;
  603. }
  604. private bool FnVentTimeout(object[] param)
  605. {
  606. RState ret = _ventRoutine.Monitor();
  607. if (ret == RState.Failed || ret == RState.Timeout)
  608. {
  609. PostMsg(MSG.Error);
  610. return false;
  611. }
  612. return ret == RState.End;
  613. }
  614. private bool FnVentToPumping(object[] param)
  615. {
  616. _ventRoutine.Abort();
  617. return true; // FnStartPumpDown(param);
  618. }
  619. private bool FnAbortVent(object[] param)
  620. {
  621. _ventRoutine.Abort();
  622. return true;
  623. }
  624. private bool FnStartPumpDown(object[] param)
  625. {
  626. return _pumpRoutine.Start() == RState.Running;
  627. }
  628. private bool FnPumpDownTimeout(object[] param)
  629. {
  630. RState ret = _pumpRoutine.Monitor();
  631. if (ret == RState.Failed || ret == RState.Timeout)
  632. {
  633. PostMsg(MSG.Error);
  634. return false;
  635. }
  636. return ret == RState.End;
  637. }
  638. private bool FnAbortPumping(object[] param)
  639. {
  640. _pumpRoutine.Abort();
  641. return true;
  642. }
  643. private bool FnStartVentLoadlock(object[] param)
  644. {
  645. return _ventLoadLockRoutine.Start() == RState.Running;
  646. }
  647. private bool FnVentLoadLockTimeout(object[] param)
  648. {
  649. RState ret = _ventLoadLockRoutine.Monitor();
  650. if (ret == RState.Failed || ret == RState.Timeout)
  651. {
  652. PostMsg(MSG.Error);
  653. return false;
  654. }
  655. return ret == RState.End;
  656. }
  657. private bool FnVentLoadLockToPumpingLoadLock(object[] param)
  658. {
  659. _ventLoadLockRoutine.Abort();
  660. return FnStartPumpDownLoadLock(param);
  661. }
  662. private bool FnAbortVentLoadLock(object[] param)
  663. {
  664. _ventLoadLockRoutine.Abort();
  665. return true;
  666. }
  667. private bool FnStartPumpDownLoadLock(object[] param)
  668. {
  669. return _pumpLoadLockRoutine.Start() == RState.Running;
  670. }
  671. private bool FnPumpDownLoadLockTimeout(object[] param)
  672. {
  673. RState ret = _pumpLoadLockRoutine.Monitor();
  674. if (ret == RState.Failed || ret == RState.Timeout)
  675. {
  676. PostMsg(MSG.Error);
  677. return false;
  678. }
  679. return ret == RState.End;
  680. }
  681. private bool FnPumpingToVent(object[] param)
  682. {
  683. _pumpRoutine.Abort();
  684. return FnStartVent(param);
  685. }
  686. private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  687. {
  688. _pumpLoadLockRoutine.Abort();
  689. return FnStartVentLoadlock(param);
  690. }
  691. private bool FnAbortPumpingLoadLock(object[] param)
  692. {
  693. _pumpLoadLockRoutine.Abort();
  694. return true;
  695. }
  696. private bool FnStartPurgeLoadlock(object[] param)
  697. {
  698. return _purgeLoadLockRoutine.Start() == RState.Running;
  699. }
  700. private bool FnPurgeLoadLockTimeout(object[] param)
  701. {
  702. RState ret = _purgeLoadLockRoutine.Monitor();
  703. if (ret == RState.Failed || ret == RState.Timeout)
  704. {
  705. PostMsg(MSG.Error);
  706. return false;
  707. }
  708. return ret == RState.End;
  709. }
  710. private bool FnAbortPurgeLoadLock(object[] param)
  711. {
  712. _purgeLoadLockRoutine.Abort();
  713. return true;
  714. }
  715. private bool FnStartLoadLockLeakCheck(object[] param)
  716. {
  717. return _loadLockLeakCheckRoutine.Start() == RState.Running;
  718. }
  719. private bool FnLoadLockLeakCheckTimeout(object[] param)
  720. {
  721. RState ret = _loadLockLeakCheckRoutine.Monitor();
  722. if (ret == RState.Failed || ret == RState.Timeout)
  723. {
  724. PostMsg(MSG.Error);
  725. return false;
  726. }
  727. return ret == RState.End;
  728. }
  729. private bool FnAbortLoadLockLeakCheck(object[] param)
  730. {
  731. _loadLockLeakCheckRoutine.Abort();
  732. return true;
  733. }
  734. private bool FnStartPurge(object[] param)
  735. {
  736. return _purgeRoutine.Start() == RState.Running;
  737. }
  738. private bool FnPurgeTimeout(object[] param)
  739. {
  740. RState ret = _purgeRoutine.Monitor();
  741. if (ret == RState.Failed || ret == RState.Timeout)
  742. {
  743. PostMsg(MSG.Error);
  744. return false;
  745. }
  746. return ret == RState.End;
  747. }
  748. private bool FnAbortPurge(object[] param)
  749. {
  750. _purgeRoutine.Abort();
  751. return true;
  752. }
  753. private bool FnStartGasLinePurge(object[] param)
  754. {
  755. return _gaslinePurgeRoutine.Start() == RState.Running;
  756. }
  757. private bool FnGasLinePurgeTimeout(object[] param)
  758. {
  759. RState ret = _gaslinePurgeRoutine.Monitor();
  760. if (ret == RState.Failed || ret == RState.Timeout)
  761. {
  762. PostMsg(MSG.Error);
  763. return false;
  764. }
  765. return ret == RState.End;
  766. }
  767. private bool FnAbortGasLinePurge(object[] param)
  768. {
  769. _gaslinePurgeRoutine.Abort();
  770. return true;
  771. }
  772. private bool FnStartPMLeakCheck(object[] param)
  773. {
  774. return _leakCheckRoutine.Start() == RState.Running;
  775. }
  776. private bool FnPMLeakCheckTimeout(object[] param)
  777. {
  778. RState ret = _leakCheckRoutine.Monitor();
  779. if (ret == RState.Failed || ret == RState.Timeout)
  780. {
  781. PostMsg(MSG.Error);
  782. return false;
  783. }
  784. return ret == RState.End;
  785. }
  786. private bool FnAbortPMLeakCheck(object[] param)
  787. {
  788. _leakCheckRoutine.Abort();
  789. return true;
  790. }
  791. private bool FnStartGasBoxLeakCheck(object[] param)
  792. {
  793. return _gasBoxLeakCheckRoutine.Start() == RState.Running;
  794. }
  795. private bool FnGasBoxLeakCheckTimeout(object[] param)
  796. {
  797. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  798. if (ret == RState.Failed || ret == RState.Timeout)
  799. {
  800. PostMsg(MSG.Error);
  801. return false;
  802. }
  803. return ret == RState.End;
  804. }
  805. private bool FnAbortGasBoxLeakCheck(object[] param)
  806. {
  807. _gasBoxLeakCheckRoutine.Abort();
  808. return true;
  809. }
  810. private bool FnStartLLPlace(object[] param)
  811. {
  812. return _llPlaceRoutine.Start() == RState.Running;
  813. }
  814. private bool FnLLPlaceTimeout(object[] param)
  815. {
  816. RState ret = _llPlaceRoutine.Monitor();
  817. if (ret == RState.Failed || ret == RState.Timeout)
  818. {
  819. PostMsg(MSG.Error);
  820. return false;
  821. }
  822. return ret == RState.End;
  823. }
  824. private bool FnAbortLLPlace(object[] param)
  825. {
  826. _llPlaceRoutine.Abort();
  827. return true;
  828. }
  829. private bool FnStartLLPick(object[] param)
  830. {
  831. return _llPickRoutine.Start() == RState.Running;
  832. }
  833. private bool FnLLPickTimeout(object[] param)
  834. {
  835. RState ret = _llPickRoutine.Monitor();
  836. if (ret == RState.Failed || ret == RState.Timeout)
  837. {
  838. PostMsg(MSG.Error);
  839. return false;
  840. }
  841. return ret == RState.End;
  842. }
  843. private bool FnAbortLLPick(object[] param)
  844. {
  845. _llPickRoutine.Abort();
  846. return true;
  847. }
  848. private bool FnRunRecipe(object[] param)
  849. {
  850. return _processRoutine.Start(param) == RState.Running;
  851. }
  852. private bool FnProcessTimeout(object[] param)
  853. {
  854. _chamber.CheckIdleInterlock();
  855. RState ret = _processRoutine.Monitor();
  856. if (ret == RState.Failed || ret == RState.Timeout)
  857. {
  858. PostMsg(MSG.Error);
  859. return false;
  860. }
  861. return ret == RState.End;
  862. }
  863. private bool FnAbortProcess(object[] param)
  864. {
  865. _processRoutine.Abort();
  866. return true;
  867. }
  868. private bool FnStartGasFlow(object[] param)
  869. {
  870. return _gasFlowRoutine.Start(param) == RState.Running;
  871. }
  872. private bool FnGasFlowTimeout(object[] param)
  873. {
  874. RState ret = _gasFlowRoutine.Monitor();
  875. if (ret == RState.Failed || ret == RState.Timeout)
  876. {
  877. PostMsg(MSG.Error);
  878. return false;
  879. }
  880. return ret == RState.End;
  881. }
  882. private bool FnStopGasFlow(object[] param)
  883. {
  884. _gasFlowRoutine.Abort();
  885. return true;
  886. }
  887. private bool FnAbortGasFlow(object[] param)
  888. {
  889. _gasFlowRoutine.Abort();
  890. return true;
  891. }
  892. private bool FnStartRfPower(object[] param)
  893. {
  894. return _rfPowerRoutine.Start(param) == RState.Running;
  895. }
  896. private bool FnRfPowerTimeout(object[] param)
  897. {
  898. RState ret = _rfPowerRoutine.Monitor();
  899. if (ret == RState.Failed || ret == RState.Timeout)
  900. {
  901. PostMsg(MSG.Error);
  902. return false;
  903. }
  904. return ret == RState.End;
  905. }
  906. private bool FnAbortRfPower(object[] param)
  907. {
  908. _rfPowerRoutine.Abort();
  909. if(_gasFlowRoutine._gasStatus)
  910. {
  911. _gasFlowRoutine.StopFlow();
  912. }
  913. return true;
  914. }
  915. private bool FnStartMFCVerification(object[] param)
  916. {
  917. _gasVerificationRoutine.Init((string)param[0], (double)param[1], (int)param[2]);
  918. return _gasVerificationRoutine.Start(param) == RState.Running;
  919. }
  920. private bool FnMFCVerificationTimeout(object[] param)
  921. {
  922. RState ret = _gasVerificationRoutine.Monitor();
  923. if (ret == RState.Failed || ret == RState.Timeout)
  924. {
  925. PostMsg(MSG.Error);
  926. return false;
  927. }
  928. return ret == RState.End;
  929. }
  930. private bool FnAbortMFCVerification(object[] param)
  931. {
  932. _gasVerificationRoutine.Abort();
  933. return true;
  934. }
  935. #region Exchange wafer with TM
  936. private bool FnStartPreparePick(object[] param)
  937. {
  938. if(!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
  939. {
  940. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  941. return false;
  942. }
  943. if(!_chamber.SetSlitDoor(true, out reason))
  944. {
  945. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  946. return false;
  947. }
  948. return true;
  949. }
  950. private bool FnPreparePickTimeout(object[] param)
  951. {
  952. return _chamber.LiftPinIsUp && IsSlitDoorOpen;
  953. }
  954. private bool FnAbortPreparePick(object[] param)
  955. {
  956. return true;
  957. }
  958. private bool FnStartFinishPick(object[] param)
  959. {
  960. if (!_chamber.SetSlitDoor(false, out string reason))
  961. {
  962. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  963. return false;
  964. }
  965. return true;
  966. }
  967. private bool FnAbortPick(object[] param)
  968. {
  969. return true;
  970. }
  971. private bool FnFinishPickTimeout(object[] param)
  972. {
  973. return IsSlitDoorClose;
  974. }
  975. private bool FnStartDropDownWafer(object[] param)
  976. {
  977. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  978. {
  979. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  980. return false;
  981. }
  982. return _chamber.SetLiftPin(MovementPosition.Down, out string _);
  983. }
  984. private bool FnDropDownTimeout(object[] param)
  985. {
  986. return _chamber.LiftPinIsDown;
  987. }
  988. private bool FnStartPreparePlace(object[] param)
  989. {
  990. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  991. {
  992. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  993. return false;
  994. }
  995. if (!_chamber.SetSlitDoor(true, out reason))
  996. {
  997. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
  998. return false;
  999. }
  1000. return true;
  1001. }
  1002. private bool FnPreparePlaceTimeout(object[] param)
  1003. {
  1004. return _chamber.LiftPinIsDown && IsSlitDoorOpen;
  1005. }
  1006. private bool FnAbortPreparePlace(object[] param)
  1007. {
  1008. return true;
  1009. }
  1010. private bool FnStartLiftUpWafer(object[] param)
  1011. {
  1012. if (!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
  1013. {
  1014. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  1015. return false;
  1016. }
  1017. return true;
  1018. }
  1019. private bool FnLiftUpTimeout(object[] param)
  1020. {
  1021. return _chamber.LiftPinIsUp;
  1022. }
  1023. private bool FnStartFinishPlace(object[] param)
  1024. {
  1025. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1026. {
  1027. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  1028. return false;
  1029. }
  1030. if (!_chamber.SetSlitDoor(false, out reason))
  1031. {
  1032. LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1033. return false;
  1034. }
  1035. return true;
  1036. }
  1037. private bool FnAortPlace(object[] param)
  1038. {
  1039. return true;
  1040. }
  1041. private bool FnFinishPlaceTimeout(object[] param)
  1042. {
  1043. return _chamber.LiftPinIsDown && IsSlitDoorClose;
  1044. }
  1045. private bool FnStartSwapPlace(object[] param)
  1046. {
  1047. return true;
  1048. }
  1049. #endregion
  1050. private void _debugRoutine()
  1051. {
  1052. int flag = 0;
  1053. // Test Home routine
  1054. if (flag == 1)
  1055. {
  1056. PostMsg(MSG.Home);
  1057. }
  1058. else if (flag == 2)
  1059. {
  1060. PostMsg(MSG.Vent);
  1061. }
  1062. else if (flag == 3)
  1063. {
  1064. PostMsg(MSG.Pump);
  1065. }
  1066. else if(flag == 4)
  1067. {
  1068. PostMsg(MSG.PumpLoadLock);
  1069. }
  1070. else if(flag == 5)
  1071. {
  1072. PostMsg(MSG.VentLoadLock);
  1073. }
  1074. else if(flag == 6)
  1075. {
  1076. PostMsg(MSG.PurgeLoadLock);
  1077. }
  1078. else if(flag == 7)
  1079. {
  1080. PostMsg(MSG.LaunchPump);
  1081. }
  1082. else if(flag == 8)
  1083. {
  1084. PostMsg(MSG.LaunchTurboPump);
  1085. }
  1086. else if(flag == 9)
  1087. {
  1088. PostMsg(MSG.LoadLockLeakCheck);
  1089. }
  1090. else if(flag == 10)
  1091. {
  1092. PostMsg(MSG.CyclePurge);
  1093. }
  1094. else if(flag == 11)
  1095. {
  1096. PostMsg(MSG.GasLinePurge);
  1097. }
  1098. else if(flag == 12)
  1099. {
  1100. PostMsg(MSG.LeakCheck);
  1101. }
  1102. else if(flag == 13)
  1103. {
  1104. PostMsg(MSG.GasLeakCheck);
  1105. }
  1106. else if(flag == 14)
  1107. {
  1108. PostMsg(MSG.LLPlace);
  1109. }
  1110. else if(flag == 15)
  1111. {
  1112. PostMsg(MSG.LLPick);
  1113. }
  1114. else if(flag == 16)
  1115. {
  1116. PostMsg(MSG.RunRecipe, "7777");
  1117. }
  1118. else if(flag == 17)
  1119. {
  1120. PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
  1121. }
  1122. }
  1123. }
  1124. }