PMEntity.cs 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  1. using System;
  2. using Aitex.Core.Common;
  3. using Aitex.Core.RT.DataCenter;
  4. using Aitex.Core.RT.Device;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.Fsm;
  7. using Aitex.Core.RT.OperationCenter;
  8. using Aitex.Core.RT.Routine;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.Schedulers;
  13. using MECF.Framework.Common.SubstrateTrackings;
  14. using Virgo_DCommon;
  15. using Virgo_DRT.Devices;
  16. using Virgo_DRT.Modules;
  17. using Virgo_DRT.Modules.PMs;
  18. namespace Virgo_DRT.Module
  19. {
  20. public class PMEntity : Entity, IModuleEntity
  21. {
  22. public enum MSG
  23. {
  24. Home,
  25. Transfer,
  26. PrepareTransfer,
  27. PostTransfer,
  28. Reset,
  29. Abort,
  30. Error,
  31. LaunchPump,
  32. Pump,
  33. Vent,
  34. CyclePurge,
  35. Heat,
  36. TransferHandoff,
  37. StartTransfer,
  38. LeakCheck,
  39. DeleteLeakCheck,
  40. MoveLiftPin,
  41. MoveGuidePin,
  42. Process,
  43. RunRecipe,
  44. PostProcess,
  45. RecipeSkipStep,
  46. RecipeUpdate,
  47. RecipeResume,
  48. RecipePause,
  49. RecipeAbort,
  50. PreProcess,
  51. AutoMode,
  52. ManualMode,
  53. LockLid,
  54. Online,
  55. Offline,
  56. GasFlow,
  57. StopGasFlow,
  58. RfPower,
  59. MaxMsg
  60. }
  61. // ----------------------------Fields--------------------------
  62. //
  63. private readonly JetPM _chamber;
  64. private string _processStatus;
  65. private DateTime _recipeStartTime;
  66. //routine
  67. private readonly VentRoutine _ventRoutine;
  68. private readonly PumpDownRoutine _pumpRoutine;
  69. private readonly StartPumpRoutine _startPumpRoutine;
  70. private readonly TemperatureControlRoutine _temperatureControlRoutine;
  71. private readonly GasFlowRoutine _gasFlowRoutine;
  72. private readonly RfPowerRoutine _rfPowerRoutine;
  73. private readonly CyclePurgeRoutine _cyclePurgeRoutine;
  74. private readonly ProcessRoutine _processRoutine;
  75. private readonly PreProcessRoutine _preProcessRoutine;
  76. private readonly PostProcessRoutine _postProcessRoutine;
  77. private readonly LeakCheckRoutine _leakCheckRoutine;
  78. private readonly PMPrepareTransferRoutine _prepareTrans;
  79. private readonly PMPostTransferRoutine _postTrans;
  80. private readonly PMHomeRoutine _home;
  81. private AutoFlag _AutoMode;
  82. private bool _isOnline;
  83. private DateTime _pumpStartTime;
  84. private TimeSpan _pumpElapsedTime;
  85. private DateTime _rfStartTime;
  86. private DateTime _tcStartTime;
  87. private TimeSpan _rfElapsedTime;
  88. private TimeSpan _tcElapsedTime;
  89. private MovementPosition _goalLiftPin;
  90. private ushort _ActivatedActionID;
  91. // --------------------------Properties------------------------
  92. //
  93. public ModuleName Module { get; }
  94. public Action<bool, bool> TransferPrepared;
  95. public bool IsIdle
  96. {
  97. get { return fsm.State == (int)PMState.Idle; }
  98. }
  99. public bool IsError
  100. {
  101. get { return fsm.State == (int)PMState.Error; }
  102. }
  103. public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
  104. public int Invoke(string function, params object[] args)
  105. {
  106. switch (function)
  107. {
  108. case "Home":
  109. CheckToPostMessage((int)MSG.Home);
  110. return (int)MSG.Home;
  111. }
  112. return (int)FSM_MSG.NONE;
  113. }
  114. public bool CheckAcked(int msg)
  115. {
  116. return fsm.CheckExecuted(msg);
  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. private string PumpTime
  131. {
  132. get
  133. {
  134. if ((fsm.State == (int)PMState.Pumping) || (fsm.State == (int)PMState.PreProcess))
  135. _pumpElapsedTime = DateTime.Now - _pumpStartTime;
  136. return string.Format("{0}:{1}:{2}", ((int)_pumpElapsedTime.TotalHours).ToString("00"),
  137. _pumpElapsedTime.Minutes.ToString("00"), _pumpElapsedTime.Seconds.ToString("00"));
  138. }
  139. }
  140. private int StepNo
  141. {
  142. get
  143. {
  144. if ( (fsm.State == (int)PMState.Processing) || (fsm.State == (int)PMState.PostProcess))
  145. {
  146. return _processRoutine.CurStepNum + 1;
  147. }
  148. return 0;
  149. }
  150. }
  151. private int RecipeSteps
  152. {
  153. get
  154. {
  155. if ((fsm.State == (int)PMState.PreProcess) || (fsm.State == (int)PMState.Processing) || (fsm.State == (int)PMState.PostProcess))
  156. {
  157. return _preProcessRoutine.CurrentRecipeStepList.Count;
  158. }
  159. return 0;
  160. }
  161. }
  162. private string RecipeStepName
  163. {
  164. get
  165. {
  166. if ((fsm.State == (int)PMState.PreProcess) || (fsm.State == (int)PMState.Processing) || (fsm.State == (int)PMState.PostProcess))
  167. {
  168. return _processRoutine.CurStepComment;
  169. }
  170. return null;
  171. }
  172. }
  173. private double LeakRate
  174. {
  175. get { return _leakCheckRoutine.LeakRate; }
  176. }
  177. private string RecipeName
  178. {
  179. get
  180. {
  181. if ((fsm.State == (int)PMState.PreProcess) || (fsm.State == (int)PMState.Processing) || (fsm.State == (int)PMState.PostProcess))
  182. {
  183. return _preProcessRoutine.CurrentRecipeRunningName.Split('\\')[1];
  184. }
  185. return null;
  186. }
  187. }
  188. private string RFTime
  189. {
  190. get
  191. {
  192. if (fsm.State == (int)PMState.RfPowering)
  193. _rfElapsedTime = DateTime.Now - _rfStartTime;
  194. return $"{((int)_rfElapsedTime.TotalHours).ToString("00")}:{_rfElapsedTime.Minutes.ToString("00")}:{_rfElapsedTime.Seconds.ToString("00")}";
  195. }
  196. }
  197. private string TCTime
  198. {
  199. get
  200. {
  201. if (fsm.State == (int)PMState.Heating)
  202. _tcElapsedTime = DateTime.Now - _tcStartTime;
  203. return $"{((int)_tcElapsedTime.TotalHours).ToString("00")}:{_tcElapsedTime.Minutes.ToString("00")}:{_tcElapsedTime.Seconds.ToString("00")}";
  204. }
  205. }
  206. private TimeSpan _recipeElapsedTime;
  207. public string RecipeElapsedTime
  208. {
  209. get
  210. {
  211. if (fsm.State == (int)PMState.LoadProcessRecipe || fsm.State == (int)PMState.PreProcess
  212. || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
  213. _recipeElapsedTime = DateTime.Now - _recipeStartTime;
  214. return string.Format("{0}:{1}:{2}", ((int)_recipeElapsedTime.TotalHours).ToString("00"),
  215. _recipeElapsedTime.Minutes.ToString("00"), _recipeElapsedTime.Seconds.ToString("00"));
  216. }
  217. }
  218. public bool IsOnline
  219. {
  220. get { return _isOnline; }
  221. }
  222. // --------------------------Constructor-----------------------
  223. //
  224. public PMEntity(ModuleName module)
  225. {
  226. this.Module = module;
  227. //_chamber = new JetPM(ModuleHelper.Converter(Name));
  228. _chamber = DEVICE.GetDevice<JetPM>(Module.ToString());
  229. LeakCheckResultManager.Instance.Initialize(Module.ToString());
  230. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  231. _ventRoutine = new VentRoutine(_chamber);
  232. _pumpRoutine = new PumpDownRoutine(_chamber);
  233. _startPumpRoutine = new StartPumpRoutine(_chamber);
  234. _temperatureControlRoutine = new TemperatureControlRoutine(_chamber);
  235. _prepareTrans = new PMPrepareTransferRoutine(_chamber, _ventRoutine);
  236. _postTrans = new PMPostTransferRoutine(_chamber);
  237. _gasFlowRoutine = new GasFlowRoutine(_chamber);
  238. _rfPowerRoutine = new RfPowerRoutine(_chamber, true);
  239. _cyclePurgeRoutine = new CyclePurgeRoutine(_chamber);
  240. _leakCheckRoutine = new LeakCheckRoutine(_chamber, _pumpRoutine);
  241. _preProcessRoutine = new PreProcessRoutine(_chamber, _pumpRoutine);
  242. _processRoutine = new ProcessRoutine(_chamber);
  243. _postProcessRoutine = new PostProcessRoutine(_chamber, _ventRoutine);
  244. _home = new PMHomeRoutine(_chamber);
  245. //Idle
  246. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  247. //Error
  248. Transition(PMState.Init, MSG.Error, FnError, PMState.Error);
  249. Transition(PMState.Init, MSG.Reset, null, PMState.Init);
  250. Transition(PMState.Error, MSG.Reset, FnReset, PMState.Idle);
  251. AnyStateTransition((int)FSM_MSG.ALARM, FnError, (int)PMState.Error);
  252. AnyStateTransition(MSG.AutoMode, FnSetAuto, FSM_STATE.SAME);
  253. AnyStateTransition(MSG.ManualMode, FnSetManual, FSM_STATE.SAME);
  254. AnyStateTransition(MSG.Online, FnSetOnline, FSM_STATE.SAME);
  255. AnyStateTransition(MSG.Offline, FnSetOffline, FSM_STATE.SAME);
  256. //Home
  257. EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  258. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  259. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  260. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  261. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  262. Transition(PMState.Homing, MSG.Error, null, PMState.Init);
  263. Transition(PMState.Homing, MSG.Abort, FnAbortTask, PMState.Init);
  264. // Gas Flow sequence
  265. Transition(PMState.Idle, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  266. Transition(PMState.GasFlowing, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  267. Transition(PMState.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, PMState.Idle);
  268. Transition(PMState.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, PMState.Idle);
  269. Transition(PMState.GasFlowing, MSG.Abort, FnAbortGasFlow, PMState.Idle);
  270. //RF Power sequence
  271. Transition(PMState.Idle, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  272. Transition(PMState.GasFlowing, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  273. Transition(PMState.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, PMState.Idle);
  274. Transition(PMState.RfPowering, MSG.Abort, FnAbortRfPower, PMState.Idle);
  275. // Heat substrate
  276. Transition(PMState.Idle, MSG.Heat, FnHeat, PMState.Heating);
  277. Transition(PMState.Heating, FSM_MSG.TIMER, FnHeatTimeout, PMState.Idle);
  278. Transition(PMState.Heating, MSG.Abort, FnAbortHeating, PMState.Idle);
  279. //Launch Pump sequence
  280. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  281. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  282. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  283. //Pump sequence
  284. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  285. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  286. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  287. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  288. //vent sequence
  289. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  290. Transition(PMState.Pumping, MSG.Vent, FnPumpingToVent, PMState.Venting);
  291. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  292. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  293. // Purge sequence
  294. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  295. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  296. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  297. //Leak check sequence
  298. Transition(PMState.Idle, MSG.LeakCheck, FnStartLeakCheck, PMState.LeakCheck);
  299. Transition(PMState.Idle, MSG.DeleteLeakCheck, FnDeleteLeakCheck, PMState.Idle);
  300. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnLeakCheckTimeout, PMState.Idle);
  301. Transition(PMState.LeakCheck, MSG.Abort, FnAbortLeakCheck, PMState.Idle);
  302. // Transfer
  303. Transition(PMState.Idle, MSG.PrepareTransfer, FnStartPrepareTransfer, PMState.PrepareTransfer);
  304. Transition(PMState.PrepareTransfer, FSM_MSG.TIMER, FnPreTransferTimeout, PMState.Idle);
  305. Transition(PMState.PrepareTransfer, MSG.Abort, FnAbortTask, PMState.Idle);
  306. Transition(PMState.Idle, MSG.PostTransfer, FnStartPostTransfer, PMState.PostTransfer);
  307. Transition(PMState.PostTransfer, FSM_MSG.TIMER, FnPostTransferTimeout, PMState.Idle);
  308. Transition(PMState.PostTransfer, MSG.Abort, FnAbortTask, PMState.Idle);
  309. //EnterExitTransition<PMState, FSM_MSG>(PMState.TransferHandoff, null, FSM_MSG.NONE, fExitTransfer);
  310. //Transition(PMState.Idle, MSG.TransferHandoff, FnStartTransferHandoff, PMState.TransferHandoff);
  311. //Transition(PMState.TransferHandoff, FSM_MSG.TIMER, FnHandoffTime, PMState.Idle);
  312. //Transition(PMState.TransferHandoff, MSG.Abort, FnAbortTask, PMState.Idle);
  313. // lift pin
  314. Transition(PMState.Idle, MSG.MoveLiftPin, FnSetLiftpin, PMState.LiftpinMoving);
  315. Transition(PMState.LiftpinMoving, FSM_MSG.TIMER, FnLiftpinTimeout, PMState.Idle);
  316. // guide pin
  317. Transition(PMState.Idle, MSG.MoveGuidePin, FnSetGuidePin, PMState.GuidePinMoving);
  318. Transition(PMState.GuidePinMoving, FSM_MSG.TIMER, FnGuidePinTimeout, PMState.Idle);
  319. // PreProcess sequence
  320. Transition(PMState.Idle, MSG.RunRecipe, FnProcessLoadRecipe, PMState.LoadProcessRecipe);
  321. Transition(PMState.LoadProcessRecipe, MSG.PreProcess, FnStartPreProcess, PMState.PreProcess);
  322. Transition(PMState.LoadProcessRecipe, MSG.Abort, null, PMState.Idle);
  323. Transition(PMState.LoadProcessRecipe, MSG.Error, null, PMState.Idle);
  324. Transition(PMState.PreProcess, FSM_MSG.TIMER, FnPreProcessTimeout, PMState.PreProcess);
  325. Transition(PMState.PreProcess, MSG.Abort, FnAbortPreProcess, PMState.Idle);
  326. Transition(PMState.PreProcess, MSG.RecipeAbort, FnAbortPreProcess, PMState.Idle);
  327. Transition(PMState.PreProcess, MSG.Error, FnAbortPreProcess, PMState.Error);
  328. // Process
  329. Transition(PMState.PreProcess, MSG.Process, FnStartProcess, PMState.Processing);
  330. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Processing);
  331. Transition(PMState.Processing, MSG.Error, FnAbortProcess, PMState.Error);
  332. Transition(PMState.Processing, MSG.RecipeAbort, FnAbortProcess, PMState.PostProcess);
  333. Transition(PMState.Processing, MSG.RecipePause, FnPauseProcess, PMState.Processing);
  334. Transition(PMState.Processing, MSG.RecipeResume, FnResumeRecipe, PMState.Processing);
  335. Transition(PMState.Processing, MSG.RecipeUpdate, FnUpdateRecipe, PMState.Processing);
  336. Transition(PMState.Processing, MSG.RecipeSkipStep, FnSkipStep, PMState.Processing);
  337. EnterExitTransition<PMState, FSM_MSG>(PMState.Processing, FnEnterProcess, FSM_MSG.NONE, FnExitProcess);
  338. //PostProcess sequence
  339. Transition(PMState.Processing, MSG.PostProcess, FnStartPostProcess, PMState.PostProcess);
  340. Transition(PMState.PostProcess, FSM_MSG.TIMER, FnPostProcessTimeout, PMState.Idle);
  341. Transition(PMState.PostProcess, MSG.Abort, FnAbortPostProcess, PMState.Idle);
  342. Transition(PMState.PostProcess, MSG.RecipeAbort, FnAbortPostProcess, PMState.Idle);
  343. EnterExitTransition<PMState, FSM_MSG>(PMState.PostProcess, null, FSM_MSG.NONE, fExitPostProcess);
  344. Running = true;
  345. }
  346. protected override bool Init()
  347. {
  348. DATA.Subscribe($"{Module}.FsmState", () => ((PMState)fsm.State).ToString());
  349. DATA.Subscribe($"{Module}.FsmPrevState", () => ((PMState)fsm.PrevState).ToString());
  350. DATA.Subscribe($"{Module}.FsmLastMessage", GetFsmLastMessage);
  351. DATA.Subscribe($"{Module}.PMState", () => fsm.State);
  352. DATA.Subscribe($"{Module}.IsAutoMode", () => IsAutoMode);
  353. DATA.Subscribe($"{Module}.IsOnline", () => _isOnline);
  354. DATA.Subscribe($"{Module}.ProcessStatus", () => _processStatus);
  355. DATA.Subscribe($"{Module}.PumpTime", () => PumpTime);
  356. DATA.Subscribe($"{Module}.TCTime", () => TCTime);
  357. DATA.Subscribe($"{Module}.StepNo", () => StepNo);
  358. DATA.Subscribe($"{Module}.RecipeStepName", () => RecipeStepName);
  359. DATA.Subscribe($"{Module}.RecipeName", () => RecipeName);
  360. DATA.Subscribe($"{Module}.LeakRate", () => LeakRate);
  361. DATA.Subscribe($"{Module}.RecipeSteps", () => RecipeSteps);
  362. DATA.Subscribe($"{Module}.RecipeProcessTime", () => RecipeElapsedTime);
  363. DATA.Subscribe($"{Module}.RecipeStepTimeElapsed", () => (_processRoutine.CurStepElpasedTime / 1000).ToString("F0"));
  364. DATA.Subscribe($"{Module}.RecipeStepTimeSetPoint", () => (_processRoutine.CurStepTotalTime / 1000).ToString("F0"));
  365. OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
  366. OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower, args));
  367. OP.Subscribe($"{Module}.{RtOperation.MoveLiftPin}", (cmd, args) => CheckToPostMessage((int)MSG.MoveLiftPin, args[0]));
  368. OP.Subscribe($"{Module}.{RtOperation.MoveGuidePin}", (cmd, args) => CheckToPostMessage((int)MSG.MoveGuidePin, args[0], args[1]));
  369. OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  370. OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
  371. OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  372. OP.Subscribe($"{Module}.PrepareTransfer", (cmd, args) => CheckToPostMessage((int)MSG.PrepareTransfer, args[0]));
  373. OP.Subscribe($"{Module}.TransferHandoff", (cmd, args) => CheckToPostMessage((int)MSG.TransferHandoff, args[0]));
  374. OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  375. OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
  376. OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  377. OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
  378. OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
  379. OP.Subscribe($"{Module}.{RtOperation.DeleteLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.DeleteLeakCheck, args));
  380. OP.Subscribe($"{Module}.{RtOperation.LockLid}", (cmd, args) => CheckToPostMessage((int)MSG.LockLid, true));
  381. OP.Subscribe($"{Module}.{RtOperation.UnlockLid}", (cmd, args) => CheckToPostMessage((int)MSG.LockLid, false));
  382. OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, (string)args[0]));
  383. OP.Subscribe($"{Module}.{RtOperation.SkipCurrentStep}", (cmd, args) => CheckToPostMessage((int)MSG.RecipeSkipStep));
  384. OP.Subscribe($"{Module}.{RtOperation.AbortRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RecipeAbort));
  385. OP.Subscribe($"{Module}.{RtOperation.PmAuto}", (cmd, args) => CheckToPostMessage((int)MSG.AutoMode));
  386. OP.Subscribe($"{Module}.{RtOperation.PmManual}", (cmd, args) => CheckToPostMessage((int)MSG.ManualMode));
  387. OP.Subscribe($"{Module}.{RtOperation.PmOnline}", (cmd, args) => CheckToPostMessage((int)MSG.Online));
  388. OP.Subscribe($"{Module}.{RtOperation.PmOffline}", (cmd, args) => CheckToPostMessage((int)MSG.Offline));
  389. OP.Subscribe($"{Module}.{RtOperation.Heat}", (cmd, args) => CheckToPostMessage((int)MSG.Heat, args[0]));
  390. return true;
  391. }
  392. // Methods
  393. //
  394. private bool CheckToPostMessage(int msg, params object[] args)
  395. {
  396. if (!fsm.FindTransition(fsm.State, msg))
  397. {
  398. EV.PostWarningLog(Module.ToString(), $"{Module} is in { (PMState)fsm.State} state,can not do {(MSG)msg}");
  399. return false;
  400. }
  401. fsm.PostMsg(msg, args);
  402. return true;
  403. }
  404. private bool FnAbortTask(object[] param)
  405. {
  406. //_task.Abort();
  407. return true;
  408. }
  409. private bool FnSetAuto(object[] param)
  410. {
  411. this._AutoMode = AutoFlag.Auto;
  412. return true;
  413. }
  414. private bool FnSetManual(object[] param)
  415. {
  416. if(fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
  417. {
  418. EV.PostWarningLog(Module.ToString(), $"{Module} is in {(PMState) fsm.State},can not do SetAutoMode");
  419. return false;
  420. }
  421. this._AutoMode = AutoFlag.Manual;
  422. return true;
  423. }
  424. private bool FnSetOnline(object[] param)
  425. {
  426. this._isOnline = true;
  427. return true;
  428. }
  429. private bool FnSetOffline(object[] param)
  430. {
  431. this._isOnline = false;
  432. return true;
  433. }
  434. #region Gas&RF
  435. private bool FnStartGasFlow(object[] objs)
  436. {
  437. Result ret = _gasFlowRoutine.Start(objs);
  438. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  439. {
  440. return false; //do noting
  441. }
  442. return true;
  443. }
  444. private bool FnGasFlowTimeout(object[] objs)
  445. {
  446. Result ret = _gasFlowRoutine.Monitor();
  447. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  448. {
  449. PostMsg(MSG.Abort);
  450. return true;
  451. }
  452. return false;
  453. }
  454. private bool FnAbortGasFlow(object[] objs)
  455. {
  456. _gasFlowRoutine.Abort();
  457. return true;
  458. }
  459. private bool FnStopGasFlow(object[] objs)
  460. {
  461. _gasFlowRoutine.StopFlow2();
  462. return true;
  463. }
  464. private bool FnStartRfPower(object[] objs)
  465. {
  466. _rfStartTime = DateTime.Now;
  467. Result ret = _rfPowerRoutine.Start(objs);
  468. if (ret == Result.DONE)
  469. {
  470. return false;
  471. }
  472. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  473. {
  474. return false; //do noting
  475. }
  476. return true;
  477. }
  478. private bool FnRfPowerTimeout(object[] objs)
  479. {
  480. Result ret = _rfPowerRoutine.Monitor();
  481. if (ret == Result.DONE)
  482. return true;
  483. else if (ret == Result.FAIL || ret == Result.TIMEOUT)
  484. {
  485. //do nothing
  486. return true;
  487. }
  488. return false;
  489. ;
  490. }
  491. private bool FnAbortRfPower(object[] objs)
  492. {
  493. _rfPowerRoutine.Abort();
  494. if (_gasFlowRoutine._gasStatus)
  495. _gasFlowRoutine.Abort();
  496. return true;
  497. }
  498. private bool FnHeat(object[] objs)
  499. {
  500. _tcStartTime = DateTime.Now;
  501. return _temperatureControlRoutine.Start(objs) == Result.RUN;
  502. }
  503. private bool FnHeatTimeout(object[] param)
  504. {
  505. Result ret = _temperatureControlRoutine.Monitor();
  506. if (ret == Result.DONE)
  507. {
  508. return true;
  509. }
  510. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  511. {
  512. //do nothing
  513. return true;
  514. }
  515. return false;
  516. }
  517. private bool FnAbortHeating(object[] param)
  518. {
  519. _temperatureControlRoutine.Abort();
  520. return true;
  521. }
  522. #endregion Gas&RF
  523. #region Subroutine
  524. private bool FnStartLeakCheck(object[] param)
  525. {
  526. return _leakCheckRoutine.Start(param) == Result.RUN;
  527. }
  528. private bool FnLeakCheckTimeout(object[] param)
  529. {
  530. Result res = _leakCheckRoutine.Monitor();
  531. return res == Result.DONE || res == Result.FAIL;
  532. }
  533. private bool FnDeleteLeakCheck(object[] param)
  534. {
  535. _leakCheckRoutine.DeleteLeadCheck(param);
  536. return true;
  537. }
  538. private bool FnAbortLeakCheck(object[] param)
  539. {
  540. _leakCheckRoutine.Abort();
  541. return true;
  542. }
  543. private bool FnStartVent(object[] param)
  544. {
  545. Result ret = _ventRoutine.Start();
  546. if (ret == Result.DONE)
  547. {
  548. return false;
  549. }
  550. else if (ret == Result.FAIL)
  551. {
  552. return false; //do noting
  553. }
  554. return true;
  555. }
  556. private bool FnVentTimeout(object[] param)
  557. {
  558. Result ret = _ventRoutine.Monitor();
  559. if (ret == Result.DONE)
  560. {
  561. return true;
  562. }
  563. if (ret == Result.FAIL)
  564. {
  565. //do nothing
  566. return true;
  567. }
  568. return false;
  569. }
  570. private bool FnVentToPumping(object[] param)
  571. {
  572. _ventRoutine.Abort();
  573. return FnStartPumpDown(param);
  574. }
  575. private bool FnAbortVent(object[] param)
  576. {
  577. _ventRoutine.Abort();
  578. return true;
  579. }
  580. private bool FnLaunchPump(object[] param)
  581. {
  582. _pumpStartTime = DateTime.Now;
  583. return _startPumpRoutine.Start() == Result.RUN;
  584. }
  585. private bool FnLaunchPumpTimeout(object[] param)
  586. {
  587. Result ret = _startPumpRoutine.Monitor();
  588. if (ret == Result.DONE)
  589. {
  590. return true;
  591. }
  592. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  593. {
  594. PostMsg(MSG.Abort);
  595. return false;
  596. }
  597. return false;
  598. }
  599. private bool FnAbortStartPumping(object[] param)
  600. {
  601. _startPumpRoutine.Abort();
  602. return true;
  603. }
  604. private bool FnStartPumpDown(object[] param)
  605. {
  606. _pumpStartTime = DateTime.Now;
  607. return _pumpRoutine.Start() == Result.RUN;
  608. }
  609. private bool FnPumpDownTimeout(object[] param)
  610. {
  611. Result ret = _pumpRoutine.Monitor();
  612. if (ret == Result.DONE)
  613. {
  614. return true;
  615. }
  616. if (ret == Result.FAIL || ret == Result.TIMEOUT)
  617. {
  618. //do nothing
  619. return true;
  620. }
  621. return false;
  622. }
  623. private bool FnPumpingToVent(object[] param)
  624. {
  625. _pumpRoutine.Abort();
  626. return FnStartVent(param);
  627. }
  628. private bool FnAbortPumping(object[] param)
  629. {
  630. _pumpRoutine.Abort();
  631. return true;
  632. }
  633. private bool FnStartPurge(object[] param)
  634. {
  635. return _cyclePurgeRoutine.Start(param) == Result.RUN;
  636. }
  637. private bool FnPurgeTimeout(object[] param)
  638. {
  639. Result ret = _cyclePurgeRoutine.Monitor();
  640. if (ret == Result.DONE)
  641. {
  642. return true;
  643. }
  644. else if (ret == Result.FAIL || ret == Result.TIMEOUT)
  645. {
  646. return true;
  647. }
  648. return false;
  649. }
  650. private bool FnAbortPurge(object[] param)
  651. {
  652. _cyclePurgeRoutine.Abort();
  653. return true;
  654. }
  655. #endregion Subroutine
  656. #region Transfer
  657. private bool FnStartPrepareTransfer(object[] param)
  658. {
  659. if (param.Length > 1)
  660. _prepareTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (float)param[1]);
  661. else
  662. _prepareTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), 0);
  663. Result ret = _prepareTrans.Start();
  664. if (ret == Result.FAIL || ret == Result.DONE)
  665. return false;
  666. return ret == Result.RUN;
  667. }
  668. private bool FnPreTransferTimeout(object[] param)
  669. {
  670. Result ret = _prepareTrans.Monitor();
  671. if (ret == Result.FAIL)
  672. {
  673. PostMsg(MSG.Abort);
  674. return false;
  675. }
  676. return ret == Result.DONE;
  677. }
  678. private bool FnStartPostTransfer(object[] param)
  679. {
  680. Result ret = _postTrans.Start();
  681. if (ret == Result.FAIL)
  682. {
  683. PostMsg(MSG.Error);
  684. return false;
  685. }
  686. return ret == Result.RUN;
  687. }
  688. private bool FnPostTransferTimeout(object[] param)
  689. {
  690. Result ret = _postTrans.Monitor();
  691. if (ret == Result.FAIL)
  692. {
  693. PostMsg(MSG.Abort);
  694. return false;
  695. }
  696. return ret == Result.DONE;
  697. }
  698. private bool FnSetLiftpin(object[] param)
  699. {
  700. MovementPosition pos = (MovementPosition)param[0];
  701. _ActivatedActionID = (ushort)param[1];
  702. _chamber.SetLiftPin(pos, out _);
  703. EV.PostInfoLog(Module.ToString(), $"执行 lift pin {pos}");
  704. _goalLiftPin = pos;
  705. return true;
  706. }
  707. private bool FnLiftpinTimeout(object[] param)
  708. {
  709. if (_chamber.LiftPinPosition == _goalLiftPin)
  710. {
  711. EV.PostInfoLog(Module.ToString(), $"lift pin 当前位置 {_chamber.LiftPinPosition}");
  712. Singleton<RouteManager>.Instance.EFEM.PostMsg(
  713. _goalLiftPin == MovementPosition.Up ? EfemEntity.MSG.PMLiftPinUp : EfemEntity.MSG.PMLiftPinDown, _ActivatedActionID);
  714. _goalLiftPin = MovementPosition.Unknown;
  715. _ActivatedActionID = 0;
  716. return true;
  717. }
  718. return false;
  719. }
  720. private bool FnSetGuidePin(object[] param)
  721. {
  722. WaferSize ws = (WaferSize)param[0];
  723. MovementPosition pos = (MovementPosition)param[1];
  724. if (ws == WaferSize.WS3)
  725. {
  726. _chamber.SetGuidePin3Inch(pos);
  727. }
  728. else if (ws == WaferSize.WS4)
  729. {
  730. _chamber.SetGuidePin4Inch(pos);
  731. }
  732. return true;
  733. }
  734. private bool FnGuidePinTimeout(object[] param)
  735. {
  736. return true;
  737. }
  738. #endregion Transfer
  739. #region Process
  740. private bool FnProcessLoadRecipe(object[] param)
  741. {
  742. _processStatus = "Succeed to load recipe";
  743. _recipeStartTime = DateTime.Now;
  744. Result ret = _preProcessRoutine.LoadRecipe(param);
  745. if (ret == Result.DONE)
  746. {
  747. PostMsg(MSG.PreProcess);
  748. }
  749. else if (ret == Result.FAIL)
  750. {
  751. _processStatus = "Failed to load recipe";
  752. return false;
  753. }
  754. return true;
  755. }
  756. private bool FnStartPreProcess(object[] param)
  757. {
  758. _pumpStartTime = DateTime.Now;
  759. //_processStatus = Resources.PMEntity_fStartPreProcess_PreparingRunningRecipe;
  760. Result ret = _preProcessRoutine.Start(param);
  761. if (ret == Result.DONE)
  762. {
  763. return false;
  764. }
  765. if (ret == Result.FAIL || ret == Result.VERIFYFAIL)
  766. {
  767. //_processStatus = Resources.PMEntity_fStartPreProcess_PreparingRunningRecipeFailed;
  768. PostMsg(MSG.Error);
  769. return false; //do noting
  770. }
  771. WaferManager.Instance.UpdateWaferProcessStatus(this.Module, 0, EnumWaferProcessStatus.InProcess);
  772. return true;
  773. }
  774. private bool FnPreProcessTimeout(object[] param)
  775. {
  776. //_processStatus = Resources.PMEntity_fPreProcess_RunRecipePumpingDown;
  777. Result ret = _preProcessRoutine.Monitor();
  778. if (ret == Result.DONE)
  779. {
  780. PostMsg(MSG.Process,
  781. _preProcessRoutine.CurrentRecipeBaseName,
  782. _preProcessRoutine.CurrentRecipeRunningName,
  783. 0,
  784. _preProcessRoutine.CurrentLotName,
  785. _preProcessRoutine.CurrentRecipeContent,
  786. _preProcessRoutine.CurrentRecipeHead,
  787. _preProcessRoutine.CurrentRecipeStepList);
  788. return true;
  789. }
  790. if (ret == Result.FAIL)
  791. {
  792. //_processStatus = Resources.PMEntity_fPreProcess_RunRecipePumpingDownFailed;
  793. PostMsg(MSG.Error);
  794. return true;
  795. }
  796. return false; ;
  797. }
  798. private bool FnAbortPreProcess(object[] param)
  799. {
  800. //_processStatus = Resources.PMEntity_fAbortPreProcess_RunRecipePumpingDownAborted;
  801. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  802. _preProcessRoutine.Abort();
  803. return true;
  804. }
  805. private bool FnStartProcess(object[] param)
  806. {
  807. //_processStatus = Resources.PMEntity_fStartProcess_StartRunningRecipe;
  808. Result ret = _processRoutine.Start(param);
  809. if (ret == Result.DONE)
  810. {
  811. return true;
  812. }
  813. else if (ret == Result.FAIL || ret == Result.VERIFYFAIL)
  814. {
  815. //_processStatus = Resources.PMEntity_fStartProcess_RunRecipeFailed;
  816. PostMsg(MSG.Error);
  817. return true; //do noting
  818. }
  819. return true;
  820. }
  821. private bool FnProcessTimeout(object[] param)
  822. {
  823. //_processStatus = Resources.PMEntity_fProcess_RunningRecipe;
  824. Result ret = _processRoutine.Monitor();
  825. {
  826. if (ret == Result.DONE)
  827. {
  828. PostMsg(MSG.PostProcess, _processRoutine.CurrentRecipeRunningName, _processRoutine.CurrentRecipeContent);
  829. return true;
  830. }
  831. else if (ret == Result.FAIL)
  832. {
  833. //_processStatus = Resources.PMEntity_fStartProcess_RunRecipeFailed;
  834. PostMsg(MSG.Error);
  835. return true;
  836. }
  837. return false;
  838. }
  839. }
  840. private bool FnAbortProcess(object[] param)
  841. {
  842. //_processStatus = Resources.PMEntity_fAbortProcess_RunningRecipeAborted;
  843. _processRoutine.AbortRecipe();
  844. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  845. Result ret = _postProcessRoutine.Start(new object[] { _processRoutine.CurrentRecipeRunningName, _processRoutine.CurrentRecipeContent });
  846. if (ret == Result.DONE)
  847. {
  848. return false;
  849. }
  850. else if (ret == Result.FAIL)
  851. {
  852. PostMsg(MSG.Error);
  853. //_processStatus = Resources.PMEntity_fAbortProcess_RunRecipeAborted;
  854. return false; //do noting
  855. }
  856. return true;
  857. }
  858. private bool FnPauseProcess(object[] param)
  859. {
  860. throw new NotImplementedException();
  861. }
  862. private bool FnResumeRecipe(object[] param)
  863. {
  864. throw new NotImplementedException();
  865. }
  866. private bool FnUpdateRecipe(object[] param)
  867. {
  868. throw new NotImplementedException();
  869. }
  870. private bool FnSkipStep(object[] param)
  871. {
  872. _processRoutine.SkipCurrentRecipeStep();
  873. return true;
  874. }
  875. private bool FnExitProcess(object[] param)
  876. {
  877. _processRoutine.Exit();
  878. return true;
  879. }
  880. private bool FnEnterProcess(object[] param)
  881. {
  882. return true;
  883. }
  884. private bool FnStartPostProcess(object[] param)
  885. {
  886. //_processStatus = Resources.PMEntity_fStartPostProcess_RunRecipePostProcess;
  887. Result ret = _postProcessRoutine.Start(param);
  888. if (ret == Result.DONE)
  889. {
  890. return false;
  891. }
  892. else if (ret == Result.FAIL)
  893. {
  894. PostMsg(MSG.Error);
  895. return false;
  896. }
  897. return true;
  898. }
  899. private bool FnPostProcessTimeout(object[] param)
  900. {
  901. //_processStatus = Resources.PMEntity_fPostProcess_RunRecipeCyclePurge;
  902. Result ret = _postProcessRoutine.Monitor();
  903. if (ret == Result.DONE)
  904. {
  905. WaferManager.Instance.UpdateWaferProcessStatus(this.Module, 0, EnumWaferProcessStatus.Completed);
  906. //_processStatus = Resources.PMEntity_fPostProcess_RecipeCompleted;
  907. return true;
  908. }
  909. else if (ret == Result.FAIL)
  910. {
  911. //_processStatus = Resources.PMEntity_fPostProcess_RunRecipeCyclePurgeError;
  912. PostMsg(MSG.Error);
  913. return true;
  914. }
  915. return false;
  916. }
  917. private bool FnAbortPostProcess(object[] param)
  918. {
  919. //_processStatus = Resources.PMEntity_fAbortPostProcess_RecipeAborted;
  920. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  921. _postProcessRoutine.Abort();
  922. return true;
  923. }
  924. private bool fExitPostProcess(object[] objs)
  925. {
  926. _postProcessRoutine.Exit();
  927. //EV.Notify(EventLotFinished, new SerializableDictionary<string, string>()
  928. //{
  929. // {DVIDName.LotId, preProcessRoutine.CurrentLotName},
  930. // {DVIDName.JobId, preProcessRoutine.CurrentJobName},
  931. // {DVIDName.RecipeId, preProcessRoutine.CurrentRecipeBaseName }
  932. //});
  933. return true;
  934. }
  935. #endregion PROCESS
  936. private string GetFsmLastMessage()
  937. {
  938. int msg = fsm.LastMsg;
  939. if (msg >= (int)MSG.Home && msg <= (int)MSG.MaxMsg)
  940. return ((MSG)msg).ToString();
  941. if (msg == (int)FSM_MSG.TIMER)
  942. return "Timer";
  943. return msg.ToString();
  944. }
  945. protected override void Term()
  946. {
  947. }
  948. private bool FnReset(object[] param)
  949. {
  950. if ((PMState)fsm.State == PMState.Error)
  951. return true;
  952. return false;
  953. }
  954. public bool Check(int msg, out string reason, object[] objs)
  955. {
  956. reason = "";
  957. return true;
  958. }
  959. public bool IsProcessed()
  960. {
  961. return IsIdle;
  962. }
  963. public bool IsPrepareTransferReady(ModuleName robot, EnumTransferType type, int slot)
  964. {
  965. if (type == EnumTransferType.Pick)
  966. {
  967. return _chamber.CheckEnableTransfer(type);
  968. }
  969. else if (type == EnumTransferType.Place)
  970. {
  971. return _chamber.CheckEnableTransfer(type);
  972. }
  973. return false;
  974. }
  975. public void Home()
  976. {
  977. CheckToPostMessage((int)MSG.Home);
  978. }
  979. private bool FnExitHome(object[] param)
  980. {
  981. return true;
  982. }
  983. private bool FnEnterHome(object[] param)
  984. {
  985. return true;
  986. }
  987. private bool FnStartHome(object[] objs)
  988. {
  989. Result ret = _home.Start();
  990. if (ret == Result.FAIL || ret == Result.DONE)
  991. return false;
  992. return ret == Result.RUN;
  993. }
  994. private bool FnMonitorHome(object[] objs)
  995. {
  996. Result ret = _home.Monitor();
  997. if (ret == Result.FAIL)
  998. {
  999. PostMsg(MSG.Error);
  1000. return false;
  1001. }
  1002. return ret == Result.DONE;
  1003. }
  1004. private bool fExitTransfer(object[] objs)
  1005. {
  1006. return true;
  1007. }
  1008. private bool FnError(object[] objs)
  1009. {
  1010. Running = false;
  1011. if (IsProcessing)
  1012. {
  1013. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  1014. }
  1015. return true;
  1016. }
  1017. private bool FnIdle(object[] objs)
  1018. {
  1019. Running = false;
  1020. return true;
  1021. }
  1022. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
  1023. {
  1024. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString()))
  1025. return (int)MSG.PrepareTransfer;
  1026. return (int)FSM_MSG.NONE;
  1027. }
  1028. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp)
  1029. {
  1030. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp))
  1031. return (int)MSG.PrepareTransfer;
  1032. return (int)FSM_MSG.NONE;
  1033. }
  1034. public int InvokePostTransfer(ModuleName robot, EnumTransferType type, int slot)
  1035. {
  1036. if (CheckToPostMessage((int)MSG.PostTransfer, type.ToString()))
  1037. return (int)MSG.PostTransfer;
  1038. return (int)FSM_MSG.NONE;
  1039. }
  1040. public int InvokeProcess(string recipeName)
  1041. {
  1042. if (CheckToPostMessage((int)MSG.RunRecipe, recipeName))
  1043. return (int)MSG.RunRecipe;
  1044. return (int)FSM_MSG.NONE;
  1045. }
  1046. public int InvokePreHeat(float temperature)
  1047. {
  1048. if (CheckToPostMessage((int)MSG.Heat, (double)temperature))
  1049. return (int)MSG.Heat;
  1050. return (int)FSM_MSG.NONE;
  1051. }
  1052. public void InvokeReset()
  1053. {
  1054. PostMsg((int)MSG.Reset);
  1055. }
  1056. public void SetAuto()
  1057. {
  1058. this._AutoMode = AutoFlag.Auto;
  1059. }
  1060. }
  1061. }