TMEntity.cs 24 KB

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