PMEntity.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  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. namespace Venus_RT.Modules.PMs
  26. {
  27. public class RecipeRunningInfo
  28. {
  29. public Guid InnerId { get; set; }
  30. public RecipeHead Head { get; set; }
  31. public List<RecipeStep> RecipeStepList { get; set; }
  32. public string RecipeName { get; set; }
  33. public DateTime BeginTime { get; set; }
  34. public DateTime EndTime { get; set; }
  35. public int StepNumber { get; set; }
  36. public string StepName { get; set; }
  37. public double StepTime { get; set; }
  38. public double StepElapseTime { get; set; }
  39. public double TotalTime { get; set; }
  40. public double TotalElapseTime { get; set; }
  41. }
  42. public class PMEntity : Entity, IModuleEntity
  43. {
  44. public enum MSG
  45. {
  46. Home,
  47. Transfer,
  48. PrepareTransfer,
  49. PostTransfer,
  50. Reset,
  51. Abort,
  52. Error,
  53. LaunchPump,
  54. LaunchTurboPump,
  55. Pump,
  56. Vent,
  57. PumpLoadLock,
  58. VentLoadLock,
  59. PurgeLoadLock,
  60. LoadLockLeakCheck,
  61. CyclePurge,
  62. GasLinePurge,
  63. Heat,
  64. TransferHandoff,
  65. StartTransfer,
  66. LeakCheck,
  67. GasLeakCheck,
  68. MoveLiftPin,
  69. MoveGuidePin,
  70. LLPlace,
  71. LLPick,
  72. Process,
  73. RunRecipe,
  74. PostProcess,
  75. RecipeSkipStep,
  76. RecipeUpdate,
  77. RecipeResume,
  78. RecipePause,
  79. RecipeAbort,
  80. PreProcess,
  81. AutoMode,
  82. ManualMode,
  83. LockLid,
  84. Online,
  85. Offline,
  86. GasFlow,
  87. StopGasFlow,
  88. RfPower,
  89. MaxMsg
  90. }
  91. private readonly JetPM _chamber;
  92. public ModuleName Module { get; }
  93. public Action<bool, bool> TransferPrepared;
  94. private readonly PMHomeRoutine _home;
  95. private readonly StartDryPumpRoutine _startDryPumpRoutine;
  96. private readonly StartTurboPumpRoutine _startTurboPumpRoutine;
  97. private readonly VentRoutine _ventRoutine;
  98. private readonly PumpDownRoutine _pumpRoutine;
  99. private readonly LoadLockVentRoutine _ventLoadLockRoutine;
  100. private readonly LoadLockPumpRoutine _pumpLoadLockRoutine;
  101. private readonly LoadLockPurgeRoutine _purgeLoadLockRoutine;
  102. private readonly LoadLockLeakCheckRoutine _loadLockLeakCheckRoutine;
  103. private readonly PMPurgeRoutine _purgeRoutine;
  104. private readonly PMGaslinePurgeRoutine _gaslinePurgeRoutine;
  105. private readonly PMLeakCheckRoutine _leakCheckRoutine;
  106. private readonly GasBoxLeakCheckRoutine _gasBoxLeakCheckRoutine;
  107. private readonly LLPlaceRoutine _llPlaceRoutine;
  108. private readonly LLPickRoutine _llPickRoutine;
  109. public bool IsIdle
  110. {
  111. get { return fsm.State == (int)PMState.Idle; }
  112. }
  113. public bool IsError
  114. {
  115. get { return fsm.State == (int)PMState.Error; }
  116. }
  117. public bool IsInit
  118. {
  119. get { return fsm.State == (int)PMState.Init; }
  120. }
  121. public bool IsBusy
  122. {
  123. get { return !IsInit && !IsError && !IsIdle; }
  124. }
  125. public bool IsProcessing
  126. {
  127. get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
  128. }
  129. public bool Check(int msg, out string reason, object[] objs)
  130. {
  131. reason = "";
  132. return true;
  133. }
  134. //
  135. private bool CheckToPostMessage(int msg, params object[] args)
  136. {
  137. if (!fsm.FindTransition(fsm.State, msg))
  138. {
  139. EV.PostWarningLog(Module.ToString(), $"{Module} is in { (PMState)fsm.State} state,can not do {(MSG)msg}");
  140. return false;
  141. }
  142. fsm.PostMsg(msg, args);
  143. return true;
  144. }
  145. public int Invoke(string function, params object[] args)
  146. {
  147. switch (function)
  148. {
  149. case "Home":
  150. CheckToPostMessage((int)MSG.Home);
  151. return (int)MSG.Home;
  152. }
  153. return (int)FSM_MSG.NONE;
  154. }
  155. public bool CheckAcked(int msg)
  156. {
  157. return fsm.CheckExecuted(msg);
  158. }
  159. public PMEntity(ModuleName module)
  160. {
  161. Module = module;
  162. _chamber = DEVICE.GetDevice<JetPM>(Module.ToString());
  163. _home = new PMHomeRoutine(_chamber);
  164. _startDryPumpRoutine = new StartDryPumpRoutine(_chamber);
  165. _startTurboPumpRoutine = new StartTurboPumpRoutine(_chamber);
  166. _ventRoutine = new VentRoutine(_chamber);
  167. _pumpRoutine = new PumpDownRoutine(_chamber);
  168. _ventLoadLockRoutine = new LoadLockVentRoutine(_chamber);
  169. _pumpLoadLockRoutine = new LoadLockPumpRoutine(_chamber);
  170. _purgeLoadLockRoutine = new LoadLockPurgeRoutine(_chamber);
  171. _loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
  172. _purgeRoutine = new PMPurgeRoutine(_chamber);
  173. _gaslinePurgeRoutine = new PMGaslinePurgeRoutine(_chamber);
  174. _leakCheckRoutine = new PMLeakCheckRoutine(_chamber);
  175. _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
  176. _llPlaceRoutine = new LLPlaceRoutine(_chamber);
  177. _llPickRoutine = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
  178. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  179. //Idle
  180. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  181. EnterExitTransition<PMState, FSM_MSG>(PMState.Error, fEnterError, FSM_MSG.NONE, null);
  182. //Home
  183. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  184. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  185. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  186. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  187. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  188. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  189. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  190. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  191. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  192. //Launch DryPump sequence
  193. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  194. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  195. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  196. //Launch TurboPump sequence
  197. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  198. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  199. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  200. //vent sequence
  201. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  202. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  203. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  204. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  205. //Pump sequence
  206. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  207. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  208. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  209. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  210. //Pump Loadlock sequence
  211. Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  212. Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  213. Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  214. Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  215. //Vent Loadlock sequence
  216. Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  217. Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  218. Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  219. Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  220. // Purge LoadLock sequence
  221. Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  222. Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  223. Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  224. //LoadLock Leak check sequence
  225. Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  226. Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  227. Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  228. // PM Purge sequence
  229. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  230. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  231. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  232. // PM GasLine Purge sequence
  233. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  234. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  235. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  236. //PM Leak check sequence
  237. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  238. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  239. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  240. //PM Leak check sequence
  241. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  242. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  243. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  244. // PlaceWafer from LoadLock Arm sequence
  245. Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  246. Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  247. Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  248. // PickWafer to LoadLock Arm sequence
  249. Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  250. Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  251. Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  252. Running = true;
  253. }
  254. private bool FnIdle(object[] objs)
  255. {
  256. Running = false;
  257. return true;
  258. }
  259. private bool fEnterError(object[] objs)
  260. {
  261. return true;
  262. }
  263. private bool FnError(object[] objs)
  264. {
  265. Running = false;
  266. if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  267. || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  268. return false;
  269. if (IsProcessing)
  270. {
  271. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  272. }
  273. return true;
  274. }
  275. private bool FnTimeout(object[] objs)
  276. {
  277. _debugRoutine();
  278. return true;
  279. }
  280. private bool FnIdleTimeout(object[] objs)
  281. {
  282. _debugRoutine();
  283. return true;
  284. }
  285. private bool FnErrorTimeout(object[] objs)
  286. {
  287. _debugRoutine();
  288. return true;
  289. }
  290. private bool FnStartHome(object[] objs)
  291. {
  292. return _home.Start() == RState.Running;
  293. }
  294. private bool FnMonitorHome(object[] objs)
  295. {
  296. RState ret = _home.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 FnLaunchPump(object[] param)
  305. {
  306. return _startDryPumpRoutine.Start() == RState.Running;
  307. }
  308. private bool FnLaunchPumpTimeout(object[] param)
  309. {
  310. RState ret = _startDryPumpRoutine.Monitor();
  311. if (ret == RState.Failed || ret == RState.Timeout)
  312. {
  313. PostMsg(MSG.Error);
  314. return false;
  315. }
  316. return ret == RState.End;
  317. }
  318. private bool FnAbortStartPumping(object[] param)
  319. {
  320. _startDryPumpRoutine.Abort();
  321. return true;
  322. }
  323. private bool FnLaunchTurboPump(object[] param)
  324. {
  325. return _startTurboPumpRoutine.Start() == RState.Running;
  326. }
  327. private bool FnLaunchTurboPumpTimeout(object[] param)
  328. {
  329. RState ret = _startTurboPumpRoutine.Monitor();
  330. if (ret == RState.Failed || ret == RState.Timeout)
  331. {
  332. PostMsg(MSG.Error);
  333. return false;
  334. }
  335. return ret == RState.End;
  336. }
  337. private bool FnAbortStartTurboPumping(object[] param)
  338. {
  339. _startTurboPumpRoutine.Abort();
  340. return true;
  341. }
  342. private bool FnStartVent(object[] param)
  343. {
  344. return _ventRoutine.Start() == RState.Running;
  345. }
  346. private bool FnVentTimeout(object[] param)
  347. {
  348. RState ret = _ventRoutine.Monitor();
  349. if (ret == RState.Failed || ret == RState.Timeout)
  350. {
  351. PostMsg(MSG.Error);
  352. return false;
  353. }
  354. return ret == RState.End;
  355. }
  356. private bool FnVentToPumping(object[] param)
  357. {
  358. _ventRoutine.Abort();
  359. return true; // FnStartPumpDown(param);
  360. }
  361. private bool FnAbortVent(object[] param)
  362. {
  363. _ventRoutine.Abort();
  364. return true;
  365. }
  366. private bool FnStartPumpDown(object[] param)
  367. {
  368. return _pumpRoutine.Start() == RState.Running;
  369. }
  370. private bool FnPumpDownTimeout(object[] param)
  371. {
  372. RState ret = _pumpRoutine.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 FnAbortPumping(object[] param)
  381. {
  382. _pumpRoutine.Abort();
  383. return true;
  384. }
  385. private bool FnStartVentLoadlock(object[] param)
  386. {
  387. return _ventLoadLockRoutine.Start() == RState.Running;
  388. }
  389. private bool FnVentLoadLockTimeout(object[] param)
  390. {
  391. RState ret = _ventLoadLockRoutine.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 FnVentLoadLockToPumpingLoadLock(object[] param)
  400. {
  401. _ventLoadLockRoutine.Abort();
  402. return FnStartPumpDownLoadLock(param);
  403. }
  404. private bool FnAbortVentLoadLock(object[] param)
  405. {
  406. _ventLoadLockRoutine.Abort();
  407. return true;
  408. }
  409. private bool FnStartPumpDownLoadLock(object[] param)
  410. {
  411. return _pumpLoadLockRoutine.Start() == RState.Running;
  412. }
  413. private bool FnPumpDownLoadLockTimeout(object[] param)
  414. {
  415. RState ret = _pumpLoadLockRoutine.Monitor();
  416. if (ret == RState.Failed || ret == RState.Timeout)
  417. {
  418. PostMsg(MSG.Error);
  419. return false;
  420. }
  421. return ret == RState.End;
  422. }
  423. private bool FnPumpingToVent(object[] param)
  424. {
  425. _pumpRoutine.Abort();
  426. return FnStartVent(param);
  427. }
  428. private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  429. {
  430. _pumpLoadLockRoutine.Abort();
  431. return FnStartVentLoadlock(param);
  432. }
  433. private bool FnAbortPumpingLoadLock(object[] param)
  434. {
  435. _pumpLoadLockRoutine.Abort();
  436. return true;
  437. }
  438. private bool FnStartPurgeLoadlock(object[] param)
  439. {
  440. return _purgeLoadLockRoutine.Start() == RState.Running;
  441. }
  442. private bool FnPurgeLoadLockTimeout(object[] param)
  443. {
  444. RState ret = _purgeLoadLockRoutine.Monitor();
  445. if (ret == RState.Failed || ret == RState.Timeout)
  446. {
  447. PostMsg(MSG.Error);
  448. return false;
  449. }
  450. return ret == RState.End;
  451. }
  452. private bool FnAbortPurgeLoadLock(object[] param)
  453. {
  454. _purgeLoadLockRoutine.Abort();
  455. return true;
  456. }
  457. private bool FnStartLoadLockLeakCheck(object[] param)
  458. {
  459. return _loadLockLeakCheckRoutine.Start() == RState.Running;
  460. }
  461. private bool FnLoadLockLeakCheckTimeout(object[] param)
  462. {
  463. RState ret = _loadLockLeakCheckRoutine.Monitor();
  464. if (ret == RState.Failed || ret == RState.Timeout)
  465. {
  466. PostMsg(MSG.Error);
  467. return false;
  468. }
  469. return ret == RState.End;
  470. }
  471. private bool FnAbortLoadLockLeakCheck(object[] param)
  472. {
  473. _loadLockLeakCheckRoutine.Abort();
  474. return true;
  475. }
  476. private bool FnStartPurge(object[] param)
  477. {
  478. return _purgeRoutine.Start() == RState.Running;
  479. }
  480. private bool FnPurgeTimeout(object[] param)
  481. {
  482. RState ret = _purgeRoutine.Monitor();
  483. if (ret == RState.Failed || ret == RState.Timeout)
  484. {
  485. PostMsg(MSG.Error);
  486. return false;
  487. }
  488. return ret == RState.End;
  489. }
  490. private bool FnAbortPurge(object[] param)
  491. {
  492. _purgeRoutine.Abort();
  493. return true;
  494. }
  495. private bool FnStartGasLinePurge(object[] param)
  496. {
  497. return _gaslinePurgeRoutine.Start() == RState.Running;
  498. }
  499. private bool FnGasLinePurgeTimeout(object[] param)
  500. {
  501. RState ret = _gaslinePurgeRoutine.Monitor();
  502. if (ret == RState.Failed || ret == RState.Timeout)
  503. {
  504. PostMsg(MSG.Error);
  505. return false;
  506. }
  507. return ret == RState.End;
  508. }
  509. private bool FnAbortGasLinePurge(object[] param)
  510. {
  511. _gaslinePurgeRoutine.Abort();
  512. return true;
  513. }
  514. private bool FnStartPMLeakCheck(object[] param)
  515. {
  516. return _leakCheckRoutine.Start() == RState.Running;
  517. }
  518. private bool FnPMLeakCheckTimeout(object[] param)
  519. {
  520. RState ret = _leakCheckRoutine.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 bool FnAbortPMLeakCheck(object[] param)
  529. {
  530. _leakCheckRoutine.Abort();
  531. return true;
  532. }
  533. private bool FnStartGasBoxLeakCheck(object[] param)
  534. {
  535. return _gasBoxLeakCheckRoutine.Start() == RState.Running;
  536. }
  537. private bool FnGasBoxLeakCheckTimeout(object[] param)
  538. {
  539. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  540. if (ret == RState.Failed || ret == RState.Timeout)
  541. {
  542. PostMsg(MSG.Error);
  543. return false;
  544. }
  545. return ret == RState.End;
  546. }
  547. private bool FnAbortGasBoxLeakCheck(object[] param)
  548. {
  549. _gasBoxLeakCheckRoutine.Abort();
  550. return true;
  551. }
  552. private bool FnStartLLPlace(object[] param)
  553. {
  554. return _llPlaceRoutine.Start() == RState.Running;
  555. }
  556. private bool FnLLPlaceTimeout(object[] param)
  557. {
  558. RState ret = _llPlaceRoutine.Monitor();
  559. if (ret == RState.Failed || ret == RState.Timeout)
  560. {
  561. PostMsg(MSG.Error);
  562. return false;
  563. }
  564. return ret == RState.End;
  565. }
  566. private bool FnAbortLLPlace(object[] param)
  567. {
  568. _llPlaceRoutine.Abort();
  569. return true;
  570. }
  571. private bool FnStartLLPick(object[] param)
  572. {
  573. return _llPickRoutine.Start() == RState.Running;
  574. }
  575. private bool FnLLPickTimeout(object[] param)
  576. {
  577. RState ret = _llPickRoutine.Monitor();
  578. if (ret == RState.Failed || ret == RState.Timeout)
  579. {
  580. PostMsg(MSG.Error);
  581. return false;
  582. }
  583. return ret == RState.End;
  584. }
  585. private bool FnAbortLLPick(object[] param)
  586. {
  587. _llPickRoutine.Abort();
  588. return true;
  589. }
  590. private void _debugRoutine()
  591. {
  592. int flag = 0;
  593. // Test Home routine
  594. if (flag == 1)
  595. {
  596. PostMsg(MSG.Home);
  597. }
  598. else if (flag == 2)
  599. {
  600. PostMsg(MSG.Vent);
  601. }
  602. else if (flag == 3)
  603. {
  604. PostMsg(MSG.Pump);
  605. }
  606. else if(flag == 4)
  607. {
  608. PostMsg(MSG.PumpLoadLock);
  609. }
  610. else if(flag == 5)
  611. {
  612. PostMsg(MSG.VentLoadLock);
  613. }
  614. else if(flag == 6)
  615. {
  616. PostMsg(MSG.PurgeLoadLock);
  617. }
  618. else if(flag == 7)
  619. {
  620. PostMsg(MSG.LaunchPump);
  621. }
  622. else if(flag == 8)
  623. {
  624. PostMsg(MSG.LaunchTurboPump);
  625. }
  626. else if(flag == 9)
  627. {
  628. PostMsg(MSG.LoadLockLeakCheck);
  629. }
  630. else if(flag == 10)
  631. {
  632. PostMsg(MSG.CyclePurge);
  633. }
  634. else if(flag == 11)
  635. {
  636. PostMsg(MSG.GasLinePurge);
  637. }
  638. else if(flag == 12)
  639. {
  640. PostMsg(MSG.LeakCheck);
  641. }
  642. else if(flag == 13)
  643. {
  644. PostMsg(MSG.GasLeakCheck);
  645. }
  646. else if(flag == 14)
  647. {
  648. PostMsg(MSG.LLPlace);
  649. }
  650. else if(flag == 15)
  651. {
  652. PostMsg(MSG.LLPick);
  653. }
  654. }
  655. }
  656. }