PMEntity.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  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. private readonly PMProcessRoutine _processRoutine;
  110. public bool IsIdle
  111. {
  112. get { return fsm.State == (int)PMState.Idle; }
  113. }
  114. public bool IsError
  115. {
  116. get { return fsm.State == (int)PMState.Error; }
  117. }
  118. public bool IsInit
  119. {
  120. get { return fsm.State == (int)PMState.Init; }
  121. }
  122. public bool IsBusy
  123. {
  124. get { return !IsInit && !IsError && !IsIdle; }
  125. }
  126. public bool IsProcessing
  127. {
  128. get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
  129. }
  130. public bool Check(int msg, out string reason, object[] objs)
  131. {
  132. reason = "";
  133. return true;
  134. }
  135. //
  136. private bool CheckToPostMessage(int msg, params object[] args)
  137. {
  138. if (!fsm.FindTransition(fsm.State, msg))
  139. {
  140. EV.PostWarningLog(Module.ToString(), $"{Module} is in { (PMState)fsm.State} state,can not do {(MSG)msg}");
  141. return false;
  142. }
  143. fsm.PostMsg(msg, args);
  144. return true;
  145. }
  146. public int Invoke(string function, params object[] args)
  147. {
  148. switch (function)
  149. {
  150. case "Home":
  151. CheckToPostMessage((int)MSG.Home);
  152. return (int)MSG.Home;
  153. }
  154. return (int)FSM_MSG.NONE;
  155. }
  156. public bool CheckAcked(int msg)
  157. {
  158. return fsm.CheckExecuted(msg);
  159. }
  160. public PMEntity(ModuleName module)
  161. {
  162. Module = module;
  163. _chamber = DEVICE.GetDevice<JetPM>(Module.ToString());
  164. _home = new PMHomeRoutine(_chamber);
  165. _startDryPumpRoutine = new StartDryPumpRoutine(_chamber);
  166. _startTurboPumpRoutine = new StartTurboPumpRoutine(_chamber);
  167. _ventRoutine = new VentRoutine(_chamber);
  168. _pumpRoutine = new PumpDownRoutine(_chamber);
  169. _ventLoadLockRoutine = new LoadLockVentRoutine(_chamber);
  170. _pumpLoadLockRoutine = new LoadLockPumpRoutine(_chamber);
  171. _purgeLoadLockRoutine = new LoadLockPurgeRoutine(_chamber);
  172. _loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
  173. _purgeRoutine = new PMPurgeRoutine(_chamber);
  174. _gaslinePurgeRoutine = new PMGaslinePurgeRoutine(_chamber);
  175. _leakCheckRoutine = new PMLeakCheckRoutine(_chamber);
  176. _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
  177. _llPlaceRoutine = new LLPlaceRoutine(_chamber);
  178. _llPickRoutine = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
  179. _processRoutine = new PMProcessRoutine(_chamber, _pumpRoutine);
  180. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  181. //Idle
  182. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  183. EnterExitTransition<PMState, FSM_MSG>(PMState.Error, fEnterError, FSM_MSG.NONE, null);
  184. //Home
  185. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  186. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  187. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  188. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  189. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  190. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  191. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  192. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  193. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  194. //Launch DryPump sequence
  195. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  196. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  197. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  198. //Launch TurboPump sequence
  199. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  200. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  201. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  202. //vent sequence
  203. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  204. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  205. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  206. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  207. //Pump sequence
  208. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  209. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  210. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  211. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  212. //Pump Loadlock sequence
  213. Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  214. Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  215. Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  216. Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  217. //Vent Loadlock sequence
  218. Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  219. Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  220. Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  221. Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  222. // Purge LoadLock sequence
  223. Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  224. Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  225. Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  226. //LoadLock Leak check sequence
  227. Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  228. Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  229. Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  230. // PM Purge sequence
  231. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  232. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  233. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  234. // PM GasLine Purge sequence
  235. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  236. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  237. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  238. //PM Leak check sequence
  239. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  240. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  241. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  242. //PM Leak check sequence
  243. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  244. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  245. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  246. // PlaceWafer from LoadLock Arm sequence
  247. Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  248. Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  249. Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  250. // PickWafer to LoadLock Arm sequence
  251. Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  252. Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  253. Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  254. // Process
  255. Transition(PMState.Idle, MSG.RunRecipe, FnRunRecipe, PMState.Processing);
  256. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  257. Transition(PMState.Processing, MSG.Abort, FnAbortProcess, PMState.Idle);
  258. Running = true;
  259. }
  260. private bool FnIdle(object[] objs)
  261. {
  262. Running = false;
  263. return true;
  264. }
  265. private bool fEnterError(object[] objs)
  266. {
  267. return true;
  268. }
  269. private bool FnError(object[] objs)
  270. {
  271. Running = false;
  272. if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  273. || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  274. return false;
  275. if (IsProcessing)
  276. {
  277. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  278. }
  279. return true;
  280. }
  281. private bool FnTimeout(object[] objs)
  282. {
  283. _debugRoutine();
  284. return true;
  285. }
  286. private bool FnIdleTimeout(object[] objs)
  287. {
  288. _debugRoutine();
  289. return true;
  290. }
  291. private bool FnErrorTimeout(object[] objs)
  292. {
  293. _debugRoutine();
  294. return true;
  295. }
  296. private bool FnStartHome(object[] objs)
  297. {
  298. return _home.Start() == RState.Running;
  299. }
  300. private bool FnMonitorHome(object[] objs)
  301. {
  302. RState ret = _home.Monitor();
  303. if (ret == RState.Failed || ret == RState.Timeout)
  304. {
  305. PostMsg(MSG.Error);
  306. return false;
  307. }
  308. return ret == RState.End;
  309. }
  310. private bool FnLaunchPump(object[] param)
  311. {
  312. return _startDryPumpRoutine.Start() == RState.Running;
  313. }
  314. private bool FnLaunchPumpTimeout(object[] param)
  315. {
  316. RState ret = _startDryPumpRoutine.Monitor();
  317. if (ret == RState.Failed || ret == RState.Timeout)
  318. {
  319. PostMsg(MSG.Error);
  320. return false;
  321. }
  322. return ret == RState.End;
  323. }
  324. private bool FnAbortStartPumping(object[] param)
  325. {
  326. _startDryPumpRoutine.Abort();
  327. return true;
  328. }
  329. private bool FnLaunchTurboPump(object[] param)
  330. {
  331. return _startTurboPumpRoutine.Start() == RState.Running;
  332. }
  333. private bool FnLaunchTurboPumpTimeout(object[] param)
  334. {
  335. RState ret = _startTurboPumpRoutine.Monitor();
  336. if (ret == RState.Failed || ret == RState.Timeout)
  337. {
  338. PostMsg(MSG.Error);
  339. return false;
  340. }
  341. return ret == RState.End;
  342. }
  343. private bool FnAbortStartTurboPumping(object[] param)
  344. {
  345. _startTurboPumpRoutine.Abort();
  346. return true;
  347. }
  348. private bool FnStartVent(object[] param)
  349. {
  350. return _ventRoutine.Start() == RState.Running;
  351. }
  352. private bool FnVentTimeout(object[] param)
  353. {
  354. RState ret = _ventRoutine.Monitor();
  355. if (ret == RState.Failed || ret == RState.Timeout)
  356. {
  357. PostMsg(MSG.Error);
  358. return false;
  359. }
  360. return ret == RState.End;
  361. }
  362. private bool FnVentToPumping(object[] param)
  363. {
  364. _ventRoutine.Abort();
  365. return true; // FnStartPumpDown(param);
  366. }
  367. private bool FnAbortVent(object[] param)
  368. {
  369. _ventRoutine.Abort();
  370. return true;
  371. }
  372. private bool FnStartPumpDown(object[] param)
  373. {
  374. return _pumpRoutine.Start() == RState.Running;
  375. }
  376. private bool FnPumpDownTimeout(object[] param)
  377. {
  378. RState ret = _pumpRoutine.Monitor();
  379. if (ret == RState.Failed || ret == RState.Timeout)
  380. {
  381. PostMsg(MSG.Error);
  382. return false;
  383. }
  384. return ret == RState.End;
  385. }
  386. private bool FnAbortPumping(object[] param)
  387. {
  388. _pumpRoutine.Abort();
  389. return true;
  390. }
  391. private bool FnStartVentLoadlock(object[] param)
  392. {
  393. return _ventLoadLockRoutine.Start() == RState.Running;
  394. }
  395. private bool FnVentLoadLockTimeout(object[] param)
  396. {
  397. RState ret = _ventLoadLockRoutine.Monitor();
  398. if (ret == RState.Failed || ret == RState.Timeout)
  399. {
  400. PostMsg(MSG.Error);
  401. return false;
  402. }
  403. return ret == RState.End;
  404. }
  405. private bool FnVentLoadLockToPumpingLoadLock(object[] param)
  406. {
  407. _ventLoadLockRoutine.Abort();
  408. return FnStartPumpDownLoadLock(param);
  409. }
  410. private bool FnAbortVentLoadLock(object[] param)
  411. {
  412. _ventLoadLockRoutine.Abort();
  413. return true;
  414. }
  415. private bool FnStartPumpDownLoadLock(object[] param)
  416. {
  417. return _pumpLoadLockRoutine.Start() == RState.Running;
  418. }
  419. private bool FnPumpDownLoadLockTimeout(object[] param)
  420. {
  421. RState ret = _pumpLoadLockRoutine.Monitor();
  422. if (ret == RState.Failed || ret == RState.Timeout)
  423. {
  424. PostMsg(MSG.Error);
  425. return false;
  426. }
  427. return ret == RState.End;
  428. }
  429. private bool FnPumpingToVent(object[] param)
  430. {
  431. _pumpRoutine.Abort();
  432. return FnStartVent(param);
  433. }
  434. private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  435. {
  436. _pumpLoadLockRoutine.Abort();
  437. return FnStartVentLoadlock(param);
  438. }
  439. private bool FnAbortPumpingLoadLock(object[] param)
  440. {
  441. _pumpLoadLockRoutine.Abort();
  442. return true;
  443. }
  444. private bool FnStartPurgeLoadlock(object[] param)
  445. {
  446. return _purgeLoadLockRoutine.Start() == RState.Running;
  447. }
  448. private bool FnPurgeLoadLockTimeout(object[] param)
  449. {
  450. RState ret = _purgeLoadLockRoutine.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 FnAbortPurgeLoadLock(object[] param)
  459. {
  460. _purgeLoadLockRoutine.Abort();
  461. return true;
  462. }
  463. private bool FnStartLoadLockLeakCheck(object[] param)
  464. {
  465. return _loadLockLeakCheckRoutine.Start() == RState.Running;
  466. }
  467. private bool FnLoadLockLeakCheckTimeout(object[] param)
  468. {
  469. RState ret = _loadLockLeakCheckRoutine.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 FnAbortLoadLockLeakCheck(object[] param)
  478. {
  479. _loadLockLeakCheckRoutine.Abort();
  480. return true;
  481. }
  482. private bool FnStartPurge(object[] param)
  483. {
  484. return _purgeRoutine.Start() == RState.Running;
  485. }
  486. private bool FnPurgeTimeout(object[] param)
  487. {
  488. RState ret = _purgeRoutine.Monitor();
  489. if (ret == RState.Failed || ret == RState.Timeout)
  490. {
  491. PostMsg(MSG.Error);
  492. return false;
  493. }
  494. return ret == RState.End;
  495. }
  496. private bool FnAbortPurge(object[] param)
  497. {
  498. _purgeRoutine.Abort();
  499. return true;
  500. }
  501. private bool FnStartGasLinePurge(object[] param)
  502. {
  503. return _gaslinePurgeRoutine.Start() == RState.Running;
  504. }
  505. private bool FnGasLinePurgeTimeout(object[] param)
  506. {
  507. RState ret = _gaslinePurgeRoutine.Monitor();
  508. if (ret == RState.Failed || ret == RState.Timeout)
  509. {
  510. PostMsg(MSG.Error);
  511. return false;
  512. }
  513. return ret == RState.End;
  514. }
  515. private bool FnAbortGasLinePurge(object[] param)
  516. {
  517. _gaslinePurgeRoutine.Abort();
  518. return true;
  519. }
  520. private bool FnStartPMLeakCheck(object[] param)
  521. {
  522. return _leakCheckRoutine.Start() == RState.Running;
  523. }
  524. private bool FnPMLeakCheckTimeout(object[] param)
  525. {
  526. RState ret = _leakCheckRoutine.Monitor();
  527. if (ret == RState.Failed || ret == RState.Timeout)
  528. {
  529. PostMsg(MSG.Error);
  530. return false;
  531. }
  532. return ret == RState.End;
  533. }
  534. private bool FnAbortPMLeakCheck(object[] param)
  535. {
  536. _leakCheckRoutine.Abort();
  537. return true;
  538. }
  539. private bool FnStartGasBoxLeakCheck(object[] param)
  540. {
  541. return _gasBoxLeakCheckRoutine.Start() == RState.Running;
  542. }
  543. private bool FnGasBoxLeakCheckTimeout(object[] param)
  544. {
  545. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  546. if (ret == RState.Failed || ret == RState.Timeout)
  547. {
  548. PostMsg(MSG.Error);
  549. return false;
  550. }
  551. return ret == RState.End;
  552. }
  553. private bool FnAbortGasBoxLeakCheck(object[] param)
  554. {
  555. _gasBoxLeakCheckRoutine.Abort();
  556. return true;
  557. }
  558. private bool FnStartLLPlace(object[] param)
  559. {
  560. return _llPlaceRoutine.Start() == RState.Running;
  561. }
  562. private bool FnLLPlaceTimeout(object[] param)
  563. {
  564. RState ret = _llPlaceRoutine.Monitor();
  565. if (ret == RState.Failed || ret == RState.Timeout)
  566. {
  567. PostMsg(MSG.Error);
  568. return false;
  569. }
  570. return ret == RState.End;
  571. }
  572. private bool FnAbortLLPlace(object[] param)
  573. {
  574. _llPlaceRoutine.Abort();
  575. return true;
  576. }
  577. private bool FnStartLLPick(object[] param)
  578. {
  579. return _llPickRoutine.Start() == RState.Running;
  580. }
  581. private bool FnLLPickTimeout(object[] param)
  582. {
  583. RState ret = _llPickRoutine.Monitor();
  584. if (ret == RState.Failed || ret == RState.Timeout)
  585. {
  586. PostMsg(MSG.Error);
  587. return false;
  588. }
  589. return ret == RState.End;
  590. }
  591. private bool FnAbortLLPick(object[] param)
  592. {
  593. _llPickRoutine.Abort();
  594. return true;
  595. }
  596. private bool FnRunRecipe(object[] param)
  597. {
  598. return _processRoutine.Start(param) == RState.Running;
  599. }
  600. private bool FnProcessTimeout(object[] param)
  601. {
  602. RState ret = _processRoutine.Monitor();
  603. if (ret == RState.Failed || ret == RState.Timeout)
  604. {
  605. PostMsg(MSG.Error);
  606. return false;
  607. }
  608. return ret == RState.End;
  609. }
  610. private bool FnAbortProcess(object[] param)
  611. {
  612. _processRoutine.Abort();
  613. return true;
  614. }
  615. private void _debugRoutine()
  616. {
  617. int flag = 0;
  618. // Test Home routine
  619. if (flag == 1)
  620. {
  621. PostMsg(MSG.Home);
  622. }
  623. else if (flag == 2)
  624. {
  625. PostMsg(MSG.Vent);
  626. }
  627. else if (flag == 3)
  628. {
  629. PostMsg(MSG.Pump);
  630. }
  631. else if(flag == 4)
  632. {
  633. PostMsg(MSG.PumpLoadLock);
  634. }
  635. else if(flag == 5)
  636. {
  637. PostMsg(MSG.VentLoadLock);
  638. }
  639. else if(flag == 6)
  640. {
  641. PostMsg(MSG.PurgeLoadLock);
  642. }
  643. else if(flag == 7)
  644. {
  645. PostMsg(MSG.LaunchPump);
  646. }
  647. else if(flag == 8)
  648. {
  649. PostMsg(MSG.LaunchTurboPump);
  650. }
  651. else if(flag == 9)
  652. {
  653. PostMsg(MSG.LoadLockLeakCheck);
  654. }
  655. else if(flag == 10)
  656. {
  657. PostMsg(MSG.CyclePurge);
  658. }
  659. else if(flag == 11)
  660. {
  661. PostMsg(MSG.GasLinePurge);
  662. }
  663. else if(flag == 12)
  664. {
  665. PostMsg(MSG.LeakCheck);
  666. }
  667. else if(flag == 13)
  668. {
  669. PostMsg(MSG.GasLeakCheck);
  670. }
  671. else if(flag == 14)
  672. {
  673. PostMsg(MSG.LLPlace);
  674. }
  675. else if(flag == 15)
  676. {
  677. PostMsg(MSG.LLPick);
  678. }
  679. else if(flag == 16)
  680. {
  681. PostMsg(MSG.RunRecipe, "7777");
  682. }
  683. }
  684. }
  685. }