PMEntity.cs 30 KB

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