| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Threading;
 
- using System.Diagnostics;
 
- using System.Linq;
 
- using Aitex.Core.Common;
 
- using Aitex.Core.RT.DataCenter;
 
- using Aitex.Core.RT.Device;
 
- using Aitex.Core.RT.Event;
 
- using Aitex.Core.RT.Fsm;
 
- using Aitex.Core.RT.OperationCenter;
 
- using Aitex.Core.RT.Routine;
 
- using Aitex.Core.RT.SCCore;
 
- using Aitex.Core.Util;
 
- using Aitex.Sorter.Common;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.Schedulers;
 
- using MECF.Framework.Common.SubstrateTrackings;
 
- using Venus_Core;
 
- using Venus_RT.Devices;
 
- using Venus_RT.Modules;
 
- using Venus_RT.Modules.PMs;
 
- using MECF.Framework.Common.Routine;
 
- using Aitex.Core.RT.Log;
 
- using MECF.Framework.Common.DBCore;
 
- namespace Venus_RT.Modules.PMs
 
- {
 
-     public class RecipeRunningInfo
 
-     {
 
-         public Guid InnerId { get; set; }
 
-         public RecipeHead Head { get; set; }
 
-         public List<RecipeStep> RecipeStepList { get; set; }
 
-         public string RecipeName { get; set; }
 
-         public DateTime BeginTime { get; set; }
 
-         public DateTime EndTime { get; set; }
 
-         public int StepNumber { get; set; }
 
-         public string StepName { get; set; }
 
-         public double StepTime { get; set; }
 
-         public double StepElapseTime { get; set; }
 
-         public double TotalTime { get; set; }
 
-         public double TotalElapseTime { get; set; }
 
-     }
 
-     public class PMEntity : Entity, IModuleEntity
 
-     {
 
-         public enum PMStatus
 
-         {
 
-             Not_Ready,
 
-             Ready_For_Pick,
 
-             Ready_For_Place,
 
-             Exchange_Ready,
 
-         }
 
-         public enum MSG
 
-         {
 
-             Home,
 
-             Transfer,
 
-             PrepareTransfer,
 
-             PostTransfer,
 
-             Reset,
 
-             Abort,
 
-             Error,
 
-             LaunchPump,
 
-             LaunchTurboPump,
 
-             Pump,
 
-             Vent,
 
-             PumpLoadLock,
 
-             VentLoadLock,
 
-             PurgeLoadLock,
 
-             LoadLockLeakCheck,
 
-             CyclePurge,
 
-             GasLinePurge,
 
-             Heat,
 
-             TransferHandoff,
 
-             StartTransfer,
 
-             LeakCheck,
 
-             GasLeakCheck,
 
-             MoveLiftPin,
 
-             MoveGuidePin,
 
-             PartialPressure,
 
-             VATPerformance,
 
-             LLPlace,
 
-             LLPick,
 
-             Process,
 
-             RunRecipe,
 
-             PostProcess,
 
-             RecipeSkipStep,
 
-             RecipeUpdate,
 
-             RecipeResume,
 
-             RecipePause,
 
-             RecipeAbort,
 
-             PreProcess,
 
-             AutoMode,
 
-             ManualMode,
 
-             LockLid,
 
-             Clean,
 
-             Online,
 
-             Offline,
 
-             GasFlow,
 
-             StopGasFlow,
 
-             RfPower,
 
-             MFCVerification,
 
-             // exchange wafer with TM
 
-             PreparePick,
 
-             PreparePlace,
 
-             LiftUpWafer,
 
-             DropDownWafer,
 
-             PickReady,
 
-             PlaceReady,
 
-             MaxMsg
 
-         }
 
-         private readonly JetPMBase _chamber;
 
-         public ModuleName Module { get; }
 
-         public PMStatus Status { get; private set; }
 
-         public Action<bool, bool> TransferPrepared;
 
-         private readonly PMHomeRoutine              _home;
 
-         private readonly StartDryPumpRoutine        _startDryPumpRoutine;
 
-         private readonly StartTurboPumpRoutine      _startTurboPumpRoutine;
 
-         private readonly VentRoutine                _ventRoutine;
 
-         private readonly PumpDownRoutine            _pumpRoutine;
 
-         private readonly LoadLockVentRoutine        _ventLoadLockRoutine;
 
-         private readonly LoadLockPumpRoutine        _pumpLoadLockRoutine;
 
-         private readonly LoadLockPurgeRoutine       _purgeLoadLockRoutine;
 
-         private readonly LoadLockLeakCheckRoutine   _loadLockLeakCheckRoutine;
 
-         private readonly PMPurgeRoutine             _purgeRoutine;
 
-         private readonly PMGaslinePurgeRoutine      _gaslinePurgeRoutine;
 
-         private readonly PMLeakCheckRoutine         _leakCheckRoutine;
 
-         private readonly GasBoxLeakCheckRoutine     _gasBoxLeakCheckRoutine;
 
-         private readonly LLPlaceRoutine             _llPlaceRoutine;
 
-         private readonly LLPickRoutine              _llPickRoutine;
 
-         private readonly PMProcessRoutine           _processRoutine;
 
-         private readonly GasFlowRoutine             _gasFlowRoutine;
 
-         private readonly RFPowerSwitchRoutine       _rfPowerRoutine;
 
-         private readonly PMGasVerificationRoutine   _gasVerificationRoutine;
 
-         private readonly PMPartialPressureRoutine   _pmPartialPressureRoutine;
 
-         private readonly PMVATPerformanceRoutine    _pmVATPerformanceRoutine;
 
-         private AutoFlag _AutoMode;
 
-         private bool _isOnline = false;
 
-         //private bool _isAlarm;
 
-         //private DateTime _pumpStartTime;
 
-         //private TimeSpan _pumpElapsedTime;
 
-         //private DateTime _rfStartTime;
 
-         //private DateTime _tcStartTime;
 
-         //private TimeSpan _rfElapsedTime;
 
-         //private TimeSpan _tcElapsedTime;
 
-         //private MovementPosition _goalLiftPin;
 
-         //private ushort _ActivatedActionID;
 
-         //private Stopwatch _LifpinSleepTimer;
 
-         public bool IsIdle
 
-         {
 
-             get { return fsm.State == (int)PMState.Idle; }
 
-         }
 
-         public bool IsError
 
-         {
 
-             get { return fsm.State == (int)PMState.Error; }
 
-         }
 
-         public bool IsInit
 
-         {
 
-             get { return fsm.State == (int)PMState.Init; }
 
-         }
 
-         public bool IsBusy
 
-         {
 
-             get { return !IsInit && !IsError && !IsIdle; }
 
-         }
 
-         public bool IsProcessing
 
-         {
 
-             get { return fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess; }
 
-         }
 
-         public bool IsOnline
 
-         {
 
-             get { return _isOnline; }
 
-         }
 
-         public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
 
-         public bool IsSlitDoorOpen => _chamber.CheckSlitDoorOpen();
 
-         public bool IsSlitDoorClose => _chamber.CheckSlitDoorClose();
 
-         public bool LiftPinIsDown => _chamber.LiftPinIsDown;
 
-         public bool LiftPinIsUp => _chamber.LiftPinIsUp;
 
-         public bool Check(int msg, out string reason, object[] objs)
 
-         {
 
-             reason = "";
 
-             return true;
 
-         }
 
-         // 
 
-         private bool CheckToPostMessage(int msg, params object[] args)
 
-         {
 
-             if (!fsm.FindTransition(fsm.State, msg))
 
-             {
 
-                 EV.PostWarningLog(Module.ToString(), eEvent.WARN_State, $"{Module} is in { (PMState)fsm.State} state,can not do {(MSG)msg}");
 
-                 return false;
 
-             }
 
-             fsm.PostMsg(msg, args);
 
-             return true;
 
-         }
 
-         public int Invoke(string function, params object[] args)
 
-         {
 
-             switch (function)
 
-             {
 
-                 case "Home":
 
-                     CheckToPostMessage((int)MSG.Home);
 
-                     return (int)MSG.Home;
 
-             }
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public bool CheckAcked(int msg)
 
-         {
 
-             return fsm.CheckExecuted(msg);
 
-         }
 
-         public bool IsPrepareTransferReady(ModuleName robot, EnumTransferType type, int slot, Hand blade)
 
-         {
 
-             //if (type == EnumTransferType.Pick)
 
-             //{
 
-             //    return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(_chamber.Module, 0).Size);
 
-             //}
 
-             //else if (type == EnumTransferType.Place)
 
-             //{
 
-             //    return _chamber.CheckEnableTransfer(type, WaferManager.Instance.GetWafer(robot, (int)blade).Size);
 
-             //}
 
-             return false;
 
-         }
 
-         public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString()))
 
-                 return (int)MSG.PrepareTransfer;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp))
 
-                 return (int)MSG.PrepareTransfer;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokePrepareTransfer(ModuleName robot, EnumTransferType type, int slot, float temp, WaferSize size)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.PrepareTransfer, type.ToString(), temp, size))
 
-                 return (int)MSG.PrepareTransfer;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokePostTransfer(ModuleName robot, EnumTransferType type, int slot)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.PostTransfer, type.ToString()))
 
-                 return (int)MSG.PostTransfer;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokeClean(string recipeName, string waferID, bool withWafer)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.Clean, recipeName, waferID, withWafer))
 
-             {
 
-                 return (int)MSG.Clean;
 
-             }
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokeProcess(string recipeName, string waferID, bool withWafer)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.RunRecipe, recipeName, waferID, withWafer))
 
-                 return (int)MSG.RunRecipe;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public int InvokePreHeat(float temperature)
 
-         {
 
-             if (CheckToPostMessage((int)MSG.Heat, (double)temperature))
 
-                 return (int)MSG.Heat;
 
-             return (int)FSM_MSG.NONE;
 
-         }
 
-         public void InvokeReset()
 
-         {
 
-             PostMsg((int)MSG.Reset);
 
-         }
 
-         public void SetAuto()
 
-         {
 
-             this._AutoMode = AutoFlag.Auto;
 
-         }
 
-         private bool FnSetManual(object[] param)
 
-         {
 
-             if (fsm.State == (int)PMState.PreProcess || fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.PostProcess)
 
-             {
 
-                 EV.PostWarningLog(Module.ToString(), $"{Module} is in {(PMState)fsm.State},can not do SetAutoMode");
 
-                 return false;
 
-             }
 
-             this._AutoMode = AutoFlag.Manual;
 
-             if (IsOnline)
 
-             {
 
-                 EV.PostWarningLog(Module.ToString(), $"{Module} is online,change to offline due to the chamber change to manual mode");
 
-                 this._isOnline = false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnSetOnline(object[] param)
 
-         {
 
-             if (!IsAutoMode)
 
-             {
 
-                 EV.PostWarningLog(Module.ToString(), $"{Module} in manual mode,can not set online.");
 
-                 return false;
 
-             }
 
-             if (!_chamber.CheckSlitDoorClose())
 
-             {
 
-                 EV.PostWarningLog(Module.ToString(), $"{Module} slit door is open,can not set online.");
 
-                 return false;
 
-             }
 
-             this._isOnline = true;
 
-             return true;
 
-         }
 
-         private bool FnSetOffline(object[] param)
 
-         {
 
-             this._isOnline = false;
 
-             return true;
 
-         }
 
-         public PMEntity(ModuleName module)
 
-         {
 
-             Module                  = module;
 
-             _chamber                = DEVICE.GetDevice<JetPMBase>(Module.ToString());
 
-             _home                   = new PMHomeRoutine(_chamber);
 
-             _startDryPumpRoutine    = new StartDryPumpRoutine(_chamber);
 
-             _startTurboPumpRoutine  = new StartTurboPumpRoutine(_chamber);
 
-             _ventRoutine            = new VentRoutine(_chamber);
 
-             _pumpRoutine            = new PumpDownRoutine(_chamber);
 
-             _ventLoadLockRoutine    = new LoadLockVentRoutine(_chamber);
 
-             _pumpLoadLockRoutine    = new LoadLockPumpRoutine(_chamber);
 
-             _purgeLoadLockRoutine   = new LoadLockPurgeRoutine(_chamber);
 
-             _loadLockLeakCheckRoutine = new LoadLockLeakCheckRoutine(_chamber);
 
-             _purgeRoutine           = new PMPurgeRoutine(_chamber);
 
-             _gaslinePurgeRoutine    = new PMGaslinePurgeRoutine(_chamber);
 
-             _leakCheckRoutine       = new PMLeakCheckRoutine(_chamber);
 
-             _gasBoxLeakCheckRoutine = new GasBoxLeakCheckRoutine(_chamber);
 
-             _llPlaceRoutine         = new LLPlaceRoutine(_chamber);
 
-             _llPickRoutine          = new LLPickRoutine(_chamber, _ventLoadLockRoutine);
 
-             _processRoutine         = new PMProcessRoutine(_chamber, _pumpRoutine);
 
-             _gasFlowRoutine         = new GasFlowRoutine(_chamber);
 
-             _rfPowerRoutine         = new RFPowerSwitchRoutine(_chamber, true);
 
-             _gasVerificationRoutine = new PMGasVerificationRoutine(_chamber, _pumpRoutine);
 
-             _pmPartialPressureRoutine=new PMPartialPressureRoutine(_chamber);
 
-             _pmVATPerformanceRoutine = new PMVATPerformanceRoutine(_chamber);
 
-             fsm                     = new StateMachine<PMEntity>(Module.ToString(), (int)PMState.Init, 50);
 
-             //Idle
 
-             EnterExitTransition((int)PMState.Idle,                          FnIdle,                 (int)FSM_MSG.NONE,      null);
 
-             EnterExitTransition<PMState, FSM_MSG>(PMState.Error,            fEnterError,            FSM_MSG.NONE,           null);
 
-             EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPick,     fnEnterPickReady,       FSM_MSG.NONE,   fnExitPickReady);
 
-             EnterExitTransition<PMState, FSM_MSG>(PMState.ReadyForPlace,    fnEnterPlaceReady,      FSM_MSG.NONE,   fnExitPlaceReady);
 
-             EnterExitTransition<PMState, FSM_MSG>(PMState.DropDownReady,    fnEnterDropDownReady,   FSM_MSG.NONE,   fnExitDropDownReady);
 
-             EnterExitTransition<PMState, FSM_MSG>(PMState.LiftUpReady,      fnEnterLiftUpReady,     FSM_MSG.NONE,   fnExitLiftUpReady);
 
-             //Home
 
-             //EnterExitTransition((int)PMState.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
 
-             AnyStateTransition(MSG.Error,       FnError,            PMState.Error);
 
-             Transition(PMState.Init,            FSM_MSG.TIMER,      FnTimeout,                  PMState.Init);
 
-             Transition(PMState.Init,            MSG.Home,           FnStartHome,                PMState.Homing);
 
-             Transition(PMState.Error,           MSG.Home,           FnStartHome,                PMState.Homing);
 
-             Transition(PMState.Idle,            MSG.Home,           FnStartHome,                PMState.Homing);
 
-             Transition(PMState.Homing,          MSG.Home,           FnStartHome,                PMState.Homing);
 
-             Transition(PMState.Homing,          FSM_MSG.TIMER,      FnMonitorHome,              PMState.Idle);
 
-             Transition(PMState.Idle,            FSM_MSG.TIMER,      FnIdleTimeout,              PMState.Idle);
 
-             Transition(PMState.Error,           FSM_MSG.TIMER,      FnErrorTimeout,             PMState.Error);
 
-             //Launch DryPump sequence
 
-             Transition(PMState.Idle,            MSG.LaunchPump,     FnLaunchPump,               PMState.LaunchingPump);
 
-             Transition(PMState.LaunchingPump,   FSM_MSG.TIMER,      FnLaunchPumpTimeout,        PMState.Idle);
 
-             Transition(PMState.LaunchingPump,   MSG.Abort,          FnAbortStartPumping,        PMState.Idle);
 
-             //Launch TurboPump sequence
 
-             Transition(PMState.Idle, MSG.LaunchTurboPump, FnLaunchTurboPump, PMState.LaunchingTurboPump);
 
-             Transition(PMState.LaunchingTurboPump, FSM_MSG.TIMER, FnLaunchTurboPumpTimeout, PMState.Idle);
 
-             Transition(PMState.LaunchingTurboPump, MSG.Abort, FnAbortStartTurboPumping, PMState.Idle);
 
-             //vent sequence
 
-             Transition(PMState.Idle,            MSG.Vent,           FnStartVent,                PMState.Venting);
 
-             Transition(PMState.Pumping,         MSG.Vent,           FnVentToPumping,            PMState.Venting);
 
-             Transition(PMState.Venting,         FSM_MSG.TIMER,      FnVentTimeout,              PMState.Idle);
 
-             Transition(PMState.Venting,         MSG.Abort,          FnAbortVent,                PMState.Idle);
 
-             //Pump sequence
 
-             Transition(PMState.Idle,            MSG.Pump,           FnStartPumpDown,            PMState.Pumping);
 
-             Transition(PMState.Venting,         MSG.Pump,           FnVentToPumping,            PMState.Pumping);
 
-             Transition(PMState.Pumping,         FSM_MSG.TIMER,      FnPumpDownTimeout,          PMState.Idle);
 
-             Transition(PMState.Pumping,         MSG.Abort,          FnAbortPumping,             PMState.Idle);
 
-             //Pump Loadlock sequence
 
-             Transition(PMState.Idle,            MSG.PumpLoadLock,   FnStartPumpDownLoadLock,    PMState.PumpingLoadLock);
 
-             Transition(PMState.VentingLoadLock, MSG.PumpLoadLock,   FnVentLoadLockToPumpingLoadLock, PMState.PumpingLoadLock);
 
-             Transition(PMState.PumpingLoadLock, FSM_MSG.TIMER,      FnPumpDownLoadLockTimeout,  PMState.Idle);
 
-             Transition(PMState.PumpingLoadLock, MSG.Abort,          FnAbortPumpingLoadLock,     PMState.Idle);
 
-             //Vent Loadlock sequence
 
-             Transition(PMState.Idle,            MSG.VentLoadLock,   FnStartVentLoadlock,        PMState.VentingLoadLock);
 
-             Transition(PMState.PumpingLoadLock, MSG.VentLoadLock,   FnPumpingLoadLockToVentLoadLock, PMState.VentingLoadLock);
 
-             Transition(PMState.VentingLoadLock, FSM_MSG.TIMER,      FnVentLoadLockTimeout,      PMState.Idle);
 
-             Transition(PMState.VentingLoadLock, MSG.Abort,          FnAbortVentLoadLock,        PMState.Idle);
 
-             // Purge LoadLock sequence
 
-             Transition(PMState.Idle,            MSG.PurgeLoadLock,  FnStartPurgeLoadlock,       PMState.PurgingLoadLock);
 
-             Transition(PMState.PurgingLoadLock, FSM_MSG.TIMER,      FnPurgeLoadLockTimeout,     PMState.Idle);
 
-             Transition(PMState.PurgingLoadLock, MSG.Abort,          FnAbortPurgeLoadLock,       PMState.Idle);
 
-             //LoadLock Leak check sequence
 
-             Transition(PMState.Idle,                MSG.LoadLockLeakCheck,  FnStartLoadLockLeakCheck,       PMState.LoadLockLeakCheck);
 
-             Transition(PMState.LoadLockLeakCheck,   FSM_MSG.TIMER,          FnLoadLockLeakCheckTimeout,     PMState.Idle);
 
-             Transition(PMState.LoadLockLeakCheck,   MSG.Abort,              FnAbortLoadLockLeakCheck,       PMState.Idle);
 
-             // PM Purge sequence
 
-             Transition(PMState.Idle,            MSG.CyclePurge,         FnStartPurge,           PMState.Purging);
 
-             Transition(PMState.Purging,         FSM_MSG.TIMER,          FnPurgeTimeout,         PMState.Idle);
 
-             Transition(PMState.Purging,         MSG.Abort,              FnAbortPurge,           PMState.Idle);
 
-             // PM GasLine Purge sequence
 
-             Transition(PMState.Idle,            MSG.GasLinePurge,   FnStartGasLinePurge,        PMState.GasLinePurge);
 
-             Transition(PMState.GasLinePurge,    FSM_MSG.TIMER,      FnGasLinePurgeTimeout,      PMState.Idle);
 
-             Transition(PMState.GasLinePurge,    MSG.Abort,          FnAbortGasLinePurge,        PMState.Idle);
 
-             //PM Leak check sequence
 
-             Transition(PMState.Idle,            MSG.LeakCheck,      FnStartPMLeakCheck,         PMState.LeakCheck);
 
-             Transition(PMState.LeakCheck,       FSM_MSG.TIMER,      FnPMLeakCheckTimeout,       PMState.Idle);
 
-             Transition(PMState.LeakCheck,       MSG.Abort,          FnAbortPMLeakCheck,         PMState.Idle);
 
-             //PM GasBox Leak check sequence
 
-             Transition(PMState.Idle,                MSG.GasLeakCheck,   FnStartGasBoxLeakCheck,     PMState.GasBoxLeakCheck);
 
-             Transition(PMState.GasBoxLeakCheck,     FSM_MSG.TIMER,      FnGasBoxLeakCheckTimeout,   PMState.Idle);
 
-             Transition(PMState.GasBoxLeakCheck,     MSG.Abort,          FnAbortGasBoxLeakCheck,     PMState.Idle);
 
-             // PlaceWafer from LoadLock Arm sequence
 
-             Transition(PMState.Idle,            MSG.LLPlace,        FnStartLLPlace,             PMState.LLPlacing);
 
-             Transition(PMState.LLPlacing,       FSM_MSG.TIMER,      FnLLPlaceTimeout,           PMState.Idle);
 
-             Transition(PMState.LLPlacing,       MSG.Abort,          FnAbortLLPlace,             PMState.Idle);
 
-             // PickWafer to LoadLock Arm sequence
 
-             Transition(PMState.Idle,            MSG.LLPick,         FnStartLLPick,              PMState.LLPicking);
 
-             Transition(PMState.LLPicking,       FSM_MSG.TIMER,      FnLLPickTimeout,            PMState.Idle);
 
-             Transition(PMState.LLPicking,       MSG.Abort,          FnAbortLLPick,              PMState.Idle);
 
-             // Process
 
-             Transition(PMState.Idle,            MSG.RunRecipe,      FnRunRecipe,                PMState.Processing);
 
-             Transition(PMState.Processing,      FSM_MSG.TIMER,      FnProcessTimeout,           PMState.Idle);
 
-             Transition(PMState.Processing,      MSG.Abort,          FnAbortProcess,             PMState.Idle);
 
-             // Gas Flow sequence
 
-             Transition(PMState.Idle,            MSG.GasFlow,        FnStartGasFlow,             PMState.GasFlowing);
 
-             Transition(PMState.GasFlowing,      MSG.GasFlow,        FnAbortGasFlow,             PMState.Idle);
 
-             Transition(PMState.GasFlowing,      FSM_MSG.TIMER,      FnGasFlowTimeout,           PMState.Idle);
 
-             Transition(PMState.GasFlowing,      MSG.StopGasFlow,    FnStopGasFlow,              PMState.Idle);
 
-             Transition(PMState.GasFlowing,      MSG.Abort,          FnAbortGasFlow,             PMState.Idle);
 
-             //RF Power sequence
 
-             Transition(PMState.Idle,            MSG.RfPower,        FnStartRfPower,             PMState.RfPowering);
 
-             Transition(PMState.GasFlowing,      MSG.RfPower,        FnStartRfPower,             PMState.RfPowering);
 
-             Transition(PMState.RfPowering,      FSM_MSG.TIMER,      FnRfPowerTimeout,           PMState.Idle);
 
-             Transition(PMState.RfPowering,      MSG.Abort,          FnAbortRfPower,             PMState.Idle);
 
-             //MFC verification
 
-             Transition(PMState.Idle,            MSG.MFCVerification,    FnStartMFCVerification,     PMState.MFCVerification);
 
-             Transition(PMState.MFCVerification, FSM_MSG.TIMER,          FnMFCVerificationTimeout,   PMState.Idle);
 
-             Transition(PMState.MFCVerification, MSG.Abort,              FnAbortMFCVerification,     PMState.Idle);
 
-             //////////////////////// Exchange Wafer with TM ///////////////////////////////////////////////////////
 
-             // Pick Wafer from PM
 
-             Transition(PMState.Idle,            MSG.PreparePick,    FnStartPreparePick,     PMState.PreparePick);
 
-             Transition(PMState.PreparePick,     MSG.Abort,          FnAbortPreparePick,     PMState.Idle);
 
-             Transition(PMState.PreparePick,     FSM_MSG.TIMER,      FnPreparePickTimeout,   PMState.ReadyForPick);
 
-             Transition(PMState.ReadyForPick,    MSG.Abort,          FnAbortPick,            PMState.Idle);
 
-             Transition(PMState.ReadyForPick,    MSG.DropDownWafer,  FnStartDropDownWafer,   PMState.DropDownWafer);
 
-             Transition(PMState.DropDownWafer,   FSM_MSG.TIMER,      FnDropDownTimeout,      PMState.DropDownReady);
 
-             Transition(PMState.DropDownReady,   MSG.PickReady,      FnStartFinishPick,      PMState.FinishPick);
 
-             Transition(PMState.FinishPick,      FSM_MSG.TIMER,      FnFinishPickTimeout,    PMState.Idle);
 
-             
 
-             
 
-             // Place Wafer to PM
 
-             Transition(PMState.Idle,            MSG.PreparePlace,   FnStartPreparePlace,    PMState.PreparePlace);
 
-             Transition(PMState.PreparePlace,    MSG.Abort,          FnAbortPreparePlace,    PMState.Idle);
 
-             Transition(PMState.PreparePlace,    FSM_MSG.TIMER,      FnPreparePlaceTimeout,  PMState.ReadyForPlace);
 
-             Transition(PMState.ReadyForPlace,   MSG.LiftUpWafer,    FnStartLiftUpWafer,     PMState.LiftUpWafer);
 
-             Transition(PMState.LiftUpWafer,     FSM_MSG.TIMER,      FnLiftUpTimeout,        PMState.LiftUpReady);
 
-             Transition(PMState.LiftUpReady,     MSG.PlaceReady,     FnStartFinishPlace,     PMState.FinishPlace);
 
-             Transition(PMState.ReadyForPlace,   MSG.Abort,          FnAortPlace,            PMState.Idle);
 
-             Transition(PMState.FinishPlace,     FSM_MSG.TIMER,      FnFinishPlaceTimeout,   PMState.Idle);
 
-             
 
-             // Swap Wafer With PM
 
-             Transition(PMState.DropDownReady,   MSG.PreparePlace,   FnStartSwapPlace,       PMState.PreparePlace);
 
-             #region 注
 
-             //Transition(PMState.Idle, MSG.PartialPressure, (a) => 
 
-             //{
 
-             //    return _pmPartialPressureRoutine.Start(a) == RState.Running;
 
-             //}, PMState.PartialPressureTesting);
 
-             //Transition(PMState.PartialPressureTesting, FSM_MSG.TIMER, (a) => 
 
-             //{
 
-             //    RState ret = _pmPartialPressureRoutine.Monitor();
 
-             //    if (ret == RState.Failed || ret == RState.Timeout)
 
-             //    {
 
-             //        PostMsg(MSG.Error);
 
-             //        return false;
 
-             //    }
 
-             //    return ret == RState.End;
 
-             //}, PMState.Idle);
 
-             //Transition(PMState.PartialPressureTesting, MSG.Abort, (a) => 
 
-             //{
 
-             //    _pmPartialPressureRoutine.Abort();
 
-             //    return true;
 
-             //}, PMState.Idle);
 
-             //Transition(PMState.Idle, MSG.VATPerformance, (a) =>
 
-             //{
 
-             //    return _pmVATPerformanceRoutine.Start(a) == RState.Running;
 
-             //}, PMState.VATPerformanceTesting);
 
-             //Transition(PMState.VATPerformanceTesting, FSM_MSG.TIMER, (a) =>
 
-             //{
 
-             //    RState ret = _pmVATPerformanceRoutine.Monitor();
 
-             //    if (ret == RState.Failed || ret == RState.Timeout)
 
-             //    {
 
-             //        PostMsg(MSG.Error);
 
-             //        return false;
 
-             //    }
 
-             //    return ret == RState.End;
 
-             //}, PMState.Idle);
 
-             //Transition(PMState.VATPerformanceTesting, MSG.Abort, (a) =>
 
-             //{
 
-             //    _pmVATPerformanceRoutine.Abort();
 
-             //    return true;
 
-             //}, PMState.Idle);
 
-             #endregion
 
-             Transition(PMState.Idle, MSG.PartialPressure, FnStartPartialPressure, PMState.PartialPressureTesting);
 
-             
 
-             Transition(PMState.PartialPressureTesting, FSM_MSG.TIMER, FnPartialPressureTimeout, PMState.Idle);
 
-            
 
-             Transition(PMState.PartialPressureTesting, MSG.Abort, FnAbortPartialPressure, PMState.Idle);
 
-             Transition(PMState.Idle, MSG.VATPerformance, FnStartVATPerformance, PMState.VATPerformanceTesting);
 
-             Transition(PMState.VATPerformanceTesting, FSM_MSG.TIMER, FnVATPerformanceTimeout, PMState.Idle);
 
-             Transition(PMState.VATPerformanceTesting, MSG.Abort, FnAbortVATPerformance, PMState.Idle);
 
-             
 
-          
 
-             Running = true;
 
-             WaferManager.Instance.SubscribeLocation(Module, 1);
 
-         }
 
-         protected override bool Init()
 
-         {
 
-             DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State)));
 
-             DATA.Subscribe($"{Module}.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()));
 
-             DATA.Subscribe($"{Module}.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()));
 
-             DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter);
 
-             DATA.Subscribe($"{Module}.PartialPressureCounter", () => _pmPartialPressureRoutine.counter);
 
-             DATA.Subscribe($"{Module}.VATPerformanceCounter",  () => _pmVATPerformanceRoutine.counter);
 
-             DATA.Subscribe($"{Module}.VATPerformanceResult", () => _pmVATPerformanceRoutine?.m_sb.ToString());
 
-             DATA.Subscribe($"{Module}.PartialPressureResult", () => _pmPartialPressureRoutine?.m_sb.ToString());
 
-             DATA.Subscribe($"{Module}.MFCCalibrationDatas", () => _gasVerificationRoutine?._MFCCalibrationDatas);
 
-             DATA.Subscribe($"{Module}.IsIdle", () => IsIdle);
 
-             DATA.Subscribe($"{Module}.IsAlarm", () => IsError);
 
-             DATA.Subscribe($"{Module}.IsBusy", () => IsBusy);
 
-             DATA.Subscribe($"{Module}.IsInit", () => IsInit);
 
-             //DATA.Subscribe($"{Module}.GetLeakCheckDatas", () => LeakCheckDataRecorder.GetAllLeakCheckData(Module.ToString()));
 
-             DATA.Subscribe($"{Module}.CurrentRecipeResult", () => _processRoutine.currentRecipeResult);
 
-             
 
-             OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
 
-             OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
 
-             OP.Subscribe($"{Module}.{RtOperation.GasLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.GasLeakCheck, args));
 
-             OP.Subscribe($"{Module}.Home", (cmd, args) => CheckToPostMessage((int)MSG.Home));
 
-             OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
 
-             OP.Subscribe($"{Module}.{RtOperation.StartTurboPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchTurboPump));
 
-             OP.Subscribe($"{Module}.{RtOperation.Pump}", (cmd, args) => CheckToPostMessage((int)MSG.Pump));
 
-             OP.Subscribe($"{Module}.{RtOperation.Purge}", (cmd, args) => CheckToPostMessage((int)MSG.CyclePurge));
 
-             OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower));
 
-             OP.Subscribe($"{Module}.{RtOperation.Vent}", (cmd, args) => CheckToPostMessage((int)MSG.Vent));
 
-             OP.Subscribe($"{Module}.{RtOperation.VentLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.VentLoadLock));
 
-             OP.Subscribe($"{Module}.{RtOperation.PurgeLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PurgeLoadLock));
 
-             OP.Subscribe($"{Module}.{RtOperation.PumpLoadLock}", (cmd, args) => CheckToPostMessage((int)MSG.PumpLoadLock));
 
-             OP.Subscribe($"{Module}.{RtOperation.Reset}", (cmd, args) => CheckToPostMessage((int)MSG.Reset));
 
-             OP.Subscribe($"{Module}.{RtOperation.Abort}", (cmd, args) => CheckToPostMessage((int)MSG.Abort));
 
-             OP.Subscribe($"{Module}.{RtOperation.LLPick}", (cmd, args) => CheckToPostMessage((int)MSG.LLPick));
 
-             OP.Subscribe($"{Module}.{RtOperation.LLPlace}", (cmd, args) => CheckToPostMessage((int)MSG.LLPlace));
 
-             OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args));
 
-             OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, args[0]));
 
-             OP.Subscribe($"{Module}.PartialPressureTest", (cmd, args) => CheckToPostMessage((int)MSG.PartialPressure, args[0], args[1]));
 
-             OP.Subscribe($"{Module}.VATPerformanceTest", (cmd, args) => CheckToPostMessage((int)MSG.VATPerformance, args[0], args[1], args[2]));
 
-             OP.Subscribe($"{Module}.GasLinePurge", (cmd, args) => CheckToPostMessage((int)MSG.GasLinePurge));
 
-             OP.Subscribe($"{Module}.ManualEndStep", (cmd, args) => ManualEndStep() );
 
-             return true;
 
-         }
 
-         private bool ManualEndStep()
 
-         {
 
-             _processRoutine.isMaualEndStep = true;
 
-             return true;
 
-         }
 
-         private bool FnIdle(object[] objs)
 
-         {
 
-             Running = false;
 
-             return true;
 
-         }
 
-         private bool fEnterError(object[] objs)
 
-         {
 
-             return true;
 
-         }
 
-         private bool fnEnterPickReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Ready_For_Pick;
 
-             return true;
 
-         }
 
-         private bool fnExitPickReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Not_Ready;
 
-             return true;
 
-         }
 
-         private bool fnEnterPlaceReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Ready_For_Place;
 
-             return true;
 
-         }
 
-         private bool fnExitPlaceReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Not_Ready;
 
-             return true;
 
-         }
 
-         private bool fnEnterDropDownReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Exchange_Ready;
 
-             return true;
 
-         }
 
-         private bool fnExitDropDownReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Not_Ready;
 
-             return true;
 
-         }
 
-         private bool fnEnterLiftUpReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Exchange_Ready;
 
-             return true;
 
-         }
 
-         private bool fnExitLiftUpReady(object[] objs)
 
-         {
 
-             Status = PMStatus.Not_Ready;
 
-             return true;
 
-         }
 
-         private bool FnError(object[] objs)
 
-         {
 
-             Running = false;
 
-             //if (((PMState)fsm.State == PMState.Processing) || ((PMState)fsm.State == PMState.PreProcess)
 
-             //    || ((PMState)fsm.State == PMState.Homing) || ((PMState)fsm.State == PMState.LoadProcessRecipe))
 
-             //    return false;
 
-             _chamber.CloseValves();
 
-             _chamber.GeneratorPowerOn(false);
 
-             _chamber.GeneratorBiasPowerOn(false);
 
-             _chamber.OpenValve(ValveType.TurboPumpPumping, true);
 
-             _chamber.OpenValve(ValveType.TurboPumpPurge, true);
 
-             if (IsProcessing)
 
-             {
 
-                 WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnTimeout(object[] objs)
 
-         {
 
-             _debugRoutine();
 
-             return true;
 
-         }
 
-         private bool FnIdleTimeout(object[] objs)
 
-         {
 
-             _chamber.CheckIdleInterlock();
 
-             //_debugRoutine();
 
-             return true;
 
-         }
 
-         private bool FnErrorTimeout(object[] objs)
 
-         {
 
-             //_debugRoutine();
 
-             return true;
 
-         }
 
-         private bool FnStartHome(object[] objs)
 
-         {
 
-             return _home.Start() == RState.Running;
 
-         }
 
-         private bool FnMonitorHome(object[] objs)
 
-         {
 
-             RState ret = _home.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnLaunchPump(object[] param)
 
-         {
 
-             return _startDryPumpRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnLaunchPumpTimeout(object[] param)
 
-         {
 
-             RState ret = _startDryPumpRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortStartPumping(object[] param)
 
-         {
 
-             _startDryPumpRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnLaunchTurboPump(object[] param)
 
-         {
 
-             return _startTurboPumpRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnLaunchTurboPumpTimeout(object[] param)
 
-         {
 
-             RState ret = _startTurboPumpRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortStartTurboPumping(object[] param)
 
-         {
 
-             _startTurboPumpRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartVent(object[] param)
 
-         {
 
-             return _ventRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnVentTimeout(object[] param)
 
-         {
 
-             RState ret = _ventRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnVentToPumping(object[] param)
 
-         {
 
-             _ventRoutine.Abort();
 
-             return true; // FnStartPumpDown(param);
 
-         }
 
-         private bool FnAbortVent(object[] param)
 
-         {
 
-             _ventRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartPumpDown(object[] param)
 
-         {
 
-             return _pumpRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnPumpDownTimeout(object[] param)
 
-         {
 
-             RState ret = _pumpRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortPumping(object[] param)
 
-         {
 
-             _pumpRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartVentLoadlock(object[] param)
 
-         {
 
-             return _ventLoadLockRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnVentLoadLockTimeout(object[] param)
 
-         {
 
-             RState ret = _ventLoadLockRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnVentLoadLockToPumpingLoadLock(object[] param)
 
-         {
 
-             _ventLoadLockRoutine.Abort();
 
-             return FnStartPumpDownLoadLock(param);
 
-         }
 
-         private bool FnAbortVentLoadLock(object[] param)
 
-         {
 
-             _ventLoadLockRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartPumpDownLoadLock(object[] param)
 
-         {
 
-             return _pumpLoadLockRoutine.Start() ==  RState.Running;
 
-         }
 
-         private bool FnPumpDownLoadLockTimeout(object[] param)
 
-         {
 
-             RState ret = _pumpLoadLockRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnPumpingToVent(object[] param)
 
-         {
 
-             _pumpRoutine.Abort();
 
-             return FnStartVent(param);
 
-         }
 
-         private bool FnPumpingLoadLockToVentLoadLock(object[] param)
 
-         {
 
-             _pumpLoadLockRoutine.Abort();
 
-             return FnStartVentLoadlock(param);
 
-         }
 
-         private bool FnAbortPumpingLoadLock(object[] param)
 
-         {
 
-             _pumpLoadLockRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartPurgeLoadlock(object[] param)
 
-         {
 
-             return _purgeLoadLockRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnPurgeLoadLockTimeout(object[] param)
 
-         {
 
-             RState ret = _purgeLoadLockRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortPurgeLoadLock(object[] param)
 
-         {
 
-             _purgeLoadLockRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartLoadLockLeakCheck(object[] param)
 
-         {
 
-             return _loadLockLeakCheckRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnLoadLockLeakCheckTimeout(object[] param)
 
-         {
 
-             RState ret = _loadLockLeakCheckRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortLoadLockLeakCheck(object[] param)
 
-         {
 
-             _loadLockLeakCheckRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartPurge(object[] param)
 
-         {
 
-             return _purgeRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnPurgeTimeout(object[] param)
 
-         {
 
-             RState ret = _purgeRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortPurge(object[] param)
 
-         {
 
-             _purgeRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartGasLinePurge(object[] param)
 
-         {
 
-             return _gaslinePurgeRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnGasLinePurgeTimeout(object[] param)
 
-         {
 
-             RState ret = _gaslinePurgeRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortGasLinePurge(object[] param)
 
-         {
 
-             _gaslinePurgeRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartPMLeakCheck(object[] param)
 
-         {
 
-             return _leakCheckRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnPMLeakCheckTimeout(object[] param)
 
-         {
 
-             RState ret = _leakCheckRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortPMLeakCheck(object[] param)
 
-         {
 
-             _leakCheckRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartGasBoxLeakCheck(object[] param)
 
-         {
 
-             return _gasBoxLeakCheckRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnGasBoxLeakCheckTimeout(object[] param)
 
-         {
 
-             RState ret = _gasBoxLeakCheckRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortGasBoxLeakCheck(object[] param)
 
-         {
 
-             _gasBoxLeakCheckRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartLLPlace(object[] param)
 
-         {
 
-             return _llPlaceRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnLLPlaceTimeout(object[] param)
 
-         {
 
-             RState ret = _llPlaceRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortLLPlace(object[] param)
 
-         {
 
-             _llPlaceRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartLLPick(object[] param)
 
-         {
 
-             return _llPickRoutine.Start() == RState.Running;
 
-         }
 
-         private bool FnLLPickTimeout(object[] param)
 
-         {
 
-             RState ret = _llPickRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortLLPick(object[] param)
 
-         {
 
-             _llPickRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnRunRecipe(object[] param)
 
-         {
 
-             //if(_processRoutine.Start(param) == RState.Running)
 
-             return _processRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnProcessTimeout(object[] param)
 
-         {
 
-             _chamber.CheckIdleInterlock();
 
-             RState ret = _processRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortProcess(object[] param)
 
-         {
 
-             _processRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartGasFlow(object[] param)
 
-         {
 
-             return _gasFlowRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnGasFlowTimeout(object[] param)
 
-         {
 
-             RState ret = _gasFlowRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnStopGasFlow(object[] param)
 
-         {
 
-             _gasFlowRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnAbortGasFlow(object[] param)
 
-         {
 
-             _gasFlowRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartRfPower(object[] param)
 
-         {
 
-             return _rfPowerRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnRfPowerTimeout(object[] param)
 
-         {
 
-             RState ret = _rfPowerRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortRfPower(object[] param)
 
-         {
 
-             _rfPowerRoutine.Abort();
 
-             if(_gasFlowRoutine._gasStatus)
 
-             {
 
-                 _gasFlowRoutine.StopFlow();
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnStartMFCVerification(object[] param)
 
-         {
 
-             _gasVerificationRoutine.Init((string)param[0], Convert.ToDouble( param[1]), (int)param[2]);
 
-             return _gasVerificationRoutine.Start(param) ==  RState.Running;
 
-         }
 
-         private bool FnMFCVerificationTimeout(object[] param)
 
-         {
 
-             RState ret = _gasVerificationRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortMFCVerification(object[] param)
 
-         {
 
-             _gasVerificationRoutine.Abort();
 
-             return true;
 
-         }
 
-         #region Exchange wafer with TM
 
-         private bool FnStartPreparePick(object[] param)
 
-         {
 
-             if(!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
 
-                 return false;
 
-             }
 
-             if(!_chamber.SetSlitDoor(true, out reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnPreparePickTimeout(object[] param)
 
-         {
 
-             return _chamber.LiftPinIsUp && IsSlitDoorOpen;
 
-         }
 
-         private bool FnAbortPreparePick(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FnStartFinishPick(object[] param)
 
-         {
 
-             if (!_chamber.SetSlitDoor(false, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnAbortPick(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FnFinishPickTimeout(object[] param)
 
-         {
 
-             return IsSlitDoorClose;
 
-         }
 
-         private bool FnStartDropDownWafer(object[] param)
 
-         {
 
-             if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
 
-                 return false;
 
-             }
 
-             return _chamber.SetLiftPin(MovementPosition.Down, out string _);
 
-         }
 
-         private bool FnDropDownTimeout(object[] param)
 
-         {
 
-             return _chamber.LiftPinIsDown;
 
-         }
 
-         private bool FnStartPreparePlace(object[] param)
 
-         {
 
-             if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
 
-                 return false;
 
-             }
 
-             if (!_chamber.SetSlitDoor(true, out reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnPreparePlaceTimeout(object[] param)
 
-         {
 
-             return _chamber.LiftPinIsDown && IsSlitDoorOpen;
 
-         }
 
-         private bool FnAbortPreparePlace(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FnStartLiftUpWafer(object[] param)
 
-         {
 
-             if (!_chamber.SetLiftPin(MovementPosition.Up, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnLiftUpTimeout(object[] param)
 
-         {
 
-             return _chamber.LiftPinIsUp;
 
-         }
 
-         private bool FnStartFinishPlace(object[] param)
 
-         {
 
-             if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}");
 
-                 return false;
 
-             }
 
-             if (!_chamber.SetSlitDoor(false, out reason))
 
-             {
 
-                 LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         private bool FnAortPlace(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FnFinishPlaceTimeout(object[] param)
 
-         {
 
-             return _chamber.LiftPinIsDown && IsSlitDoorClose;
 
-         }
 
-         private bool FnStartSwapPlace(object[] param)
 
-         {
 
-             return true;
 
-         }
 
-         private bool FnStartPartialPressure(object[] param)
 
-         {
 
-             return _pmPartialPressureRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnPartialPressureTimeout(object[] param)
 
-         {
 
-             RState ret = _pmPartialPressureRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortPartialPressure(object[] param)
 
-         {
 
-             _pmPartialPressureRoutine.Abort();
 
-             return true;
 
-         }
 
-         private bool FnStartVATPerformance(object[] param)
 
-         {
 
-             return _pmVATPerformanceRoutine.Start(param) == RState.Running;
 
-         }
 
-         private bool FnVATPerformanceTimeout(object[] param)
 
-         {
 
-             RState ret = _pmVATPerformanceRoutine.Monitor();
 
-             if (ret == RState.Failed || ret == RState.Timeout)
 
-             {
 
-                 PostMsg(MSG.Error);
 
-                 return false;
 
-             }
 
-             return ret == RState.End;
 
-         }
 
-         private bool FnAbortVATPerformance(object[] param)
 
-         {
 
-             _pmVATPerformanceRoutine.Abort();
 
-             return true;
 
-         }
 
-         #endregion
 
-         private void _debugRoutine()
 
-         {
 
-             int flag = 0;
 
-             // Test Home routine
 
-             if (flag == 1)
 
-             {
 
-                 PostMsg(MSG.Home);
 
-             }
 
-             else if (flag == 2)
 
-             {
 
-                 PostMsg(MSG.Vent);
 
-             }
 
-             else if (flag == 3)
 
-             {
 
-                 PostMsg(MSG.Pump);
 
-             }
 
-             else if(flag == 4)
 
-             {
 
-                 PostMsg(MSG.PumpLoadLock);
 
-             }
 
-             else if(flag == 5)
 
-             {
 
-                 PostMsg(MSG.VentLoadLock);
 
-             }
 
-             else if(flag == 6)
 
-             {
 
-                 PostMsg(MSG.PurgeLoadLock);
 
-             }
 
-             else if(flag == 7)
 
-             {
 
-                 PostMsg(MSG.LaunchPump);
 
-             }
 
-             else if(flag == 8)
 
-             {
 
-                 PostMsg(MSG.LaunchTurboPump);
 
-             }
 
-             else if(flag == 9)
 
-             {
 
-                 PostMsg(MSG.LoadLockLeakCheck);
 
-             }
 
-             else if(flag == 10)
 
-             {
 
-                 PostMsg(MSG.CyclePurge);
 
-             }
 
-             else if(flag == 11)
 
-             {
 
-                 PostMsg(MSG.GasLinePurge);
 
-             }
 
-             else if(flag == 12)
 
-             {
 
-                 PostMsg(MSG.LeakCheck);
 
-             }
 
-             else if(flag == 13)
 
-             {
 
-                 PostMsg(MSG.GasLeakCheck);
 
-             }
 
-             else if(flag == 14)
 
-             {
 
-                 PostMsg(MSG.LLPlace);
 
-             }
 
-             else if(flag == 15)
 
-             {
 
-                 PostMsg(MSG.LLPick);
 
-             }
 
-             else if(flag == 16)
 
-             {
 
-                 PostMsg(MSG.RunRecipe, "7777");
 
-             }
 
-             else if(flag == 17)
 
-             {
 
-                 PostMsg(MSG.MFCVerification, "MFC2", (double)50, 10);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |