TMEntity.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.RT.Fsm;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.Util;
  6. using Venus_Core;
  7. using Aitex.Sorter.Common;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using Venus_RT.Devices;
  11. using Venus_RT.Modules.TM;
  12. using Aitex.Core.RT.DataCenter;
  13. using Aitex.Core.RT.OperationCenter;
  14. using MECF.Framework.Common.Schedulers;
  15. using MECF.Framework.Common.CommonData;
  16. namespace Venus_RT.Modules
  17. {
  18. class TMEntity : Entity, IModuleEntity
  19. {
  20. public enum STATE
  21. {
  22. Unknown,
  23. Init,
  24. Initializing,
  25. Idle,
  26. Error,
  27. Pumping,
  28. Venting,
  29. Purging,
  30. Leakchecking,
  31. Picking,
  32. Placing,
  33. Swaping,
  34. PMPicking,
  35. PMPlacing,
  36. PMSwaping,
  37. Aligning,
  38. Mapping,
  39. Extending,
  40. Retracting,
  41. Swapping,
  42. Gotoing,
  43. }
  44. public enum MSG
  45. {
  46. Home,
  47. Online,
  48. Offline,
  49. Pump,
  50. Vent,
  51. Purge,
  52. CyclePurge,
  53. LeakCheck,
  54. Pick,
  55. Place,
  56. Swap,
  57. DoublePick,
  58. DoublePlace,
  59. DoubleSwap,
  60. PMPick,
  61. PMPlace,
  62. PMSwap,
  63. Extend,
  64. Retract,
  65. TMCycle,
  66. Error,
  67. Abort,
  68. }
  69. public bool IsIdle
  70. {
  71. get { return fsm.State == (int)STATE.Idle; }
  72. }
  73. public bool IsError
  74. {
  75. get { return fsm.State == (int)STATE.Error; }
  76. }
  77. public bool IsInit
  78. {
  79. get { return fsm.State == (int)STATE.Unknown || fsm.State == (int)STATE.Init; }
  80. }
  81. public bool IsBusy
  82. {
  83. get { return !IsInit && !IsError && !IsIdle; }
  84. }
  85. public bool IsLLSlitDoorClosed(ModuleName ll) => ll == ModuleName.LLA ? _tm.IsLLAESlitDoorClosed : _tm.IsLLBESlitDoorClosed;
  86. public bool IsLLSlitDoorOpen(ModuleName ll) => ll == ModuleName.LLA ? _tm.IsLLAESlitDoorOpen : _tm.IsLLBESlitDoorOpen;
  87. public bool IsOnline { get; internal set; }
  88. private readonly JetTM _tm;
  89. private readonly ITransferRobot _robot;
  90. private readonly MFHomeRoutine _homeRoutine;
  91. private readonly MFPumpRoutine _pumpingRoutine;
  92. private readonly MFVentRoutine _ventingRoutine;
  93. private readonly MFLeakCheckRoutine _leakCheckRoutine;
  94. private readonly MFPurgeRoutine _purgeRoutine;
  95. private readonly MFPickRoutine _pickRoutine;
  96. private readonly MFPlaceRoutine _placeRoutine;
  97. private readonly MFSwapRoutine _swapRoutine;
  98. private readonly MFPMPickRoutine _pmPickRoutine;
  99. private readonly MFPMPlaceRoutine _pmPlaceRoutine;
  100. private readonly MFPMSwapRoutine _pmSwapRoutine;
  101. private readonly MFPMRetractRoutine _pmRetractRoutine;
  102. private readonly MFPMExtendRoutine _pmExtendRoutine;
  103. public TMEntity()
  104. {
  105. _tm = Singleton<JetTM>.Instance;
  106. _robot = new SIASUNRobot();
  107. _homeRoutine = new MFHomeRoutine(_tm, _robot);
  108. _pickRoutine = new MFPickRoutine(_tm, _robot);
  109. _placeRoutine = new MFPlaceRoutine(_tm, _robot);
  110. _swapRoutine = new MFSwapRoutine(_tm, _robot);
  111. _pmPickRoutine = new MFPMPickRoutine(_tm, _robot);
  112. _pmPlaceRoutine = new MFPMPlaceRoutine(_tm, _robot);
  113. _pmSwapRoutine = new MFPMSwapRoutine(_tm, _robot);
  114. _pumpingRoutine = new MFPumpRoutine(_tm, ModuleName.TM);
  115. _ventingRoutine = new MFVentRoutine(_tm, ModuleName.TM);
  116. _leakCheckRoutine = new MFLeakCheckRoutine(_tm, ModuleName.TM);
  117. _purgeRoutine = new MFPurgeRoutine(_tm, ModuleName.TM);
  118. _pmRetractRoutine = new MFPMRetractRoutine(_tm, _robot);
  119. _pmExtendRoutine = new MFPMExtendRoutine(_tm, _robot);
  120. WaferManager.Instance.SubscribeLocation(ModuleName.TM, 2);
  121. InitFsmMap();
  122. }
  123. protected override bool Init()
  124. {
  125. OP.Subscribe("TM.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  126. OP.Subscribe($"TM.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.Pick, args));
  127. OP.Subscribe($"TM.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.Place, args));
  128. OP.Subscribe($"TM.{RtOperation.PMPick}", (cmd, args) => CheckToPostMessage((int)MSG.PMPick, args));
  129. OP.Subscribe($"TM.{RtOperation.PMPlace}", (cmd, args) => CheckToPostMessage((int)MSG.PMPlace, args));
  130. OP.Subscribe($"TM.{RtOperation.Extend}", (cmd, args) => CheckToPostMessage((int)MSG.Extend, args));
  131. OP.Subscribe($"TM.{RtOperation.Retract}", (cmd, args) => CheckToPostMessage((int)MSG.Retract, args));
  132. OP.Subscribe($"TM.{RtOperation.Cycle}", (cmd, args) => CheckToPostMessage((int)MSG.Swap, args));
  133. //OP.Subscribe($"TM.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.Place, args));
  134. OP.Subscribe($"TM.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  135. OP.Subscribe($"TM.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  136. OP.Subscribe($"TM.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck));
  137. OP.Subscribe($"TM.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.Purge));
  138. OP.Subscribe($"TM.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  139. DATA.Subscribe("TM.FsmState", () => (((STATE)fsm.State).ToString()));
  140. DATA.Subscribe("TM.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()));
  141. DATA.Subscribe("TM.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()));
  142. DATA.Subscribe("TM.RobotMoveAction", () => _robot.TMRobotMoveInfo);
  143. DATA.Subscribe("TM.RobotMoveAction.ArmTarget", () => _robot.TMRobotMoveInfo.ArmTarget.ToString()) ;
  144. DATA.Subscribe("TM.RobotMoveAction.BladeTarget", () => _robot.TMRobotMoveInfo.BladeTarget);
  145. DATA.Subscribe("TM.RobotMoveAction.RobotAction", () => _robot.TMRobotMoveInfo.Action.ToString());
  146. return true;
  147. }
  148. private void InitFsmMap()
  149. {
  150. fsm = new StateMachine<TMEntity>("TM", (int)STATE.Init, 50);
  151. //AnyStateTransition(FSM_MSG.TIMER, fnMonitor, FSM_STATE.SAME);
  152. AnyStateTransition(MSG.Error, fnError, STATE.Error);
  153. AnyStateTransition(MSG.Online, fnOnline, FSM_STATE.SAME);
  154. AnyStateTransition(MSG.Offline, fnOffline, FSM_STATE.SAME);
  155. AnyStateTransition(MSG.Home, fnHome, STATE.Initializing);
  156. // Home
  157. Transition(STATE.Initializing, FSM_MSG.TIMER, fnHoming, STATE.Idle);
  158. Transition(STATE.Idle, FSM_MSG.TIMER, fnMonitor, STATE.Idle);
  159. Transition(STATE.Init, FSM_MSG.TIMER, fnMonitor, STATE.Init);
  160. // Vent sequence
  161. Transition(STATE.Idle, MSG.Vent, FnStartVent, STATE.Venting);
  162. Transition(STATE.Venting, FSM_MSG.TIMER, FnVentTimeout, STATE.Idle);
  163. Transition(STATE.Venting, MSG.Abort, FnAbortVent, STATE.Idle);
  164. // Pump sequence
  165. Transition(STATE.Idle, MSG.Pump, FnStartPump, STATE.Pumping);
  166. Transition(STATE.Pumping, FSM_MSG.TIMER, FnPumpTimeout, STATE.Idle);
  167. Transition(STATE.Pumping, MSG.Abort, FnAbortPump, STATE.Idle);
  168. // Purge sequence
  169. Transition(STATE.Idle, MSG.CyclePurge, FnStartPurge, STATE.Purging);
  170. Transition(STATE.Purging, FSM_MSG.TIMER, FnPurgeTimeout, STATE.Idle);
  171. Transition(STATE.Purging, MSG.Abort, FnAbortPurge, STATE.Idle);
  172. // Leak check sequence
  173. Transition(STATE.Idle, MSG.LeakCheck, FnStartLeakCheck, STATE.Leakchecking);
  174. Transition(STATE.Leakchecking, FSM_MSG.TIMER, FnLeakCheckTimeout, STATE.Idle);
  175. Transition(STATE.Leakchecking, MSG.Abort, FnAbortLeakCheck, STATE.Idle);
  176. // Pick wafer from LL sequence
  177. Transition(STATE.Idle, MSG.Pick, FnStartPick, STATE.Picking);
  178. Transition(STATE.Picking, FSM_MSG.TIMER, FnPickTimeout, STATE.Idle);
  179. Transition(STATE.Picking, MSG.Abort, FnAbortPick, STATE.Idle);
  180. // Place wafer to LL sequence
  181. Transition(STATE.Idle, MSG.Place, FnStartPlace, STATE.Placing);
  182. Transition(STATE.Placing, FSM_MSG.TIMER, FnPlaceTimeout, STATE.Idle);
  183. Transition(STATE.Placing, MSG.Abort, FnAbortPlace, STATE.Idle);
  184. // Swap wafer with LL sequence
  185. Transition(STATE.Idle, MSG.Swap, FnStartSwap, STATE.Swaping);
  186. Transition(STATE.Swaping, FSM_MSG.TIMER, FnSwapTimeout, STATE.Idle);
  187. Transition(STATE.Swaping, MSG.Abort, FnAbortSwap, STATE.Idle);
  188. // Pick wafer from PM sequence
  189. Transition(STATE.Idle, MSG.PMPick, FnStartPMPick, STATE.PMPicking);
  190. Transition(STATE.PMPicking, FSM_MSG.TIMER, FnPMPickTimeout, STATE.Idle);
  191. Transition(STATE.PMPicking, MSG.Abort, FnAbortPMPick, STATE.Idle);
  192. // Place wafer to PM sequence
  193. Transition(STATE.Idle, MSG.PMPlace, FnStartPMPlace, STATE.PMPlacing);
  194. Transition(STATE.PMPlacing, FSM_MSG.TIMER, FnPMPlaceTimeout, STATE.Idle);
  195. Transition(STATE.PMPlacing, MSG.Abort, FnAbortPMPlace, STATE.Idle);
  196. // Swap wafer with PM sequence
  197. Transition(STATE.Idle, MSG.PMSwap, FnStartPMSwap, STATE.PMSwaping);
  198. Transition(STATE.PMSwaping, FSM_MSG.TIMER, FnPMSwapTimeout, STATE.Idle);
  199. Transition(STATE.PMSwaping, MSG.Abort, FnAbortPMSwap, STATE.Idle);
  200. //Retract
  201. Transition(STATE.Idle, MSG.Retract, FnStartRetract, STATE.Retracting);
  202. Transition(STATE.Retracting, FSM_MSG.TIMER, FnRetract, STATE.Idle);
  203. Transition(STATE.Retracting, MSG.Abort, FnAbortRetract, STATE.Idle);
  204. //Extend
  205. Transition(STATE.Idle, MSG.Extend, FnStartExtend, STATE.Extending);
  206. Transition(STATE.Extending, FSM_MSG.TIMER, FnExtend, STATE.Idle);
  207. Transition(STATE.Extending, MSG.Abort, FnAbortExtend, STATE.Idle);
  208. //Transition(RtState.Init, MSG.TMCycle, FsmStartTMCycle, RtState.TMCycle);
  209. //Transition(RtState.TMCycle, FSM_MSG.TIMER, FsmMonitorTMCycle, RtState.Idle);
  210. Running = true;
  211. }
  212. private bool fnMonitor(object[] param)
  213. {
  214. _debugRoutine();
  215. return true;
  216. }
  217. private bool fnError(object[] param)
  218. {
  219. IsOnline = false;
  220. return true;
  221. }
  222. private bool fnOnline(object[] param)
  223. {
  224. return true;
  225. }
  226. private bool fnOffline(object[] param)
  227. {
  228. IsOnline = false;
  229. return true;
  230. }
  231. private bool fnAbort(object[] param)
  232. {
  233. _robot.Halt();
  234. return true;
  235. }
  236. private bool fnHome(object[] param)
  237. {
  238. return _homeRoutine.Start() == RState.Running;
  239. }
  240. private bool fnHoming(object[] param)
  241. {
  242. RState ret = _homeRoutine.Monitor();
  243. if (ret == RState.Failed || ret == RState.Timeout)
  244. {
  245. PostMsg(MSG.Error);
  246. return false;
  247. }
  248. return ret == RState.End;
  249. }
  250. private bool FnStartVent(object[] param)
  251. {
  252. return _ventingRoutine.Start() == RState.Running ;
  253. }
  254. private bool FnVentTimeout(object[] param)
  255. {
  256. RState ret = _ventingRoutine.Monitor();
  257. if (ret == RState.Failed || ret == RState.Timeout)
  258. {
  259. _ventingRoutine.Abort();
  260. PostMsg(MSG.Error);
  261. return false;
  262. }
  263. return ret == RState.End;
  264. }
  265. private bool FnAbortVent(object[] param)
  266. {
  267. _ventingRoutine.Abort();
  268. return true;
  269. }
  270. private bool FnStartPump(object[] param)
  271. {
  272. return _pumpingRoutine.Start() == RState.Running;
  273. }
  274. private bool FnPumpTimeout(object[] param)
  275. {
  276. RState ret = _pumpingRoutine.Monitor();
  277. if (ret == RState.Failed || ret == RState.Timeout)
  278. {
  279. _pumpingRoutine.Abort();
  280. PostMsg(MSG.Error);
  281. return false;
  282. }
  283. return ret == RState.End;
  284. }
  285. private bool FnAbortPump(object[] param)
  286. {
  287. _pumpingRoutine.Abort();
  288. return true;
  289. }
  290. private bool FnStartPurge(object[] param)
  291. {
  292. return _purgeRoutine.Start() == RState.Running;
  293. }
  294. private bool FnPurgeTimeout(object[] param)
  295. {
  296. RState ret = _purgeRoutine.Monitor();
  297. if (ret == RState.Failed || ret == RState.Timeout)
  298. {
  299. PostMsg(MSG.Error);
  300. return false;
  301. }
  302. return ret == RState.End;
  303. }
  304. private bool FnAbortPurge(object[] param)
  305. {
  306. _purgeRoutine.Abort();
  307. return true;
  308. }
  309. private bool FnStartLeakCheck(object[] param)
  310. {
  311. return _leakCheckRoutine.Start() == RState.Running;
  312. }
  313. private bool FnLeakCheckTimeout(object[] param)
  314. {
  315. RState ret = _leakCheckRoutine.Monitor();
  316. if (ret == RState.Failed || ret == RState.Timeout)
  317. {
  318. PostMsg(MSG.Error);
  319. return false;
  320. }
  321. return ret == RState.End;
  322. }
  323. private bool FnAbortLeakCheck(object[] param)
  324. {
  325. _leakCheckRoutine.Abort();
  326. return true;
  327. }
  328. private bool FnStartPick(object[] param)
  329. {
  330. return _pickRoutine.Start(param) == RState.Running;
  331. }
  332. private bool FnPickTimeout(object[] param)
  333. {
  334. RState ret = _pickRoutine.Monitor();
  335. if (ret == RState.Failed || ret == RState.Timeout)
  336. {
  337. PostMsg(MSG.Error);
  338. return false;
  339. }
  340. return ret == RState.End;
  341. }
  342. private bool FnAbortPick(object[] param)
  343. {
  344. _pickRoutine.Abort();
  345. return true;
  346. }
  347. private bool FnStartPlace(object[] param)
  348. {
  349. return _placeRoutine.Start(param) == RState.Running;
  350. }
  351. private bool FnPlaceTimeout(object[] param)
  352. {
  353. RState ret = _placeRoutine.Monitor();
  354. if (ret == RState.Failed || ret == RState.Timeout)
  355. {
  356. PostMsg(MSG.Error);
  357. return false;
  358. }
  359. return ret == RState.End;
  360. }
  361. private bool FnAbortPlace(object[] param)
  362. {
  363. _placeRoutine.Abort();
  364. return true;
  365. }
  366. private bool FnStartSwap(object[] param)
  367. {
  368. return _swapRoutine.Start(param) == RState.Running;
  369. }
  370. private bool FnSwapTimeout(object[] param)
  371. {
  372. RState ret = _swapRoutine.Monitor();
  373. if (ret == RState.Failed || ret == RState.Timeout)
  374. {
  375. PostMsg(MSG.Error);
  376. return false;
  377. }
  378. return ret == RState.End;
  379. }
  380. private bool FnAbortSwap(object[] param)
  381. {
  382. _swapRoutine.Abort();
  383. return true;
  384. }
  385. private bool FnStartPMPick(object[] param)
  386. {
  387. return _pmPickRoutine.Start(param) == RState.Running;
  388. }
  389. private bool FnPMPickTimeout(object[] param)
  390. {
  391. RState ret = _pmPickRoutine.Monitor();
  392. if (ret == RState.Failed || ret == RState.Timeout)
  393. {
  394. PostMsg(MSG.Error);
  395. return false;
  396. }
  397. return ret == RState.End;
  398. }
  399. private bool FnAbortPMPick(object[] param)
  400. {
  401. _pmPickRoutine.Abort();
  402. return true;
  403. }
  404. private bool FnStartPMPlace(object[] param)
  405. {
  406. return _pmPlaceRoutine.Start(param) == RState.Running;
  407. }
  408. private bool FnPMPlaceTimeout(object[] param)
  409. {
  410. RState ret = _pmPlaceRoutine.Monitor();
  411. if (ret == RState.Failed || ret == RState.Timeout)
  412. {
  413. PostMsg(MSG.Error);
  414. return false;
  415. }
  416. return ret == RState.End;
  417. }
  418. private bool FnAbortPMPlace(object[] param)
  419. {
  420. _pmPlaceRoutine.Abort();
  421. return true;
  422. }
  423. private bool FnStartPMSwap(object[] param)
  424. {
  425. return _pmSwapRoutine.Start(param) == RState.Running;
  426. }
  427. private bool FnPMSwapTimeout(object[] param)
  428. {
  429. RState ret = _pmSwapRoutine.Monitor();
  430. if (ret == RState.Failed || ret == RState.Timeout)
  431. {
  432. PostMsg(MSG.Error);
  433. return false;
  434. }
  435. return ret == RState.End;
  436. }
  437. private bool FnAbortPMSwap(object[] param)
  438. {
  439. _pmSwapRoutine.Abort();
  440. return true;
  441. }
  442. private bool FnStartRetract(object[] param)
  443. {
  444. return _pmRetractRoutine.Start(param) == RState.Running;
  445. }
  446. private bool FnRetract(object[] param)
  447. {
  448. RState ret = _pmRetractRoutine.Monitor();
  449. if (ret == RState.Failed || ret == RState.Timeout)
  450. {
  451. PostMsg(MSG.Error);
  452. return false;
  453. }
  454. return ret == RState.End;
  455. }
  456. private bool FnAbortRetract(object[] param)
  457. {
  458. _pmRetractRoutine.Abort();
  459. return true;
  460. }
  461. private bool FnStartExtend(object[] param)
  462. {
  463. return _pmExtendRoutine.Start(param) == RState.Running;
  464. }
  465. private bool FnExtend(object[] param)
  466. {
  467. RState ret = _pmExtendRoutine.Monitor();
  468. if (ret == RState.Failed || ret == RState.Timeout)
  469. {
  470. PostMsg(MSG.Error);
  471. return false;
  472. }
  473. return ret == RState.End;
  474. }
  475. private bool FnAbortExtend(object[] param)
  476. {
  477. _pmExtendRoutine.Abort();
  478. return true;
  479. }
  480. public bool Check(int msg, out string reason, params object[] args)
  481. {
  482. reason = "";
  483. return true;
  484. }
  485. public int Invoke(string function, params object[] args)
  486. {
  487. switch (function)
  488. {
  489. case "Home":
  490. CheckToPostMessage((int)MSG.Home);
  491. return (int)MSG.Home;
  492. }
  493. return (int)FSM_MSG.NONE;
  494. }
  495. public bool CheckAcked(int msg)
  496. {
  497. return fsm.CheckExecuted(msg);
  498. }
  499. public bool CheckToPostMessage(int msg, params object[] args)
  500. {
  501. if (!fsm.FindTransition(fsm.State, msg))
  502. {
  503. LOG.Write(eEvent.WARN_FSM_WARN, ModuleName.TM, $"TM is in {(STATE)fsm.State} state,can not do {(MSG)msg}");
  504. return false;
  505. }
  506. Running = true;
  507. fsm.PostMsg(msg, args);
  508. return true;
  509. }
  510. public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason)
  511. {
  512. return _tm.TurnEFEMSlitDoor(loadlock, open, out reason);
  513. }
  514. //private bool FsmStartTMCycle(object[] objs)
  515. //{
  516. // return _TMCycle.Start(objs) == RState.Running;
  517. //}
  518. //private bool FsmMonitorTMCycle(object[] objs)
  519. //{
  520. // RState ret = _TMCycle.Monitor();
  521. // if (ret == RState.Failed || ret == RState.Timeout)
  522. // {
  523. // PostMsg(MSG.Error);
  524. // return false;
  525. // }
  526. // return ret == RState.End;
  527. //}
  528. private void _debugRoutine()
  529. {
  530. int flag = 0;
  531. // Test Home routine
  532. if (flag == 1)
  533. {
  534. PostMsg(MSG.Home);
  535. }
  536. else if (flag == 2)
  537. {
  538. PostMsg(MSG.Vent);
  539. }
  540. else if (flag == 3)
  541. {
  542. PostMsg(MSG.Pump);
  543. }
  544. else if(flag == 4)
  545. {
  546. PostMsg(MSG.Pick, ModuleName.LLA, 0, 0);
  547. }
  548. else if(flag == 5)
  549. {
  550. PostMsg(MSG.Place, ModuleName.LLA, 0, 0);
  551. }
  552. else if(flag == 6)
  553. {
  554. Queue<MoveItem> items = new Queue<MoveItem>();
  555. items.Enqueue(new MoveItem(ModuleName.TM, 0, ModuleName.LLA, 0, Hand.Blade1));
  556. items.Enqueue(new MoveItem(ModuleName.TM, 1, ModuleName.LLA, 1, Hand.Blade2));
  557. items.Enqueue(new MoveItem(ModuleName.LLA, 0, ModuleName.TM, 0, Hand.Blade1));
  558. items.Enqueue(new MoveItem(ModuleName.LLA, 1, ModuleName.TM, 1, Hand.Blade2));
  559. PostMsg(MSG.Swap,items);
  560. }
  561. else if(flag == 7)
  562. {
  563. PostMsg(MSG.PMPick, ModuleName.PMA, 0, 0);
  564. }
  565. else if(flag == 8)
  566. {
  567. PostMsg(MSG.PMPlace, ModuleName.PMA, 0, 0);
  568. }
  569. else if(flag == 9)
  570. {
  571. PostMsg(MSG.PMSwap, ModuleName.PMA, 0, 0, 0, 0);
  572. }
  573. //else if (flag == 4)
  574. //{
  575. // PostMsg(MSG.PumpLoadLock);
  576. //}
  577. //else if (flag == 5)
  578. //{
  579. // PostMsg(MSG.VentLoadLock);
  580. //}
  581. //else if (flag == 6)
  582. //{
  583. // PostMsg(MSG.PurgeLoadLock);
  584. //}
  585. //else if (flag == 7)
  586. //{
  587. // PostMsg(MSG.LaunchPump);
  588. //}
  589. //else if (flag == 8)
  590. //{
  591. // PostMsg(MSG.LaunchTurboPump);
  592. //}
  593. //else if (flag == 9)
  594. //{
  595. // PostMsg(MSG.LoadLockLeakCheck);
  596. //}
  597. //else if (flag == 10)
  598. //{
  599. // PostMsg(MSG.CyclePurge);
  600. //}
  601. //else if (flag == 11)
  602. //{
  603. // PostMsg(MSG.GasLinePurge);
  604. //}
  605. //else if (flag == 12)
  606. //{
  607. // PostMsg(MSG.LeakCheck);
  608. //}
  609. //else if (flag == 13)
  610. //{
  611. // PostMsg(MSG.GasLeakCheck);
  612. //}
  613. //else if (flag == 14)
  614. //{
  615. // PostMsg(MSG.LLPlace);
  616. //}
  617. //else if (flag == 15)
  618. //{
  619. // PostMsg(MSG.LLPick);
  620. //}
  621. //else if (flag == 16)
  622. //{
  623. // PostMsg(MSG.RunRecipe, "7777");
  624. //}
  625. //else if (flag == 17)
  626. //{
  627. // PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
  628. //}
  629. }
  630. }
  631. }