12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736 |
- using System;
- using System.Collections.Generic;
- 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.SCCore;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Schedulers;
- using MECF.Framework.Common.SubstrateTrackings;
- using Venus_Core;
- using Venus_RT.Devices;
- using Aitex.Core.RT.Log;
- using Aitex.Core.UI.DeviceControl;
- using MECF.Framework.Common.DataCenter;
- using Aitex.Core.RT.DataCollection;
- 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; }
- private StatsDataItem _statProcessedWafer;
- private StatsDataItemRFAndPump _statRfOnTime;
- private StatsDataItemRFAndPump _statBiasRfOnTime;
- //private StatsDataItemRFAndPump _statPumpOnTime;
- private readonly PMHomeRoutine _home;
- private readonly StartDryPumpRoutine _startDryPumpRoutine;
- private readonly StartTurboPumpRoutine _startTurboPumpRoutine;
- private readonly VentRoutine _ventRoutine;
- private readonly VenusVentRoutine _venusVentRoutine;
- 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 readonly PMHeatRoutine _pmHeatRoutine;
- private DateTime _lastProcessDone;
- 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;
- private bool startControlPressureFlag = true;
- //private bool stopControlPressureFlag = false;
- private int _controlPressureSetPoint = 90;
- private int _controlFlowSetPoint = 90;
- public DateTime LastProcessDone => _lastProcessDone;
- public JetChamber ChamberType => _chamber.ChamberType;
- 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 IsInclude
- {
- get;
- private set;
- } = true;
- private Dictionary<string, int> _dictRecipeTime = new Dictionary<string, int>();
- public override int TimeToReady
- {
- get
- {
- switch ((PMState)fsm.State)
- {
- case PMState.Processing:
- case PMState.Clean:
- if (Singleton<RouteManager>.Instance.IsAutoMode && IsOnline)
- {
- if (_dictRecipeTime.ContainsKey(_processRoutine.currentRecipeResult.RecipeName))
- {
- return Math.Max(_dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] - fsm.ElapsedTime, 0);
- }
- }
- break;
- }
- return int.MaxValue / 2;
- }
- }
- 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 double ChamberPressure => _chamber.ChamberPressure;
- public double ProcessPressure => _chamber.ProcessPressure;
- public bool IsVac => _chamber.IsVAC;
- public bool IsAtm => _chamber.IsATM;
- public float ChamberTemperature => _chamber.ChamberTemperature;
- 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 void ResetRecipeTime()
- {
- _dictRecipeTime.Clear();
- }
- 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, RecipeType recipeType)
- {
- if (CheckToPostMessage((int)MSG.Clean, recipeName, waferID, recipeType))
- {
- return (int)MSG.Clean;
- }
- return (int)FSM_MSG.NONE;
- }
- public int InvokeProcess(string recipeName, string waferID, RecipeType recipeType)
- {
- if (CheckToPostMessage((int)MSG.RunRecipe, recipeName, waferID, recipeType))
- 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 FnSetInclude()
- {
- if (IsOnline == true)
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Include");
- return false;
- }
- IsInclude = true;
- LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Include Success");
- return true;
- }
- private bool FnSetExclude()
- {
- if (IsOnline == true)
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} is online,can not set Exclude");
- return false;
- }
- IsInclude = false;
- LOG.Write(eEvent.INFO_PM, Module, $"{Module} Set Exclude Success");
- return true;
- }
- private bool FnSetOnline(object[] param)
- {
- //if (!IsAutoMode)
- //{
- // EV.PostWarningLog(Module.ToString(), $"{Module} in manual mode,can not set online.");
- // return false;
- //}
- if (!IsInclude)
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} is excluded,can not be put online");
- return false;
- }
- if (!_chamber.HomeIsOK(out string reason))
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} {reason},can not be put 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;
- }
- private List<eEvent> stopEntityId = new List<eEvent>()
- {
- eEvent.ERR_MATCH,
- eEvent.ERR_RF,
- eEvent.ERR_PENDULUM_VALVE,
- eEvent.ERR_DEVICE_INFO,
- eEvent.ERR_DRY_PUMP,
- eEvent.ERR_HighTemperatureHeater,
- eEvent.ERR_HighTemperatureHeater_SetRatio_OverRange,
- eEvent.ERR_HighTemperatureHeater_SetTemperature_OverRange,
- eEvent.ERR_HighTemperatureHeater_GoPosition1TimeOut,
- eEvent.ERR_HighTemperatureHeater_GoPosition2TimeOut,
- eEvent.ERR_HighTemperatureHeater_GoPosition3TimeOut,
- eEvent.ERR_HighTemperatureHeater_GoPosition4TimeOut,
- eEvent.ERR_HighTemperatureHeater_GoPosition5TimeOut,
- eEvent.ERR_HighTemperatureHeater_GoOriginTimeOut,
- eEvent.ERR_HighTemperatureHeater_TransferPosition,
- eEvent.ERR_PM_PLC_HEARTBEAT_FAIL
- };
- 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);
- _venusVentRoutine = new VenusVentRoutine(_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, _pumpRoutine);
- _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);
- //_pmControlPressureRoutine = new PMControlPressureRoutine(_chamber);
- //_pmHeatRoutine = new PMHeatRoutine(_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);
- AnyStateTransition(MSG.Online, FnSetOnline, FSM_STATE.SAME);
- AnyStateTransition(MSG.Offline, FnSetOffline, FSM_STATE.SAME);
- AnyStateTransition(FSM_MSG.ALARM, FnAlarm, 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.Homing, MSG.Abort, FnAbortHome, 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);
- // Clean
- Transition(PMState.Idle, MSG.Clean, FnRunRecipe, PMState.Clean);
- Transition(PMState.Clean, FSM_MSG.TIMER, FnProcessTimeout, PMState.Idle);
- Transition(PMState.Clean, 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.PreparePick, MSG.PreparePick, null, PMState.PreparePick);
- Transition(PMState.ReadyForPick, MSG.Abort, FnAbortPick, PMState.Idle);
- Transition(PMState.ReadyForPick, MSG.DropDownWafer, FnStartDropDownWafer, PMState.DropDownWafer);
- Transition(PMState.ReadyForPick, MSG.PreparePick, null, PMState.ReadyForPick);
- Transition(PMState.DropDownWafer, FSM_MSG.TIMER, FnDropDownTimeout, PMState.DropDownReady);
- Transition(PMState.DropDownReady, MSG.PickReady, FnStartFinishPick, PMState.FinishPick);
- Transition(PMState.ReadyForPick, 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.Heating, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
- Transition(PMState.PreparePlace, MSG.Abort, FnAbortPreparePlace, PMState.Idle);
- Transition(PMState.PreparePlace, FSM_MSG.TIMER, FnPreparePlaceTimeout, PMState.ReadyForPlace);
- Transition(PMState.PreparePlace, MSG.PreparePlace, null, PMState.PreparePlace);
- 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.PlaceReady, FnStartFinishPlace, PMState.FinishPlace);
- Transition(PMState.PreparePlace, MSG.Abort, FnAortPlace, PMState.Idle);
- Transition(PMState.ReadyForPlace, MSG.Abort, FnAortPlace, PMState.Idle);
- Transition(PMState.ReadyForPlace, MSG.PreparePlace, null, PMState.ReadyForPlace);
- Transition(PMState.LiftUpReady, 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);
- Transition(PMState.ReadyForPick, MSG.PreparePlace, FnStartPreparePlace, PMState.PreparePlace);
- 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);
- //Transition(PMState.Idle, MSG.Heat, FnStartHeat, PMState.Heating);
- AnyStateTransition(FSM_MSG.TIMER, FnControlPressure, FSM_STATE.SAME);
- Running = true;
- WaferManager.Instance.SubscribeLocation(Module, 1);
- }
- protected override bool Init()
- {
- DATA.Subscribe($"{Module}.FsmState", () => (((PMState)fsm.State)), SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.FsmPrevState", () => (((PMState)fsm.PrevState).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.FsmLastMessage", () => (((MSG)fsm.LastMsg).ToString()), SubscriptionAttribute.FLAG.IgnoreSaveDB);
- //DATA.Subscribe($"{Module}.LoadLockPurge.PurgeCounter", () => _purgeLoadLockRoutine.PurgeCounter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.PartialPressureCounter", () => _pmPartialPressureRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.VATPerformanceCounter", () => _pmVATPerformanceRoutine.counter, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.VATPerformanceResult", () => _pmVATPerformanceRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.PartialPressureResult", () => _pmPartialPressureRoutine?.m_sb.ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.MFCCalibrationDatas", () => _gasVerificationRoutine?._MFCCalibrationDatas, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsIdle", () => IsIdle, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsAlarm", () => IsError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsBusy", () => IsBusy, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsInit", () => IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsOnline", () => _isOnline, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.VentingFlag", () => ChamberType == JetChamber.VenusSE || ChamberType == JetChamber.VenusDE ? _venusVentRoutine.VentingFlag : _ventRoutine.VentingFlag, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- //DATA.Subscribe($"{Module}.GetLeakCheckDatas", () => LeakCheckDataRecorder.GetAllLeakCheckData(Module.ToString()));
- DATA.Subscribe($"{Module}.CurrentRecipeResult", () => _processRoutine.currentRecipeResult, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.LeakCheck.Step", () => _leakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.GasLeakCheck.Step", () => _gasBoxLeakCheckRoutine.CurrentStep, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- DATA.Subscribe($"{Module}.IsInclude", () => IsInclude, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- 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));
- OP.Subscribe($"{Module}.{RtOperation.RunCleanRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.Clean, args));
- 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, args[0]));
- OP.Subscribe($"{Module}.ManualEndStep", (cmd, args) => ManualEndStep());
- OP.Subscribe($"{Module}.{RtOperation.Online}", (cmd, args) => CheckToPostMessage((int)MSG.Online));
- OP.Subscribe($"{Module}.{RtOperation.Offline}", (cmd, args) => CheckToPostMessage((int)MSG.Offline));
- OP.Subscribe($"{Module}.{RtOperation.PmError}", (cmd, args) => CheckToPostMessage((int)MSG.Error));
- OP.Subscribe($"{Module}.{RtOperation.Include}", (cmd, args) => FnSetInclude());
- OP.Subscribe($"{Module}.{RtOperation.Exclude}", (cmd, args) => FnSetExclude());
- OP.Subscribe($"{Module}.SubscribeStatsData", (cmd, args) =>
- {
- StatsDataManager.Instance.Subscribe(args[0].ToString(), args[1].ToString());
- return true;
- });
- StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount", "Processed Wafer Count", 0);
- if (_chamber.IsRFAble())
- StatsDataManager.Instance.Subscribe($"{Module}.RfOnTime", "Rf On Time");
- if (_chamber.IsBiasRFAble())
- StatsDataManager.Instance.Subscribe($"{Module}.BiasRfOnTime", "Bias Rf On Time");
- StatsDataManager.Instance.Subscribe($"{Module}.PumpOnTime", "Pump On Time");
- _statProcessedWafer = StatsDataManager.Instance.GetItem($"{Module}.ProcessedWaferCount");
- _statRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.RfOnTime");
- if (_chamber.IsBiasRFAble())
- _statBiasRfOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRfOnTime");
- //_statPumpOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.PumpOnTime");
- DATA.Subscribe($"{Module}.WaferCounter", () => _statProcessedWafer.Value, SubscriptionAttribute.FLAG.IgnoreSaveDB);
- if (_chamber.IsRFAble())
- DATA.Subscribe($"{Module}.RfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.RfOnTime"));
- if (_chamber.IsBiasRFAble())
- DATA.Subscribe($"{Module}.BiasRfOnTime", () => StatsDataManager.Instance.GetRFPumpTotalTime($"{Module}.BiasRfOnTime"));
- //DATA.Subscribe($"{Module}.PumpOnTime", () => _statPumpOnTime.fromLastPM);
- if (RtInstance.ConfigType==ConfigType.Kepler2200)
- {
- LOG.ModuleErrorInterrupt += (pmname, id) => PMErrorInterrupt(pmname, id);
- }
- return true;
- }
- private void PMErrorInterrupt(ModuleName pmname, eEvent eEventid)
- {
- if (pmname != Module)
- {
- return;
- }
- if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_CONTINUEPROCESS || eEventid==eEvent.ERR_SENSOR_WATERFLOW_STOP_NEXTPROCESS)
- {
- this._isOnline = false;
- return;
- }
- if (eEventid == eEvent.ERR_PM_SCRUBBER_NOOK_STOPPROCESS || eEventid == eEvent.ERR_SENSOR_WATERFLOW_STOP_CURRENTPROCESS)
- {
- if (fsm.State == (int)PMState.Processing || fsm.State == (int)PMState.Clean)
- {
- CheckToPostMessage((int)MSG.Abort);
- }
- this._isOnline = false;
- return;
- }
- if (stopEntityId.Contains(eEventid) && fsm.State != (int)PMState.Error)
- {
- CheckToPostMessage((int)MSG.Error);
- }
- }
- private bool ManualEndStep()
- {
- _processRoutine.isMaualEndStep = true;
- return true;
- }
- private bool FnIdle(object[] objs)
- {
- Running = false;
- return true;
- }
- private bool fEnterError(object[] objs)
- {
- DataCollectionManager.Instance.ManualInsertData();
- 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 FnAlarm(object[] objs)
- {
- if ((PMState)fsm.State == PMState.Processing)
- {
- }
- return true;
- }
- private bool FnError(object[] objs)
- {
- Running = false;
- _isOnline = 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);
- //_chamber.OnOffSetESCHV(false);
- _chamber.PMInError();
- 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(0);
- //_debugRoutine();
- return true;
- }
- private bool FnErrorTimeout(object[] objs)
- {
- _chamber.CheckIdleInterlock(0);
- //_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 FnAbortHome(object[] objs)
- {
- _home.Abort();
- return true;
- }
- 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)
- {
- switch (ChamberType)
- {
- case JetChamber.VenusSE:
- case JetChamber.VenusDE:
- return _venusVentRoutine.Start() == RState.Running;
- default:
- return _ventRoutine.Start() == RState.Running;
- }
- }
- private bool FnVentTimeout(object[] param)
- {
- RState ret;
- switch (ChamberType)
- {
- case JetChamber.VenusSE:
- case JetChamber.VenusDE:
- ret = _venusVentRoutine.Monitor();
- break;
- default:
- ret = _ventRoutine.Monitor();
- break;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.End;
- }
- private bool FnVentToPumping(object[] param)
- {
- switch (ChamberType)
- {
- case JetChamber.VenusSE:
- case JetChamber.VenusDE:
- _venusVentRoutine.Abort();
- break;
- default:
- _ventRoutine.Abort();
- break;
- }
- return true; // FnStartPumpDown(param);
- }
- private bool FnAbortVent(object[] param)
- {
- switch (ChamberType)
- {
- case JetChamber.VenusSE:
- case JetChamber.VenusDE:
- _venusVentRoutine.Abort();
- break;
- default:
- _ventRoutine.Abort();
- break;
- }
- 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(param) == 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)
- {
- RState ret = _processRoutine.Start(param);
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.Running;
- }
- private bool FnProcessTimeout(object[] param)
- {
- _chamber.CheckIdleInterlock(500);
- RState ret = _processRoutine.Monitor();
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false;
- }
- if (ret == RState.End)
- {
- _lastProcessDone = DateTime.Now;
- StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
- _dictRecipeTime[_processRoutine.currentRecipeResult.RecipeName] = fsm.ElapsedTime;
- return true;
- }
- return false;
- }
- private bool FnAbortProcess(object[] param)
- {
- StatsDataManager.Instance.Increase(_statProcessedWafer.Name);
- _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;
- }
- private bool FnControlPressure(object[] param)
- {
- if (RouteManager.IsATMMode)
- {
- return true;
- }
- if (IsOnline == true && fsm.State != (int)PMState.Processing && fsm.State != (int)PMState.Clean)
- {
- if (startControlPressureFlag == true)
- {
- startControlPressureFlag = false;
- if (_chamber.GetPVPosition() <= 0)
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to pendulum valve is not Open");
- return false;
- }
- if (_chamber.IsTurboPumpRunning == false)
- {
- LOG.Write(eEvent.WARN_PM, Module, $"{Module} control pressure fail,due to turbo pump is not Open");
- return false;
- }
- _controlPressureSetPoint = SC.GetValue<int>($"{Module}.ControlPressureSetPoint");
- _controlFlowSetPoint = SC.GetValue<int>($"{Module}.ControlPressureN2FlowSetPoint");
- _chamber.StartControlPressure(_controlPressureSetPoint, _controlFlowSetPoint);
- }
- }
- else
- {
- if (startControlPressureFlag == false)
- {
- _chamber.AbortControlPressure();
- startControlPressureFlag = true;
- }
- }
- return true;
- }
- #region Exchange wafer with TM
- private bool FnStartPreparePick(object[] param)
- {
- if (!_chamber.PreparePick())
- {
- LOG.Write(eEvent.ERR_PM, Module, $"Prepare Pick failed");
- return false;
- }
- return true;
- }
- private bool FnPreparePickTimeout(object[] param)
- {
- // return _chamber.WaferIsDown && IsSlitDoorOpen;
- return _chamber.PreparePickIsOK();
- }
- 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;
- return _chamber.EndPick();
- }
- private bool FnAbortPick(object[] param)
- {
- return true;
- }
- private bool FnFinishPickTimeout(object[] param)
- {
- //return IsSlitDoorClose;
- return _chamber.EndPickIsOK();
- }
- 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.ChamberType == JetChamber.Venus || _chamber.ChamberType == JetChamber.Kepler2300)
- //{
- // if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
- // {
- // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
- // return false;
- // }
- //}
- if (!_chamber.PreparePlace())
- {
- LOG.Write(eEvent.ERR_PM, Module, $"Set Wafer Down failed");
- return false;
- }
- //string reason = "";
- //if (!_chamber.SetLiftPin(MovementPosition.Down, out string reason))
- //{
- // LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}");
- // return false;
- //}
- return true;
- }
- private bool FnPreparePlaceTimeout(object[] param)
- {
- return _chamber.PreparePlaceIsOK();
- }
- 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)
- {
- return _chamber.EndPlace();
- }
- private bool FnAortPlace(object[] param)
- {
- return true;
- }
- private bool FnFinishPlaceTimeout(object[] param)
- {
- //return _chamber.LiftPinIsDown && IsSlitDoorClose;
- return _chamber.EndPlaceIsOK();
- }
- 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;
- }
- //private bool FnStartHeat(object[] param)
- //{
- // if (ChamberType == JetChamber.Kepler2200A || ChamberType == JetChamber.Kepler2200B)
- // {
- // _pmHeatRoutine.Start();
- // }
- // 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);
- }
- }
- }
- }
|