PMEntity.cs 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752
  1. using System;
  2. using System.Collections.Generic;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Device;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.RT.Fsm;
  8. using Aitex.Core.RT.OperationCenter;
  9. using Aitex.Core.RT.SCCore;
  10. using Aitex.Core.Util;
  11. using Aitex.Sorter.Common;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.Schedulers;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using Venus_Core;
  16. using Venus_RT.Devices;
  17. using Aitex.Core.RT.Log;
  18. using Aitex.Core.UI.DeviceControl;
  19. using MECF.Framework.Common.DataCenter;
  20. using Aitex.Core.RT.DataCollection;
  21. using System.Linq;
  22. namespace Venus_RT.Modules.PMs
  23. {
  24. public class RecipeRunningInfo
  25. {
  26. public Guid InnerId { get; set; }
  27. public RecipeHead Head { get; set; }
  28. public List<RecipeStep> RecipeStepList { get; set; }
  29. public string RecipeName { get; set; }
  30. public DateTime BeginTime { get; set; }
  31. public DateTime EndTime { get; set; }
  32. public int StepNumber { get; set; }
  33. public string StepName { get; set; }
  34. public double StepTime { get; set; }
  35. public double StepElapseTime { get; set; }
  36. public double TotalTime { get; set; }
  37. public double TotalElapseTime { get; set; }
  38. }
  39. public class PMEntity : Entity, IModuleEntity
  40. {
  41. public enum PMStatus
  42. {
  43. Not_Ready,
  44. Ready_For_Pick,
  45. Ready_For_Place,
  46. Exchange_Ready,
  47. }
  48. public enum MSG
  49. {
  50. Home,
  51. Transfer,
  52. PrepareTransfer,
  53. PostTransfer,
  54. Reset,
  55. Abort,
  56. Error,
  57. LaunchPump,
  58. LaunchTurboPump,
  59. Pump,
  60. Vent,
  61. PumpLoadLock,
  62. VentLoadLock,
  63. PurgeLoadLock,
  64. LoadLockLeakCheck,
  65. CyclePurge,
  66. GasLinePurge,
  67. Heat,
  68. TransferHandoff,
  69. StartTransfer,
  70. LeakCheck,
  71. GasLeakCheck,
  72. MoveLiftPin,
  73. MoveGuidePin,
  74. PartialPressure,
  75. VATPerformance,
  76. LLPlace,
  77. LLPick,
  78. Process,
  79. RunRecipe,
  80. PostProcess,
  81. RecipeSkipStep,
  82. RecipeUpdate,
  83. RecipeResume,
  84. RecipePause,
  85. RecipeAbort,
  86. PreProcess,
  87. AutoMode,
  88. ManualMode,
  89. LockLid,
  90. Clean,
  91. Online,
  92. Offline,
  93. GasFlow,
  94. StopGasFlow,
  95. RfPower,
  96. MFCVerification,
  97. // exchange wafer with TM
  98. PreparePick,
  99. PreparePlace,
  100. LiftUpWafer,
  101. DropDownWafer,
  102. PickReady,
  103. PlaceReady,
  104. MaxMsg
  105. }
  106. private readonly JetPMBase _chamber;
  107. public ModuleName Module { get; }
  108. public PMStatus Status { get; private set; }
  109. private StatsDataItem _statProcessedWafer;
  110. private StatsDataItemRFAndPump _statRfOnTime;
  111. private StatsDataItemRFAndPump _statBiasRfOnTime;
  112. //private StatsDataItemRFAndPump _statPumpOnTime;
  113. private readonly PMHomeRoutine _home;
  114. private readonly StartDryPumpRoutine _startDryPumpRoutine;
  115. private readonly StartTurboPumpRoutine _startTurboPumpRoutine;
  116. private readonly VentRoutine _ventRoutine;
  117. private readonly VenusVentRoutine _venusVentRoutine;
  118. private readonly PumpDownRoutine _pumpRoutine;
  119. //private readonly LoadLockVentRoutine _ventLoadLockRoutine;
  120. //private readonly LoadLockPumpRoutine _pumpLoadLockRoutine;
  121. //private readonly LoadLockPurgeRoutine _purgeLoadLockRoutine;
  122. //private readonly LoadLockLeakCheckRoutine _loadLockLeakCheckRoutine;
  123. private readonly PMPurgeRoutine _purgeRoutine;
  124. private readonly PMGaslinePurgeRoutine _gaslinePurgeRoutine;
  125. private readonly PMLeakCheckRoutine _leakCheckRoutine;
  126. private readonly GasBoxLeakCheckRoutine _gasBoxLeakCheckRoutine;
  127. //private readonly LLPlaceRoutine _llPlaceRoutine;
  128. //private readonly LLPickRoutine _llPickRoutine;
  129. private readonly PMProcessRoutine _processRoutine;
  130. private readonly GasFlowRoutine _gasFlowRoutine;
  131. private readonly RFPowerSwitchRoutine _rfPowerRoutine;
  132. private readonly PMGasVerificationRoutine _gasVerificationRoutine;
  133. private readonly PMPartialPressureRoutine _pmPartialPressureRoutine;
  134. private readonly PMVATPerformanceRoutine _pmVATPerformanceRoutine;
  135. //private readonly PMHeatRoutine _pmHeatRoutine;
  136. private DateTime _lastProcessDone;
  137. private AutoFlag _AutoMode;
  138. private bool _isOnline = false;
  139. //private bool _isAlarm;
  140. //private DateTime _pumpStartTime;
  141. //private TimeSpan _pumpElapsedTime;
  142. //private DateTime _rfStartTime;
  143. //private DateTime _tcStartTime;
  144. //private TimeSpan _rfElapsedTime;
  145. //private TimeSpan _tcElapsedTime;
  146. //private MovementPosition _goalLiftPin;
  147. //private ushort _ActivatedActionID;
  148. //private Stopwatch _LifpinSleepTimer;
  149. private bool startControlPressureFlag = true;
  150. //private bool stopControlPressureFlag = false;
  151. private int _controlPressureSetPoint = 90;
  152. private int _controlFlowSetPoint = 90;
  153. public DateTime LastProcessDone => _lastProcessDone;
  154. public JetChamber ChamberType => _chamber.ChamberType;
  155. public bool IsIdle
  156. {
  157. get { return fsm.State == (int)PMState.Idle; }
  158. }
  159. public bool IsError
  160. {
  161. get { return fsm.State == (int)PMState.Error; }
  162. }
  163. public bool IsInit
  164. {
  165. get { return fsm.State == (int)PMState.Init; }
  166. }
  167. public bool IsBusy
  168. {
  169. get { return !IsInit && !IsError && !IsIdle; }
  170. }
  171. public bool IsProcessing
  172. {
  173. get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
  174. }
  175. public bool IsOnline
  176. {
  177. get { return _isOnline; }
  178. }
  179. public bool IsInclude
  180. {
  181. get;
  182. private set;
  183. } = true;
  184. private Dictionary<string, int> _dictRecipeTime = new Dictionary<string, int>();
  185. public override int TimeToReady
  186. {
  187. get
  188. {
  189. switch ((PMState)fsm.State)
  190. {
  191. case PMState.Processing:
  192. case PMState.Clean:
  193. if (Singleton<RouteManager>.Instance.IsAutoMode && IsOnline)
  194. {
  195. if (_dictRecipeTime.ContainsKey(_processRoutine.currentRecipeResult.RecipeName))
  196. {
  197. return Math.Max(_dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] - fsm.ElapsedTime, 0);
  198. }
  199. }
  200. break;
  201. }
  202. return int.MaxValue / 2;
  203. }
  204. }
  205. public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
  206. public bool IsSlitDoorOpen => _chamber.CheckSlitDoorOpen();
  207. public bool IsSlitDoorClose => _chamber.CheckSlitDoorClose();
  208. public bool LiftPinIsDown => _chamber.LiftPinIsDown;
  209. public bool LiftPinIsUp => _chamber.LiftPinIsUp;
  210. public double ChamberPressure => _chamber.ChamberPressure;
  211. public double ProcessPressure => _chamber.ProcessPressure;
  212. public bool IsVac => _chamber.IsVAC;
  213. public bool IsAtm => _chamber.IsATM;
  214. public float ChamberTemperature => _chamber.ChamberTemperature;
  215. public bool Check(int msg, out string reason, object[] objs)
  216. {
  217. reason = "";
  218. return true;
  219. }
  220. //
  221. private bool CheckToPostMessage(int msg, params object[] args)
  222. {
  223. if (!fsm.FindTransition(fsm.State, msg))
  224. {
  225. EV.PostWarningLog(Module.ToString(), eEvent.WARN_State, $"{Module} is in {(PMState)fsm.State} state,can not do {(MSG)msg}");
  226. return false;
  227. }
  228. fsm.PostMsg(msg, args);
  229. return true;
  230. }
  231. public int Invoke(string function, params object[] args)
  232. {
  233. switch (function)
  234. {
  235. case "Home":
  236. CheckToPostMessage((int)MSG.Home);
  237. return (int)MSG.Home;
  238. }
  239. return (int)FSM_MSG.NONE;
  240. }
  241. public bool CheckAcked(int msg)
  242. {
  243. return fsm.CheckExecuted(msg);
  244. }
  245. public void ResetRecipeTime()
  246. {
  247. if (RtInstance.ConfigType == ConfigType.Kepler2200)
  248. {
  249. return;
  250. }
  251. _dictRecipeTime.Clear();
  252. }
  253. public bool IsPrepareTransferReady(ModuleName robot, EnumTransferType type, int slot, Hand blade)
  254. {
  255. //if (type == EnumTransferType.Pick)
  256. //{
  257. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(_chamber.Module, 0).Size);
  258. //}
  259. //else if (type == EnumTransferType.Place)
  260. //{
  261. // return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(robot, (int)blade).Size);
  262. //}
  263. return false;
  264. }
  265. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
  266. {
  267. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString()))
  268. return (int)MSG.PrepareTransfer;
  269. return (int)FSM_MSG.NONE;
  270. }
  271. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp)
  272. {
  273. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp))
  274. return (int)MSG.PrepareTransfer;
  275. return (int)FSM_MSG.NONE;
  276. }
  277. public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp, WaferSize size)
  278. {
  279. if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp, size))
  280. return (int)MSG.PrepareTransfer;
  281. return (int)FSM_MSG.NONE;
  282. }
  283. public int InvokePostTransfer(ModuleName robot, EnumTransferType type, int slot)
  284. {
  285. if (CheckToPostMessage((int)MSG.PostTransfer, type.ToString()))
  286. return (int)MSG.PostTransfer;
  287. return (int)FSM_MSG.NONE;
  288. }
  289. public int InvokeClean(string recipeName, string waferID, RecipeType recipeType)
  290. {
  291. if (CheckToPostMessage((int)MSG.Clean, recipeName, waferID, recipeType))
  292. {
  293. return (int)MSG.Clean;
  294. }
  295. return (int)FSM_MSG.NONE;
  296. }
  297. public int InvokeProcess(string recipeName, string waferID, RecipeType recipeType)
  298. {
  299. if (CheckToPostMessage((int)MSG.RunRecipe, recipeName, waferID, recipeType))
  300. return (int)MSG.RunRecipe;
  301. return (int)FSM_MSG.NONE;
  302. }
  303. public int InvokePreHeat(float temperature)
  304. {
  305. if (CheckToPostMessage((int)MSG.Heat, (double)temperature))
  306. return (int)MSG.Heat;
  307. return (int)FSM_MSG.NONE;
  308. }
  309. public void InvokeReset()
  310. {
  311. PostMsg((int)MSG.Reset);
  312. }
  313. public void SetAuto()
  314. {
  315. this._AutoMode = AutoFlag.Auto;
  316. }
  317. private bool FnSetManual(object[] param)
  318. {
  319. if (fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
  320. {
  321. EV.PostWarningLog(Module.ToString(), $"{Module} is in {(PMState)fsm.State},can not do SetAutoMode");
  322. return false;
  323. }
  324. this._AutoMode = AutoFlag.Manual;
  325. if (IsOnline)
  326. {
  327. EV.PostWarningLog(Module.ToString(), $"{Module} is online,change to offline due to the chamber change to manual mode");
  328. this._isOnline = false;
  329. }
  330. return true;
  331. }
  332. private bool FnSetInclude()
  333. {
  334. if (IsOnline == true)
  335. {
  336. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Include");
  337. return false;
  338. }
  339. IsInclude = true;
  340. LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Include Success");
  341. return true;
  342. }
  343. private bool FnSetExclude()
  344. {
  345. if (IsOnline == true)
  346. {
  347. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Exclude");
  348. return false;
  349. }
  350. IsInclude = false;
  351. LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Exclude Success");
  352. return true;
  353. }
  354. private bool FnSetOnline(object[] param)
  355. {
  356. //if (!IsAutoMode)
  357. //{
  358. // EV.PostWarningLog(Module.ToString(), $"{Module} in manual mode,can not set online.");
  359. // return false;
  360. //}
  361. if (!IsInclude)
  362. {
  363. LOG.Write(eEvent.WARN_PM, Module, $"{Module} is excluded,can not be put online");
  364. return false;
  365. }
  366. if (!_chamber.HomeIsOK(out string reason))
  367. {
  368. LOG.Write(eEvent.WARN_PM, Module, $"{Module} {reason},can not be put online");
  369. return false;
  370. }
  371. if (!_chamber.CheckSlitDoorClose())
  372. {
  373. EV.PostWarningLog(Module.ToString(), $"{Module} slit door is open,can not set online.");
  374. return false;
  375. }
  376. this._isOnline = true;
  377. return true;
  378. }
  379. private bool FnSetOffline(object[] param)
  380. {
  381. this._isOnline = false;
  382. return true;
  383. }
  384. private List<eEvent> stopEntityId = new List<eEvent>()
  385. {
  386. eEvent.ERR_MATCH,
  387. eEvent.ERR_RF,
  388. eEvent.ERR_PENDULUM_VALVE,
  389. eEvent.ERR_DEVICE_INFO,
  390. eEvent.ERR_DRY_PUMP,
  391. eEvent.ERR_HighTemperatureHeater,
  392. eEvent.ERR_HighTemperatureHeater_SetRatio_OverRange,
  393. eEvent.ERR_HighTemperatureHeater_SetTemperature_OverRange,
  394. eEvent.ERR_HighTemperatureHeater_GoPosition1TimeOut,
  395. eEvent.ERR_HighTemperatureHeater_GoPosition2TimeOut,
  396. eEvent.ERR_HighTemperatureHeater_GoPosition3TimeOut,
  397. eEvent.ERR_HighTemperatureHeater_GoPosition4TimeOut,
  398. eEvent.ERR_HighTemperatureHeater_GoPosition5TimeOut,
  399. eEvent.ERR_HighTemperatureHeater_GoOriginTimeOut,
  400. eEvent.ERR_HighTemperatureHeater_TransferPosition,
  401. eEvent.ERR_PM_PLC_HEARTBEAT_FAIL
  402. };
  403. public PMEntity(ModuleName module)
  404. {
  405. Module = module;
  406. _chamber = DEVICE.GetDevice<JetPMBase>(Module.ToString());
  407. _home = new PMHomeRoutine(_chamber);
  408. _startDryPumpRoutine = new StartDryPumpRoutine(_chamber);
  409. _startTurboPumpRoutine = new StartTurboPumpRoutine(_chamber);
  410. _ventRoutine = new VentRoutine(_chamber);
  411. _venusVentRoutine = new VenusVentRoutine(_chamber);
  412. _pumpRoutine = new PumpDownRoutine(_chamber);
  413. //_ventLoadLockRoutine = new LoadLockVentRoutine(_chamber);
  414. //_pumpLoadLockRoutine = new LoadLockPumpRoutine(_chamber);
  415. //_purgeLoadLockRoutine = new LoadLockPurgeRoutine(_chamber);
  416. //_loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
  417. _purgeRoutine = new PMPurgeRoutine(_chamber);
  418. _gaslinePurgeRoutine = new PMGaslinePurgeRoutine(_chamber, _pumpRoutine);
  419. _leakCheckRoutine = new PMLeakCheckRoutine(_chamber);
  420. _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
  421. //_llPlaceRoutine = new LLPlaceRoutine(_chamber);
  422. //_llPickRoutine = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
  423. _processRoutine = new PMProcessRoutine(_chamber, _pumpRoutine);
  424. _gasFlowRoutine = new GasFlowRoutine(_chamber);
  425. _rfPowerRoutine = new RFPowerSwitchRoutine(_chamber, true);
  426. _gasVerificationRoutine = new PMGasVerificationRoutine(_chamber, _pumpRoutine);
  427. _pmPartialPressureRoutine = new PMPartialPressureRoutine(_chamber);
  428. _pmVATPerformanceRoutine = new PMVATPerformanceRoutine(_chamber);
  429. //_pmControlPressureRoutine = new PMControlPressureRoutine(_chamber);
  430. //_pmHeatRoutine = new PMHeatRoutine(_chamber);
  431. fsm = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
  432. //Idle
  433. EnterExitTransition((int)PMState.Idle, FnIdle, (int)FSM_MSG.NONE, null);
  434. EnterExitTransition<PMState, FSM_MSG>(PMState.Error, fEnterError, FSM_MSG.NONE, null);
  435. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPick, fnEnterPickReady, FSM_MSG.NONE, fnExitPickReady);
  436. EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPlace, fnEnterPlaceReady, FSM_MSG.NONE, fnExitPlaceReady);
  437. EnterExitTransition<PMState, FSM_MSG>(PMState.DropDownReady, fnEnterDropDownReady, FSM_MSG.NONE, fnExitDropDownReady);
  438. EnterExitTransition<PMState, FSM_MSG>(PMState.LiftUpReady, fnEnterLiftUpReady, FSM_MSG.NONE, fnExitLiftUpReady);
  439. EnterExitTransition<PMState, FSM_MSG>(PMState.LeakCheck, fnEnterLeakCheck, FSM_MSG.NONE, fnExitLeakCheck);
  440. EnterExitTransition<PMState, FSM_MSG>(PMState.GasBoxLeakCheck, fnEnterLeakCheck, FSM_MSG.NONE, fnExitLeakCheck);
  441. //Home
  442. //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
  443. AnyStateTransition(MSG.Error, FnError, PMState.Error);
  444. AnyStateTransition(MSG.Online, FnSetOnline, FSM_STATE.SAME);
  445. AnyStateTransition(MSG.Offline, FnSetOffline, FSM_STATE.SAME);
  446. AnyStateTransition(FSM_MSG.ALARM, FnAlarm, PMState.Error);
  447. Transition(PMState.Init, FSM_MSG.TIMER, FnTimeout, PMState.Init);
  448. Transition(PMState.Init, MSG.Home, FnStartHome, PMState.Homing);
  449. Transition(PMState.Error, MSG.Home, FnStartHome, PMState.Homing);
  450. Transition(PMState.Idle, MSG.Home, FnStartHome, PMState.Homing);
  451. Transition(PMState.Homing, MSG.Home, FnStartHome, PMState.Homing);
  452. Transition(PMState.Homing, FSM_MSG.TIMER, FnMonitorHome, PMState.Idle);
  453. Transition(PMState.Homing, MSG.Abort, FnAbortHome, PMState.Idle);
  454. Transition(PMState.Idle, FSM_MSG.TIMER, FnIdleTimeout, PMState.Idle);
  455. Transition(PMState.Error, FSM_MSG.TIMER, FnErrorTimeout, PMState.Error);
  456. //Launch DryPump sequence
  457. Transition(PMState.Idle, MSG.LaunchPump, FnLaunchPump, PMState.LaunchingPump);
  458. Transition(PMState.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, PMState.Idle);
  459. Transition(PMState.LaunchingPump, MSG.Abort, FnAbortStartPumping, PMState.Idle);
  460. //Launch TurboPump sequence
  461. Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
  462. Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
  463. Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
  464. //vent sequence
  465. Transition(PMState.Idle, MSG.Vent, FnStartVent, PMState.Venting);
  466. Transition(PMState.Pumping, MSG.Vent, FnVentToPumping, PMState.Venting);
  467. Transition(PMState.Venting, FSM_MSG.TIMER, FnVentTimeout, PMState.Idle);
  468. Transition(PMState.Venting, MSG.Abort, FnAbortVent, PMState.Idle);
  469. //Pump sequence
  470. Transition(PMState.Idle, MSG.Pump, FnStartPumpDown, PMState.Pumping);
  471. Transition(PMState.Venting, MSG.Pump, FnVentToPumping, PMState.Pumping);
  472. Transition(PMState.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, PMState.Idle);
  473. Transition(PMState.Pumping, MSG.Abort, FnAbortPumping, PMState.Idle);
  474. //Pump Loadlock sequence
  475. //Transition(PMState.Idle, MSG.PumpLoadLock, FnStartPumpDownLoadLock, PMState.PumpingLoadLock);
  476. //Transition(PMState.VentingLoadLock, MSG.PumpLoadLock, FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
  477. //Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER, FnPumpDownLoadLockTimeout, PMState.Idle);
  478. //Transition(PMState.PumpingLoadLock, MSG.Abort, FnAbortPumpingLoadLock, PMState.Idle);
  479. //Vent Loadlock sequence
  480. //Transition(PMState.Idle, MSG.VentLoadLock, FnStartVentLoadlock, PMState.VentingLoadLock);
  481. //Transition(PMState.PumpingLoadLock, MSG.VentLoadLock, FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
  482. //Transition(PMState.VentingLoadLock, FSM_MSG.TIMER, FnVentLoadLockTimeout, PMState.Idle);
  483. //Transition(PMState.VentingLoadLock, MSG.Abort, FnAbortVentLoadLock, PMState.Idle);
  484. // Purge LoadLock sequence
  485. //Transition(PMState.Idle, MSG.PurgeLoadLock, FnStartPurgeLoadlock, PMState.PurgingLoadLock);
  486. //Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER, FnPurgeLoadLockTimeout, PMState.Idle);
  487. //Transition(PMState.PurgingLoadLock, MSG.Abort, FnAbortPurgeLoadLock, PMState.Idle);
  488. //LoadLock Leak check sequence
  489. //Transition(PMState.Idle, MSG.LoadLockLeakCheck, FnStartLoadLockLeakCheck, PMState.LoadLockLeakCheck);
  490. //Transition(PMState.LoadLockLeakCheck, FSM_MSG.TIMER, FnLoadLockLeakCheckTimeout, PMState.Idle);
  491. //Transition(PMState.LoadLockLeakCheck, MSG.Abort, FnAbortLoadLockLeakCheck, PMState.Idle);
  492. // PM Purge sequence
  493. Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
  494. Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
  495. Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
  496. // PM GasLine Purge sequence
  497. Transition(PMState.Idle, MSG.GasLinePurge, FnStartGasLinePurge, PMState.GasLinePurge);
  498. Transition(PMState.GasLinePurge, FSM_MSG.TIMER, FnGasLinePurgeTimeout, PMState.Idle);
  499. Transition(PMState.GasLinePurge, MSG.Abort, FnAbortGasLinePurge, PMState.Idle);
  500. //PM Leak check sequence
  501. Transition(PMState.Idle, MSG.LeakCheck, FnStartPMLeakCheck, PMState.LeakCheck);
  502. Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnPMLeakCheckTimeout, PMState.Idle);
  503. Transition(PMState.LeakCheck, MSG.Abort, FnAbortPMLeakCheck, PMState.Idle);
  504. //PM GasBox Leak check sequence
  505. Transition(PMState.Idle, MSG.GasLeakCheck, FnStartGasBoxLeakCheck, PMState.GasBoxLeakCheck);
  506. Transition(PMState.GasBoxLeakCheck, FSM_MSG.TIMER, FnGasBoxLeakCheckTimeout, PMState.Idle);
  507. Transition(PMState.GasBoxLeakCheck, MSG.Abort, FnAbortGasBoxLeakCheck, PMState.Idle);
  508. // PlaceWafer from LoadLock Arm sequence
  509. //Transition(PMState.Idle, MSG.LLPlace, FnStartLLPlace, PMState.LLPlacing);
  510. //Transition(PMState.LLPlacing, FSM_MSG.TIMER, FnLLPlaceTimeout, PMState.Idle);
  511. //Transition(PMState.LLPlacing, MSG.Abort, FnAbortLLPlace, PMState.Idle);
  512. // PickWafer to LoadLock Arm sequence
  513. //Transition(PMState.Idle, MSG.LLPick, FnStartLLPick, PMState.LLPicking);
  514. //Transition(PMState.LLPicking, FSM_MSG.TIMER, FnLLPickTimeout, PMState.Idle);
  515. //Transition(PMState.LLPicking, MSG.Abort, FnAbortLLPick, PMState.Idle);
  516. // Process
  517. Transition(PMState.Idle, MSG.RunRecipe, FnRunRecipe, PMState.Processing);
  518. Transition(PMState.Processing, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  519. Transition(PMState.Processing, MSG.Abort, FnAbortProcess, PMState.Idle);
  520. // Clean
  521. Transition(PMState.Idle, MSG.Clean, FnRunRecipe, PMState.Clean);
  522. Transition(PMState.Clean, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
  523. Transition(PMState.Clean, MSG.Abort, FnAbortProcess, PMState.Idle);
  524. // Gas Flow sequence
  525. Transition(PMState.Idle, MSG.GasFlow, FnStartGasFlow, PMState.GasFlowing);
  526. Transition(PMState.GasFlowing, MSG.GasFlow, FnAbortGasFlow, PMState.Idle);
  527. Transition(PMState.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, PMState.Idle);
  528. Transition(PMState.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, PMState.Idle);
  529. Transition(PMState.GasFlowing, MSG.Abort, FnAbortGasFlow, PMState.Idle);
  530. //RF Power sequence
  531. Transition(PMState.Idle, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  532. Transition(PMState.GasFlowing, MSG.RfPower, FnStartRfPower, PMState.RfPowering);
  533. Transition(PMState.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, PMState.Idle);
  534. Transition(PMState.RfPowering, MSG.Abort, FnAbortRfPower, PMState.Idle);
  535. //MFC verification
  536. Transition(PMState.Idle, MSG.MFCVerification, FnStartMFCVerification, PMState.MFCVerification);
  537. Transition(PMState.MFCVerification, FSM_MSG.TIMER, FnMFCVerificationTimeout, PMState.Idle);
  538. Transition(PMState.MFCVerification, MSG.Abort, FnAbortMFCVerification, PMState.Idle);
  539. //////////////////////// Exchange Wafer with TM ///////////////////////////////////////////////////////
  540. // Pick Wafer from PM
  541. Transition(PMState.Idle, MSG.PreparePick, FnStartPreparePick, PMState.PreparePick);
  542. Transition(PMState.PreparePick, MSG.Abort, FnAbortPreparePick, PMState.Idle);
  543. Transition(PMState.PreparePick, FSM_MSG.TIMER, FnPreparePickTimeout, PMState.ReadyForPick);
  544. Transition(PMState.PreparePick, MSG.PreparePick, null, PMState.PreparePick);
  545. Transition(PMState.ReadyForPick, MSG.Abort, FnAbortPick, PMState.Idle);
  546. Transition(PMState.ReadyForPick, MSG.DropDownWafer, FnStartDropDownWafer, PMState.DropDownWafer);
  547. Transition(PMState.ReadyForPick, MSG.PreparePick, null, PMState.ReadyForPick);
  548. Transition(PMState.DropDownWafer, FSM_MSG.TIMER, FnDropDownTimeout, PMState.DropDownReady);
  549. Transition(PMState.DropDownReady, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  550. Transition(PMState.ReadyForPick, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
  551. Transition(PMState.FinishPick, FSM_MSG.TIMER, FnFinishPickTimeout, PMState.Idle);
  552. // Place Wafer to PM
  553. Transition(PMState.Idle, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  554. //Transition(PMState.Heating, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  555. Transition(PMState.PreparePlace, MSG.Abort, FnAbortPreparePlace, PMState.Idle);
  556. Transition(PMState.PreparePlace, FSM_MSG.TIMER, FnPreparePlaceTimeout, PMState.ReadyForPlace);
  557. Transition(PMState.PreparePlace, MSG.PreparePlace, null, PMState.PreparePlace);
  558. Transition(PMState.ReadyForPlace, MSG.LiftUpWafer, FnStartLiftUpWafer, PMState.LiftUpWafer);
  559. Transition(PMState.LiftUpWafer, FSM_MSG.TIMER, FnLiftUpTimeout, PMState.LiftUpReady);
  560. Transition(PMState.LiftUpReady, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  561. Transition(PMState.ReadyForPlace, MSG.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
  562. Transition(PMState.PreparePlace, MSG.Abort, FnAortPlace, PMState.Idle);
  563. Transition(PMState.ReadyForPlace, MSG.Abort, FnAortPlace, PMState.Idle);
  564. Transition(PMState.ReadyForPlace, MSG.PreparePlace, null, PMState.ReadyForPlace);
  565. Transition(PMState.LiftUpReady, MSG.Abort, FnAortPlace, PMState.Idle);
  566. Transition(PMState.FinishPlace, FSM_MSG.TIMER, FnFinishPlaceTimeout, PMState.Idle);
  567. // Swap Wafer With PM
  568. Transition(PMState.DropDownReady, MSG.PreparePlace, FnStartSwapPlace, PMState.PreparePlace);
  569. Transition(PMState.ReadyForPick, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
  570. Transition(PMState.Idle, MSG.PartialPressure, FnStartPartialPressure, PMState.PartialPressureTesting);
  571. Transition(PMState.PartialPressureTesting, FSM_MSG.TIMER, FnPartialPressureTimeout, PMState.Idle);
  572. Transition(PMState.PartialPressureTesting, MSG.Abort, FnAbortPartialPressure, PMState.Idle);
  573. Transition(PMState.Idle, MSG.VATPerformance, FnStartVATPerformance, PMState.VATPerformanceTesting);
  574. Transition(PMState.VATPerformanceTesting, FSM_MSG.TIMER, FnVATPerformanceTimeout, PMState.Idle);
  575. Transition(PMState.VATPerformanceTesting, MSG.Abort, FnAbortVATPerformance, PMState.Idle);
  576. //Transition(PMState.Idle, MSG.Heat, FnStartHeat, PMState.Heating);
  577. AnyStateTransition(FSM_MSG.TIMER, FnControlPressure, FSM_STATE.SAME);
  578. Running = true;
  579. WaferManager.Instance.SubscribeLocation(Module, 1);
  580. }
  581. protected override bool Init()
  582. {
  583. DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State)), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  584. DATA.Subscribe($"{Module}.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  585. DATA.Subscribe($"{Module}.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  586. //DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  587. DATA.Subscribe($"{Module}.PartialPressureCounter", () => _pmPartialPressureRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  588. DATA.Subscribe($"{Module}.VATPerformanceCounter", () => _pmVATPerformanceRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  589. DATA.Subscribe($"{Module}.VATPerformanceResult", () => _pmVATPerformanceRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  590. DATA.Subscribe($"{Module}.PartialPressureResult", () => _pmPartialPressureRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  591. DATA.Subscribe($"{Module}.MFCCalibrationDatas", () => _gasVerificationRoutine?._MFCCalibrationDatas, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  592. DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  593. DATA.Subscribe($"{Module}.IsAlarm", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  594. DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  595. DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  596. DATA.Subscribe($"{Module}.IsOnline", () => _isOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  597. DATA.Subscribe($"{Module}.VentingFlag", () => ChamberType == JetChamber.VenusSE || ChamberType == JetChamber.VenusDE ? _venusVentRoutine.VentingFlag : _ventRoutine.VentingFlag, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  598. //DATA.Subscribe($"{Module}.GetLeakCheckDatas", () => LeakCheckDataRecorder.GetAllLeakCheckData(Module.ToString()));
  599. DATA.Subscribe($"{Module}.CurrentRecipeResult", () => _processRoutine.currentRecipeResult, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  600. DATA.Subscribe($"{Module}.LeakCheck.Step", () => _leakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  601. DATA.Subscribe($"{Module}.GasLeakCheck.Step", () => _gasBoxLeakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  602. DATA.Subscribe($"{Module}.IsInclude", () => IsInclude, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  603. OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
  604. OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
  605. OP.Subscribe($"{Module}.{RtOperation.GasLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.GasLeakCheck, args));
  606. OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
  607. OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
  608. OP.Subscribe($"{Module}.{RtOperation.StartTurboPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchTurboPump));
  609. OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
  610. OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
  611. OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower));
  612. OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
  613. OP.Subscribe($"{Module}.{RtOperation.VentLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.VentLoadLock));
  614. OP.Subscribe($"{Module}.{RtOperation.PurgeLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PurgeLoadLock));
  615. OP.Subscribe($"{Module}.{RtOperation.PumpLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PumpLoadLock));
  616. OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
  617. OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
  618. OP.Subscribe($"{Module}.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.LLPick));
  619. OP.Subscribe($"{Module}.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.LLPlace));
  620. OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args));
  621. OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, args));
  622. OP.Subscribe($"{Module}.{RtOperation.RunCleanRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.Clean, args));
  623. OP.Subscribe($"{Module}.PartialPressureTest", (cmd, args) => CheckToPostMessage((int)MSG.PartialPressure, args[0], args[1]));
  624. OP.Subscribe($"{Module}.VATPerformanceTest", (cmd, args) => CheckToPostMessage((int)MSG.VATPerformance, args[0], args[1], args[2]));
  625. OP.Subscribe($"{Module}.GasLinePurge", (cmd, args) => CheckToPostMessage((int)MSG.GasLinePurge, args[0]));
  626. OP.Subscribe($"{Module}.ManualEndStep", (cmd, args) => ManualEndStep());
  627. OP.Subscribe($"{Module}.{RtOperation.Online}", (cmd, args) => CheckToPostMessage((int)MSG.Online));
  628. OP.Subscribe($"{Module}.{RtOperation.Offline}", (cmd, args) => CheckToPostMessage((int)MSG.Offline));
  629. OP.Subscribe($"{Module}.{RtOperation.PmError}", (cmd, args) => CheckToPostMessage((int)MSG.Error));
  630. OP.Subscribe($"{Module}.{RtOperation.Include}", (cmd, args) => FnSetInclude());
  631. OP.Subscribe($"{Module}.{RtOperation.Exclude}", (cmd, args) => FnSetExclude());
  632. OP.Subscribe($"{Module}.SubscribeStatsData", (cmd, args) =>
  633. {
  634. StatsDataManager.Instance.Subscribe(args[0].ToString(), args[1].ToString());
  635. return true;
  636. });
  637. StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount", "Processed Wafer Count", 0);
  638. if (_chamber.IsRFAble())
  639. StatsDataManager.Instance.Subscribe($"{Module}.RfOnTime", "Rf On Time");
  640. if (_chamber.IsBiasRFAble())
  641. StatsDataManager.Instance.Subscribe($"{Module}.BiasRfOnTime", "Bias Rf On Time");
  642. StatsDataManager.Instance.Subscribe($"{Module}.PumpOnTime", "Pump On Time");
  643. _statProcessedWafer = StatsDataManager.Instance.GetItem($"{Module}.ProcessedWaferCount");
  644. _statRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.RfOnTime");
  645. if (_chamber.IsBiasRFAble())
  646. _statBiasRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRfOnTime");
  647. //_statPumpOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.PumpOnTime");
  648. DATA.Subscribe($"{Module}.WaferCounter", () => _statProcessedWafer.Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  649. if (_chamber.IsRFAble())
  650. DATA.Subscribe($"{Module}.RfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.RfOnTime"));
  651. if (_chamber.IsBiasRFAble())
  652. DATA.Subscribe($"{Module}.BiasRfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.BiasRfOnTime"));
  653. //DATA.Subscribe($"{Module}.PumpOnTime", () => _statPumpOnTime.fromLastPM);
  654. if (RtInstance.ConfigType==ConfigType.Kepler2200)
  655. {
  656. LOG.ModuleErrorInterrupt += (pmname, id) => PMErrorInterrupt(pmname, id);
  657. }
  658. return true;
  659. }
  660. private void PMErrorInterrupt(ModuleName pmname, eEvent eEventid)
  661. {
  662. if (pmname != Module)
  663. {
  664. return;
  665. }
  666. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_CONTINUEPROCESS || eEventid==eEvent.ERR_SENSOR_WATERFLOW_STOP_NEXTPROCESS)
  667. {
  668. this._isOnline = false;
  669. return;
  670. }
  671. if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_STOPPROCESS || eEventid == eEvent.ERR_SENSOR_WATERFLOW_STOP_CURRENTPROCESS)
  672. {
  673. if (fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.Clean)
  674. {
  675. CheckToPostMessage((int)MSG.Abort);
  676. }
  677. this._isOnline = false;
  678. return;
  679. }
  680. if (stopEntityId.Contains(eEventid) && fsm.State != (int)PMState.Error)
  681. {
  682. CheckToPostMessage((int)MSG.Error);
  683. }
  684. }
  685. private bool ManualEndStep()
  686. {
  687. _processRoutine.isMaualEndStep = true;
  688. return true;
  689. }
  690. private bool FnIdle(object[] objs)
  691. {
  692. Running = false;
  693. return true;
  694. }
  695. private bool fEnterError(object[] objs)
  696. {
  697. //DataCollectionManager.Instance.ManualInsertData();
  698. return true;
  699. }
  700. private bool fnEnterPickReady(object[] objs)
  701. {
  702. Status = PMStatus.Ready_For_Pick;
  703. return true;
  704. }
  705. private bool fnExitPickReady(object[] objs)
  706. {
  707. Status = PMStatus.Not_Ready;
  708. return true;
  709. }
  710. private bool fnEnterPlaceReady(object[] objs)
  711. {
  712. Status = PMStatus.Ready_For_Place;
  713. return true;
  714. }
  715. private bool fnExitPlaceReady(object[] objs)
  716. {
  717. Status = PMStatus.Not_Ready;
  718. return true;
  719. }
  720. private bool fnEnterDropDownReady(object[] objs)
  721. {
  722. Status = PMStatus.Exchange_Ready;
  723. return true;
  724. }
  725. private bool fnExitDropDownReady(object[] objs)
  726. {
  727. Status = PMStatus.Not_Ready;
  728. return true;
  729. }
  730. private bool fnEnterLiftUpReady(object[] objs)
  731. {
  732. Status = PMStatus.Exchange_Ready;
  733. return true;
  734. }
  735. private bool fnEnterLeakCheck(object[] objs)
  736. {
  737. _chamber.SetLeakCheckMode(true);
  738. return true;
  739. }
  740. private bool fnExitLeakCheck(object[] objs)
  741. {
  742. _chamber.SetLeakCheckMode(false);
  743. return true;
  744. }
  745. private bool fnExitLiftUpReady(object[] objs)
  746. {
  747. Status = PMStatus.Not_Ready;
  748. return true;
  749. }
  750. private bool FnAlarm(object[] objs)
  751. {
  752. if ((PMState)fsm.State == PMState.Processing)
  753. {
  754. }
  755. return true;
  756. }
  757. private bool FnError(object[] objs)
  758. {
  759. Running = false;
  760. _isOnline = false;
  761. //if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
  762. // || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
  763. // return false;
  764. //_chamber.CloseValves();
  765. //_chamber.GeneratorPowerOn(false);
  766. //_chamber.GeneratorBiasPowerOn(false);
  767. //_chamber.OpenValve(ValveType.TurboPumpPumping, true);
  768. //_chamber.OpenValve(ValveType.TurboPumpPurge, true);
  769. //_chamber.OnOffSetESCHV(false);
  770. _chamber.PMInError();
  771. if (IsProcessing)
  772. {
  773. WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
  774. }
  775. return true;
  776. }
  777. private bool FnTimeout(object[] objs)
  778. {
  779. _debugRoutine();
  780. return true;
  781. }
  782. private bool FnIdleTimeout(object[] objs)
  783. {
  784. _chamber.CheckIdleInterlock(0);
  785. //_debugRoutine();
  786. return true;
  787. }
  788. private bool FnErrorTimeout(object[] objs)
  789. {
  790. _chamber.CheckIdleInterlock(0);
  791. //_debugRoutine();
  792. return true;
  793. }
  794. private bool FnStartHome(object[] objs)
  795. {
  796. return _home.Start() == RState.Running;
  797. }
  798. private bool FnMonitorHome(object[] objs)
  799. {
  800. RState ret = _home.Monitor();
  801. if (ret == RState.Failed || ret == RState.Timeout)
  802. {
  803. PostMsg(MSG.Error);
  804. return false;
  805. }
  806. return ret == RState.End;
  807. }
  808. private bool FnAbortHome(object[] objs)
  809. {
  810. _home.Abort();
  811. return true;
  812. }
  813. private bool FnLaunchPump(object[] param)
  814. {
  815. return _startDryPumpRoutine.Start() == RState.Running;
  816. }
  817. private bool FnLaunchPumpTimeout(object[] param)
  818. {
  819. RState ret = _startDryPumpRoutine.Monitor();
  820. if (ret == RState.Failed || ret == RState.Timeout)
  821. {
  822. PostMsg(MSG.Error);
  823. return false;
  824. }
  825. return ret == RState.End;
  826. }
  827. private bool FnAbortStartPumping(object[] param)
  828. {
  829. _startDryPumpRoutine.Abort();
  830. return true;
  831. }
  832. private bool FnLaunchTurboPump(object[] param)
  833. {
  834. return _startTurboPumpRoutine.Start() == RState.Running;
  835. }
  836. private bool FnLaunchTurboPumpTimeout(object[] param)
  837. {
  838. RState ret = _startTurboPumpRoutine.Monitor();
  839. if (ret == RState.Failed || ret == RState.Timeout)
  840. {
  841. PostMsg(MSG.Error);
  842. return false;
  843. }
  844. return ret == RState.End;
  845. }
  846. private bool FnAbortStartTurboPumping(object[] param)
  847. {
  848. _startTurboPumpRoutine.Abort();
  849. return true;
  850. }
  851. private bool FnStartVent(object[] param)
  852. {
  853. switch (ChamberType)
  854. {
  855. case JetChamber.VenusSE:
  856. case JetChamber.VenusDE:
  857. return _venusVentRoutine.Start() == RState.Running;
  858. default:
  859. return _ventRoutine.Start() == RState.Running;
  860. }
  861. }
  862. private bool FnVentTimeout(object[] param)
  863. {
  864. RState ret;
  865. switch (ChamberType)
  866. {
  867. case JetChamber.VenusSE:
  868. case JetChamber.VenusDE:
  869. ret = _venusVentRoutine.Monitor();
  870. break;
  871. default:
  872. ret = _ventRoutine.Monitor();
  873. break;
  874. }
  875. if (ret == RState.Failed || ret == RState.Timeout)
  876. {
  877. PostMsg(MSG.Error);
  878. return false;
  879. }
  880. return ret == RState.End;
  881. }
  882. private bool FnVentToPumping(object[] param)
  883. {
  884. switch (ChamberType)
  885. {
  886. case JetChamber.VenusSE:
  887. case JetChamber.VenusDE:
  888. _venusVentRoutine.Abort();
  889. break;
  890. default:
  891. _ventRoutine.Abort();
  892. break;
  893. }
  894. return true; // FnStartPumpDown(param);
  895. }
  896. private bool FnAbortVent(object[] param)
  897. {
  898. switch (ChamberType)
  899. {
  900. case JetChamber.VenusSE:
  901. case JetChamber.VenusDE:
  902. _venusVentRoutine.Abort();
  903. break;
  904. default:
  905. _ventRoutine.Abort();
  906. break;
  907. }
  908. return true;
  909. }
  910. private bool FnStartPumpDown(object[] param)
  911. {
  912. return _pumpRoutine.Start() == RState.Running;
  913. }
  914. private bool FnPumpDownTimeout(object[] param)
  915. {
  916. RState ret = _pumpRoutine.Monitor();
  917. if (ret == RState.Failed || ret == RState.Timeout)
  918. {
  919. PostMsg(MSG.Error);
  920. return false;
  921. }
  922. return ret == RState.End;
  923. }
  924. private bool FnAbortPumping(object[] param)
  925. {
  926. _pumpRoutine.Abort();
  927. return true;
  928. }
  929. //private bool FnStartVentLoadlock(object[] param)
  930. //{
  931. // return _ventLoadLockRoutine.Start() == RState.Running;
  932. //}
  933. //private bool FnVentLoadLockTimeout(object[] param)
  934. //{
  935. // RState ret = _ventLoadLockRoutine.Monitor();
  936. // if (ret == RState.Failed || ret == RState.Timeout)
  937. // {
  938. // PostMsg(MSG.Error);
  939. // return false;
  940. // }
  941. // return ret == RState.End;
  942. //}
  943. //private bool FnVentLoadLockToPumpingLoadLock(object[] param)
  944. //{
  945. // _ventLoadLockRoutine.Abort();
  946. // return FnStartPumpDownLoadLock(param);
  947. //}
  948. //private bool FnAbortVentLoadLock(object[] param)
  949. //{
  950. // _ventLoadLockRoutine.Abort();
  951. // return true;
  952. //}
  953. //private bool FnStartPumpDownLoadLock(object[] param)
  954. //{
  955. // return _pumpLoadLockRoutine.Start() == RState.Running;
  956. //}
  957. //private bool FnPumpDownLoadLockTimeout(object[] param)
  958. //{
  959. // RState ret = _pumpLoadLockRoutine.Monitor();
  960. // if (ret == RState.Failed || ret == RState.Timeout)
  961. // {
  962. // PostMsg(MSG.Error);
  963. // return false;
  964. // }
  965. // return ret == RState.End;
  966. //}
  967. private bool FnPumpingToVent(object[] param)
  968. {
  969. _pumpRoutine.Abort();
  970. return FnStartVent(param);
  971. }
  972. //private bool FnPumpingLoadLockToVentLoadLock(object[] param)
  973. //{
  974. // _pumpLoadLockRoutine.Abort();
  975. // return FnStartVentLoadlock(param);
  976. //}
  977. //private bool FnAbortPumpingLoadLock(object[] param)
  978. //{
  979. // _pumpLoadLockRoutine.Abort();
  980. // return true;
  981. //}
  982. //private bool FnStartPurgeLoadlock(object[] param)
  983. //{
  984. // return _purgeLoadLockRoutine.Start() == RState.Running;
  985. //}
  986. //private bool FnPurgeLoadLockTimeout(object[] param)
  987. //{
  988. // RState ret = _purgeLoadLockRoutine.Monitor();
  989. // if (ret == RState.Failed || ret == RState.Timeout)
  990. // {
  991. // PostMsg(MSG.Error);
  992. // return false;
  993. // }
  994. // return ret == RState.End;
  995. //}
  996. //private bool FnAbortPurgeLoadLock(object[] param)
  997. //{
  998. // _purgeLoadLockRoutine.Abort();
  999. // return true;
  1000. //}
  1001. //private bool FnStartLoadLockLeakCheck(object[] param)
  1002. //{
  1003. // return _loadLockLeakCheckRoutine.Start() == RState.Running;
  1004. //}
  1005. //private bool FnLoadLockLeakCheckTimeout(object[] param)
  1006. //{
  1007. // RState ret = _loadLockLeakCheckRoutine.Monitor();
  1008. // if (ret == RState.Failed || ret == RState.Timeout)
  1009. // {
  1010. // PostMsg(MSG.Error);
  1011. // return false;
  1012. // }
  1013. // return ret == RState.End;
  1014. //}
  1015. //private bool FnAbortLoadLockLeakCheck(object[] param)
  1016. //{
  1017. // _loadLockLeakCheckRoutine.Abort();
  1018. // return true;
  1019. //}
  1020. private bool FnStartPurge(object[] param)
  1021. {
  1022. return _purgeRoutine.Start() == RState.Running;
  1023. }
  1024. private bool FnPurgeTimeout(object[] param)
  1025. {
  1026. RState ret = _purgeRoutine.Monitor();
  1027. if (ret == RState.Failed || ret == RState.Timeout)
  1028. {
  1029. PostMsg(MSG.Error);
  1030. return false;
  1031. }
  1032. return ret == RState.End;
  1033. }
  1034. private bool FnAbortPurge(object[] param)
  1035. {
  1036. _purgeRoutine.Abort();
  1037. return true;
  1038. }
  1039. private bool FnStartGasLinePurge(object[] param)
  1040. {
  1041. return _gaslinePurgeRoutine.Start(param) == RState.Running;
  1042. }
  1043. private bool FnGasLinePurgeTimeout(object[] param)
  1044. {
  1045. RState ret = _gaslinePurgeRoutine.Monitor();
  1046. if (ret == RState.Failed || ret == RState.Timeout)
  1047. {
  1048. PostMsg(MSG.Error);
  1049. return false;
  1050. }
  1051. return ret == RState.End;
  1052. }
  1053. private bool FnAbortGasLinePurge(object[] param)
  1054. {
  1055. _gaslinePurgeRoutine.Abort();
  1056. return true;
  1057. }
  1058. private bool FnStartPMLeakCheck(object[] param)
  1059. {
  1060. return _leakCheckRoutine.Start(param) == RState.Running;
  1061. }
  1062. private bool FnPMLeakCheckTimeout(object[] param)
  1063. {
  1064. RState ret = _leakCheckRoutine.Monitor();
  1065. if (ret == RState.Failed || ret == RState.Timeout)
  1066. {
  1067. PostMsg(MSG.Error);
  1068. return false;
  1069. }
  1070. return ret == RState.End;
  1071. }
  1072. private bool FnAbortPMLeakCheck(object[] param)
  1073. {
  1074. _leakCheckRoutine.Abort();
  1075. return true;
  1076. }
  1077. private bool FnStartGasBoxLeakCheck(object[] param)
  1078. {
  1079. return _gasBoxLeakCheckRoutine.Start(param) == RState.Running;
  1080. }
  1081. private bool FnGasBoxLeakCheckTimeout(object[] param)
  1082. {
  1083. RState ret = _gasBoxLeakCheckRoutine.Monitor();
  1084. if (ret == RState.Failed || ret == RState.Timeout)
  1085. {
  1086. PostMsg(MSG.Error);
  1087. return false;
  1088. }
  1089. return ret == RState.End;
  1090. }
  1091. private bool FnAbortGasBoxLeakCheck(object[] param)
  1092. {
  1093. _gasBoxLeakCheckRoutine.Abort();
  1094. return true;
  1095. }
  1096. //private bool FnStartLLPlace(object[] param)
  1097. //{
  1098. // return _llPlaceRoutine.Start() == RState.Running;
  1099. //}
  1100. //private bool FnLLPlaceTimeout(object[] param)
  1101. //{
  1102. // RState ret = _llPlaceRoutine.Monitor();
  1103. // if (ret == RState.Failed || ret == RState.Timeout)
  1104. // {
  1105. // PostMsg(MSG.Error);
  1106. // return false;
  1107. // }
  1108. // return ret == RState.End;
  1109. //}
  1110. //private bool FnAbortLLPlace(object[] param)
  1111. //{
  1112. // _llPlaceRoutine.Abort();
  1113. // return true;
  1114. //}
  1115. //private bool FnStartLLPick(object[] param)
  1116. //{
  1117. // return _llPickRoutine.Start() == RState.Running;
  1118. //}
  1119. //private bool FnLLPickTimeout(object[] param)
  1120. //{
  1121. // RState ret = _llPickRoutine.Monitor();
  1122. // if (ret == RState.Failed || ret == RState.Timeout)
  1123. // {
  1124. // PostMsg(MSG.Error);
  1125. // return false;
  1126. // }
  1127. // return ret == RState.End;
  1128. //}
  1129. //private bool FnAbortLLPick(object[] param)
  1130. //{
  1131. // _llPickRoutine.Abort();
  1132. // return true;
  1133. //}
  1134. private bool FnRunRecipe(object[] param)
  1135. {
  1136. RState ret = _processRoutine.Start(param);
  1137. if (ret == RState.Failed || ret == RState.Timeout)
  1138. {
  1139. PostMsg(MSG.Error);
  1140. return false;
  1141. }
  1142. return ret == RState.Running;
  1143. }
  1144. private bool FnProcessTimeout(object[] param)
  1145. {
  1146. _chamber.CheckIdleInterlock(500);
  1147. RState ret = _processRoutine.Monitor();
  1148. if (ret == RState.Failed || ret == RState.Timeout)
  1149. {
  1150. PostMsg(MSG.Error);
  1151. return false;
  1152. }
  1153. if (ret == RState.End)
  1154. {
  1155. _lastProcessDone = DateTime.Now;
  1156. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1157. _dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] = fsm.ElapsedTime;
  1158. return true;
  1159. }
  1160. return false;
  1161. }
  1162. private bool FnAbortProcess(object[] param)
  1163. {
  1164. StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
  1165. _processRoutine.Abort();
  1166. return true;
  1167. }
  1168. private bool FnStartGasFlow(object[] param)
  1169. {
  1170. return _gasFlowRoutine.Start(param) == RState.Running;
  1171. }
  1172. private bool FnGasFlowTimeout(object[] param)
  1173. {
  1174. RState ret = _gasFlowRoutine.Monitor();
  1175. if (ret == RState.Failed || ret == RState.Timeout)
  1176. {
  1177. PostMsg(MSG.Error);
  1178. return false;
  1179. }
  1180. return ret == RState.End;
  1181. }
  1182. private bool FnStopGasFlow(object[] param)
  1183. {
  1184. _gasFlowRoutine.Abort();
  1185. return true;
  1186. }
  1187. private bool FnAbortGasFlow(object[] param)
  1188. {
  1189. _gasFlowRoutine.Abort();
  1190. return true;
  1191. }
  1192. private bool FnStartRfPower(object[] param)
  1193. {
  1194. return _rfPowerRoutine.Start(param) == RState.Running;
  1195. }
  1196. private bool FnRfPowerTimeout(object[] param)
  1197. {
  1198. RState ret = _rfPowerRoutine.Monitor();
  1199. if (ret == RState.Failed || ret == RState.Timeout)
  1200. {
  1201. PostMsg(MSG.Error);
  1202. return false;
  1203. }
  1204. return ret == RState.End;
  1205. }
  1206. private bool FnAbortRfPower(object[] param)
  1207. {
  1208. _rfPowerRoutine.Abort();
  1209. if (_gasFlowRoutine._gasStatus)
  1210. {
  1211. _gasFlowRoutine.StopFlow();
  1212. }
  1213. return true;
  1214. }
  1215. private bool FnStartMFCVerification(object[] param)
  1216. {
  1217. _gasVerificationRoutine.Init((string)param[0], Convert.ToDouble(param[1]), (int)param[2]);
  1218. return _gasVerificationRoutine.Start(param) == RState.Running;
  1219. }
  1220. private bool FnMFCVerificationTimeout(object[] param)
  1221. {
  1222. RState ret = _gasVerificationRoutine.Monitor();
  1223. if (ret == RState.Failed || ret == RState.Timeout)
  1224. {
  1225. PostMsg(MSG.Error);
  1226. return false;
  1227. }
  1228. return ret == RState.End;
  1229. }
  1230. private bool FnAbortMFCVerification(object[] param)
  1231. {
  1232. _gasVerificationRoutine.Abort();
  1233. return true;
  1234. }
  1235. private bool FnControlPressure(object[] param)
  1236. {
  1237. if (RouteManager.IsATMMode)
  1238. {
  1239. return true;
  1240. }
  1241. if (IsOnline == true && fsm.State != (int)PMState.Processing && fsm.State != (int)PMState.Clean)
  1242. {
  1243. if (startControlPressureFlag == true)
  1244. {
  1245. startControlPressureFlag = false;
  1246. if (_chamber.GetPVPosition() <= 0)
  1247. {
  1248. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to pendulum valve is not Open");
  1249. return false;
  1250. }
  1251. if (_chamber.IsTurboPumpRunning == false)
  1252. {
  1253. LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to turbo pump is not Open");
  1254. return false;
  1255. }
  1256. _controlPressureSetPoint = SC.GetValue<int>($"{Module}.ControlPressureSetPoint");
  1257. _controlFlowSetPoint = SC.GetValue<int>($"{Module}.ControlPressureN2FlowSetPoint");
  1258. _chamber.StartControlPressure(_controlPressureSetPoint, _controlFlowSetPoint);
  1259. }
  1260. }
  1261. else
  1262. {
  1263. if (startControlPressureFlag == false)
  1264. {
  1265. _chamber.AbortControlPressure();
  1266. startControlPressureFlag = true;
  1267. }
  1268. }
  1269. return true;
  1270. }
  1271. #region Exchange wafer with TM
  1272. private bool FnStartPreparePick(object[] param)
  1273. {
  1274. if (!_chamber.PreparePick())
  1275. {
  1276. LOG.Write(eEvent.ERR_PM, Module, $"Prepare Pick failed");
  1277. return false;
  1278. }
  1279. return true;
  1280. }
  1281. private bool FnPreparePickTimeout(object[] param)
  1282. {
  1283. // return _chamber.WaferIsDown && IsSlitDoorOpen;
  1284. return _chamber.PreparePickIsOK();
  1285. }
  1286. private bool FnAbortPreparePick(object[] param)
  1287. {
  1288. return true;
  1289. }
  1290. private bool FnStartFinishPick(object[] param)
  1291. {
  1292. //if (!_chamber.SetSlitDoor(false, out string reason))
  1293. //{
  1294. // LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
  1295. // return false;
  1296. //}
  1297. //return true;
  1298. return _chamber.EndPick();
  1299. }
  1300. private bool FnAbortPick(object[] param)
  1301. {
  1302. return true;
  1303. }
  1304. private bool FnFinishPickTimeout(object[] param)
  1305. {
  1306. //return IsSlitDoorClose;
  1307. return _chamber.EndPickIsOK();
  1308. }
  1309. private bool FnStartDropDownWafer(object[] param)
  1310. {
  1311. if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1312. {
  1313. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
  1314. return false;
  1315. }
  1316. return _chamber.SetLiftPin(MovementPosition.Down, out string _);
  1317. }
  1318. private bool FnDropDownTimeout(object[] param)
  1319. {
  1320. return _chamber.LiftPinIsDown;
  1321. }
  1322. private bool FnStartPreparePlace(object[] param)
  1323. {
  1324. //if (_chamber.ChamberType == JetChamber.Venus || _chamber.ChamberType == JetChamber.Kepler2300)
  1325. //{
  1326. // if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1327. // {
  1328. // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1329. // return false;
  1330. // }
  1331. //}
  1332. if (!_chamber.PreparePlace())
  1333. {
  1334. LOG.Write(eEvent.ERR_PM, Module, $"Set Wafer Down failed");
  1335. return false;
  1336. }
  1337. //string reason = "";
  1338. //if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
  1339. //{
  1340. // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
  1341. // return false;
  1342. //}
  1343. return true;
  1344. }
  1345. private bool FnPreparePlaceTimeout(object[] param)
  1346. {
  1347. return _chamber.PreparePlaceIsOK();
  1348. }
  1349. private bool FnAbortPreparePlace(object[] param)
  1350. {
  1351. return true;
  1352. }
  1353. private bool FnStartLiftUpWafer(object[] param)
  1354. {
  1355. if (!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
  1356. {
  1357. LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
  1358. return false;
  1359. }
  1360. return true;
  1361. }
  1362. private bool FnLiftUpTimeout(object[] param)
  1363. {
  1364. return _chamber.LiftPinIsUp;
  1365. }
  1366. private bool FnStartFinishPlace(object[] param)
  1367. {
  1368. return _chamber.EndPlace();
  1369. }
  1370. private bool FnAortPlace(object[] param)
  1371. {
  1372. return true;
  1373. }
  1374. private bool FnFinishPlaceTimeout(object[] param)
  1375. {
  1376. //return _chamber.LiftPinIsDown && IsSlitDoorClose;
  1377. return _chamber.EndPlaceIsOK();
  1378. }
  1379. private bool FnStartSwapPlace(object[] param)
  1380. {
  1381. return true;
  1382. }
  1383. private bool FnStartPartialPressure(object[] param)
  1384. {
  1385. return _pmPartialPressureRoutine.Start(param) == RState.Running;
  1386. }
  1387. private bool FnPartialPressureTimeout(object[] param)
  1388. {
  1389. RState ret = _pmPartialPressureRoutine.Monitor();
  1390. if (ret == RState.Failed || ret == RState.Timeout)
  1391. {
  1392. PostMsg(MSG.Error);
  1393. return false;
  1394. }
  1395. return ret == RState.End;
  1396. }
  1397. private bool FnAbortPartialPressure(object[] param)
  1398. {
  1399. _pmPartialPressureRoutine.Abort();
  1400. return true;
  1401. }
  1402. private bool FnStartVATPerformance(object[] param)
  1403. {
  1404. return _pmVATPerformanceRoutine.Start(param) == RState.Running;
  1405. }
  1406. private bool FnVATPerformanceTimeout(object[] param)
  1407. {
  1408. RState ret = _pmVATPerformanceRoutine.Monitor();
  1409. if (ret == RState.Failed || ret == RState.Timeout)
  1410. {
  1411. PostMsg(MSG.Error);
  1412. return false;
  1413. }
  1414. return ret == RState.End;
  1415. }
  1416. private bool FnAbortVATPerformance(object[] param)
  1417. {
  1418. _pmVATPerformanceRoutine.Abort();
  1419. return true;
  1420. }
  1421. //private bool FnStartHeat(object[] param)
  1422. //{
  1423. // if (ChamberType == JetChamber.Kepler2200A || ChamberType == JetChamber.Kepler2200B)
  1424. // {
  1425. // _pmHeatRoutine.Start();
  1426. // }
  1427. // return true;
  1428. //}
  1429. #endregion
  1430. private void _debugRoutine()
  1431. {
  1432. int flag = 0;
  1433. // Test Home routine
  1434. if (flag == 1)
  1435. {
  1436. PostMsg(MSG.Home);
  1437. }
  1438. else if (flag == 2)
  1439. {
  1440. PostMsg(MSG.Vent);
  1441. }
  1442. else if (flag == 3)
  1443. {
  1444. PostMsg(MSG.Pump);
  1445. }
  1446. else if (flag == 4)
  1447. {
  1448. PostMsg(MSG.PumpLoadLock);
  1449. }
  1450. else if (flag == 5)
  1451. {
  1452. PostMsg(MSG.VentLoadLock);
  1453. }
  1454. else if (flag == 6)
  1455. {
  1456. PostMsg(MSG.PurgeLoadLock);
  1457. }
  1458. else if (flag == 7)
  1459. {
  1460. PostMsg(MSG.LaunchPump);
  1461. }
  1462. else if (flag == 8)
  1463. {
  1464. PostMsg(MSG.LaunchTurboPump);
  1465. }
  1466. else if (flag == 9)
  1467. {
  1468. PostMsg(MSG.LoadLockLeakCheck);
  1469. }
  1470. else if (flag == 10)
  1471. {
  1472. PostMsg(MSG.CyclePurge);
  1473. }
  1474. else if (flag == 11)
  1475. {
  1476. PostMsg(MSG.GasLinePurge);
  1477. }
  1478. else if (flag == 12)
  1479. {
  1480. PostMsg(MSG.LeakCheck);
  1481. }
  1482. else if (flag == 13)
  1483. {
  1484. PostMsg(MSG.GasLeakCheck);
  1485. }
  1486. else if (flag == 14)
  1487. {
  1488. PostMsg(MSG.LLPlace);
  1489. }
  1490. else if (flag == 15)
  1491. {
  1492. PostMsg(MSG.LLPick);
  1493. }
  1494. else if (flag == 16)
  1495. {
  1496. PostMsg(MSG.RunRecipe, "7777");
  1497. }
  1498. else if (flag == 17)
  1499. {
  1500. PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
  1501. }
  1502. }
  1503. }
  1504. }