PMEntity.cs 33 KB

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