12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501 |
- using System;
- 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.Log;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Sorter.Common;
- using JetVirgoPM.Devices;
- using JetVirgoPM.Devices.EPDs;
- using JetVirgoPM.PMs.RecipeExecutors;
- using JetVirgoPM.PMs.Routines;
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Schedulers;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.EdwardsPump;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Pumps.SkyPump;
- using MECF.Framework.RT.ModuleLibrary.PMModules;
- using MECF.Framework.RT.ModuleLibrary.SystemModules;
- namespace JetVirgoPM.PMs
- {
- public class PMModule : PMModuleBase, IRecipeExecutor
- {
- public enum MSG
- {
- Home,
- Transfer,
- PrepareTransfer,
- PostTransfer,
- Reset,
- Abort,
- Error,
- LaunchPump,
- Pump,
- Vent,
- Purge,
- CyclePurge,
- Heat,
- TransferHandoff,
- StartTransfer,
- LeakCheck,
- DeleteLeakCheck,
- MoveLiftPin1,
- MoveLiftPin2,
- MoveGuidePin1,
- MoveGuidePin2,
- MFCVerification,
- Clean,
- CleanReady,
- ATMProcess,
- Process,
- RunRecipe,
- PostProcess,
- RecipeSkipStep,
- RecipeUpdate,
- RecipeResume,
- RecipePause,
- RecipeAbort,
- PreProcess,
- AutoMode,
- ManualMode,
- LockLid,
- SetOnline,
- SetOffline,
- SelectRecipe,
- GasFlow,
- StopGasFlow,
- RfPower,
- MaxMsg
- }
- public enum STATE
- {
- Init,
- Idle,
- Homing,
- GasFlowing,
- RfPowering,
- Heating,
- LaunchingPump,
- Pumping,
- Venting,
- Purging,
- MoveLift,
- Purge,
- Transfer,
- Error,
- PrepareTransfer,
- PostTransfer,
- TransferHandoff,
- //Process,
- LeakCheck,
- Liftpin1Moving,
- Liftpin2Moving,
- GuidePin1Moving,
- GuidePin2Moving,
- PreClean,
- LoadProcessRecipe,
- ATMProcessing,
- PreProcess,
- Processing,
- PostProcess,
- OpeningLid,
- ClosingLid,
- MFCVerification,
- NotInstall
- }
- #region Fields
- private int _bigWafer = 0;
- private int _midWafer = 0;
- private int _smallWafer = 0;
- private bool _enableBiasRF1;
- private bool _enableBiasRF2;
- private bool _chamber1Disabled;
- private bool _chamber2Disabled;
- private StatsDataItemRFAndPump _statRf1OnTime;
- private StatsDataItemRFAndPump _statRf2OnTime;
- private StatsDataItemRFAndPump _statBiasRf1OnTime;
- private StatsDataItemRFAndPump _statBiasRf2OnTime;
- private StatsDataItemRFAndPump _statPumpOnTime;
- private readonly JetDualPM _chamber;
- private string _processStatus;
- private DateTime _recipeStartTime;
- //routine
- private VentRoutine _ventRoutine;
- private PumpDownRoutine _pumpRoutine;
- private StartPumpRoutine _startPumpRoutine;
- private TemperatureControlRoutine _temperatureControlRoutine;
- private GasFlowRoutine _gasFlowRoutine;
- private RfPowerRoutine _rfPowerRoutine;
- private CyclePurgeRoutine _cyclePurgeRoutine;
- private CleanRoutine _cleanRoutine;
- private PMATMProcessRoutine _ATMProcessRoutine;
- private ProcessRoutine _processRoutine;
- private PreProcessRoutine _preProcessRoutine;
- private PostProcessRoutine _postProcessRoutine;
- private LeakCheckRoutine _leakCheckRoutine;
- private PMPrepareTransferRoutine _prepareTrans;
- private PMPostTransferRoutine _postTrans;
- private PMTransferHandoffRoutine _transferHandoff;
- private PMHomeRoutine _home;
- private PMMfcVerificationRoutine _mfcVerification;
- private AutoFlag _AutoMode;
- 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 RecipeRunningInfo _recipeRunningInfo = new RecipeRunningInfo();
- #endregion
- #region Properties
- public Action<bool, bool> TransferPrepared;
- public bool IsIdle
- {
- get { return FsmState == (int)STATE.Idle; }
- }
- public bool IsAutoMode => _AutoMode == AutoFlag.Auto;
- public RecipeRunningInfo RecipeRunningInfo
- {
- get
- {
- return _recipeRunningInfo;
- }
- }
- 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 override bool IsInit
- {
- get { return FsmState == (int)STATE.Init; }
- }
- public bool IsBusy
- {
- get { return !IsInit && !IsError && !IsIdle; }
- }
- public bool IsProcessing
- {
- get { return FsmState == (int)STATE.PreProcess || FsmState == (int)STATE.Processing || FsmState == (int)STATE.PostProcess; }
- }
- private DateTime _leakCheckStartTime;
- private TimeSpan _leakCheckElapsedTime;
- private string LeakCheckElapseTime
- {
- get
- {
- if ((FsmState == (int)STATE.LeakCheck))
- _leakCheckElapsedTime = DateTime.Now - _leakCheckStartTime;
- return string.Format("{0}:{1}:{2}", ((int)_leakCheckElapsedTime.TotalHours).ToString("00"),
- _leakCheckElapsedTime.Minutes.ToString("00"), _leakCheckElapsedTime.Seconds.ToString("00"));
- }
- }
- private string PumpTime
- {
- get
- {
- if ((FsmState == (int)STATE.Pumping) || (FsmState == (int)STATE.PreProcess))
- _pumpElapsedTime = DateTime.Now - _pumpStartTime;
- return string.Format("{0}:{1}:{2}", ((int)_pumpElapsedTime.TotalHours).ToString("00"),
- _pumpElapsedTime.Minutes.ToString("00"), _pumpElapsedTime.Seconds.ToString("00"));
- }
- }
- private int StepNo
- {
- get
- {
- if ((FsmState == (int)STATE.Processing) || (FsmState == (int)STATE.PostProcess))
- {
- return _processRoutine.CurStepNum + 1;
- }
- return 0;
- }
- }
- private int RecipeSteps
- {
- get
- {
- if ((FsmState == (int)STATE.PreProcess) || (FsmState == (int)STATE.Processing) || (FsmState == (int)STATE.PostProcess))
- {
- return _preProcessRoutine.CurrentRecipeStepList.Count;
- }
- return 0;
- }
- }
- private string RecipeStepName
- {
- get
- {
- if ((FsmState == (int)STATE.PreProcess) || (FsmState == (int)STATE.Processing) || (FsmState == (int)STATE.PostProcess))
- {
- return _processRoutine.CurStepComment;
- }
- return null;
- }
- }
- private double LeakRate
- {
- get { return _leakCheckRoutine.LeakRate; }
- }
- private string RecipeName
- {
- get
- {
- if ((FsmState == (int)STATE.PreProcess) || (FsmState == (int)STATE.Processing) || (FsmState == (int)STATE.PostProcess))
- {
- return _preProcessRoutine.CurrentRecipeRunningName.Split('\\').Last();
- }
- return null;
- }
- }
- private string RFTime
- {
- get
- {
- if (FsmState == (int)STATE.RfPowering)
- _rfElapsedTime = DateTime.Now - _rfStartTime;
- return $"{((int)_rfElapsedTime.TotalHours).ToString("00")}:{_rfElapsedTime.Minutes.ToString("00")}:{_rfElapsedTime.Seconds.ToString("00")}";
- }
- }
- private string TCTime
- {
- get
- {
- if (FsmState == (int)STATE.Heating)
- _tcElapsedTime = DateTime.Now - _tcStartTime;
- return $"{((int)_tcElapsedTime.TotalHours).ToString("00")}:{_tcElapsedTime.Minutes.ToString("00")}:{_tcElapsedTime.Seconds.ToString("00")}";
- }
- }
- private TimeSpan _recipeElapsedTime;
- public string RecipeElapsedTime
- {
- get
- {
- if (FsmState == (int)STATE.LoadProcessRecipe || FsmState == (int)STATE.PreProcess
- || FsmState == (int)STATE.Processing || FsmState == (int)STATE.PostProcess)
- _recipeElapsedTime = DateTime.Now - _recipeStartTime;
- return string.Format("{0}:{1}:{2}", ((int)_recipeElapsedTime.TotalHours).ToString("00"),
- _recipeElapsedTime.Minutes.ToString("00"), _recipeElapsedTime.Seconds.ToString("00"));
- }
- }
- #endregion
- public override bool CheckAcked(int entityTaskToken)
- {
- return CheckExecuted(entityTaskToken);
- }
- public override bool IsReady
- {
- get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
- }
- public override void AssertPMReady(string description)
- {
- if (!IsReady)
- {
- LOG.Error($"{Module} {Name} {description} Assert当前状态 FsmState={FsmState} CheckAllMessageProcessed={CheckAllMessageProcessed()}");
- }
- }
- public override bool IsError
- {
- get { return FsmState == (int)STATE.Error; }
- }
- public bool IsPaused { get; set; }
- public override double ChamberPressure => _chamber.ChamberPressure;
- public bool CheckEnableRunProcess(out string reason)
- {
- throw new NotImplementedException();
- }
- public void ResetToleranceChecker()
- {
- throw new NotImplementedException();
- }
- public void OnProcessStart(string v1, string recipeName, bool v2)
- {
- throw new NotImplementedException();
- }
- public void PauseRecipe(out string reason)
- {
- throw new NotImplementedException();
- }
- public bool CheckAllDevicesStable(float v1, float v2, float v3, float v4, float v5, float v6, float v7, float v8, float v9)
- {
- throw new NotImplementedException();
- }
- public void AbortRunProcess(out string reason)
- {
- throw new NotImplementedException();
- throw new NotImplementedException();
- }
- public override bool? SlitDoorIsClose
- {
- get
- {
- if(_chamber != null)
- return !_chamber.CheckSlitDoor1Open() && !_chamber.CheckSlitDoor2Open();
- return new bool?();
- }
- }
- public bool NotExtendSignalArrival => _chamber.IsTMRobotNotExtendToPM1 && _chamber.IsTMRobotNotExtendToPM2;
- public event Action<string> OnEnterError;
- private ModuleName _module;
- private bool _isInit;
- private StatsData _statWaferCount1;
- private StatsData _statProcessTime1;
- private StatsData _statWaferCount2;
- private StatsData _statProcessTime2;
- private Stopwatch _processTimer = new Stopwatch();
- public PMModule(ModuleName module, int slotCount) : base(slotCount)
- {
- _module = module;
- Module = module.ToString();
- Name = module.ToString();
- _enableBiasRF1 = SC.GetValue<bool>($"{Module}.BiasRf1.EnableBiasRF");
- _enableBiasRF2 = SC.GetValue<bool>($"{Module}.BiasRf2.EnableBiasRF");
- _chamber1Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber1Disabled.IsInstalled");
- _chamber2Disabled = SC.GetValue<bool>($"System.SetUp.{Module}Chamber2Disabled.IsInstalled");
- _chamber = DEVICE.GetDevice<JetDualPM>($"{module}.{module}");
- EnumLoop<STATE>.ForEach((item) =>
- {
- MapState((int)item, item.ToString());
- });
- EnumLoop<MSG>.ForEach((item) =>
- {
- MapMessage((int)item, item.ToString());
- });
- EnableFsm(50, IsInstalled ? STATE.Init : STATE.NotInstall);
- LeakCheckResultManager.Instance.Initialize(Module.ToString());
- }
- public override bool Initialize()
- {
- if (!IsInstalled)
- return true;
- IsOnline = false;
- InitDevice();
- InitRoutine();
- InitInterlock();
- InitFsm();
- InitOp();
- InitData();
- InitStats();
- return base.Initialize();
- }
- protected virtual void InitRoutine()
- {
- _ventRoutine = new VentRoutine(_chamber);
- _pumpRoutine = new PumpDownRoutine(_chamber);
- _startPumpRoutine = new StartPumpRoutine(_chamber);
- _temperatureControlRoutine = new TemperatureControlRoutine(_chamber);
- _prepareTrans = new PMPrepareTransferRoutine(_chamber, _ventRoutine);
- _transferHandoff = new PMTransferHandoffRoutine(_chamber);
- _postTrans = new PMPostTransferRoutine(_chamber);
- _gasFlowRoutine = new GasFlowRoutine(_chamber);
- _rfPowerRoutine = new RfPowerRoutine(_chamber, true);
- _cyclePurgeRoutine = new CyclePurgeRoutine(_chamber);
- _leakCheckRoutine = new LeakCheckRoutine(_chamber, _pumpRoutine);
- _cleanRoutine = new CleanRoutine(_chamber);
- _ATMProcessRoutine = new PMATMProcessRoutine(_chamber);
- _preProcessRoutine = new PreProcessRoutine(_chamber, _pumpRoutine);
- _processRoutine = new ProcessRoutine(_chamber, this);
- _postProcessRoutine = new PostProcessRoutine(_chamber, _ventRoutine);
- _home = new PMHomeRoutine(_chamber);
- _mfcVerification = new PMMfcVerificationRoutine(_chamber, _pumpRoutine);
- }
- protected virtual void InitData()
- {
- DATA.Subscribe($"{Module}.IsError", () => IsError);
- DATA.Subscribe($"{Module}.State", () => FsmState);
- DATA.Subscribe($"{Module}.Status", () => StringFsmStatus);
- DATA.Subscribe($"{Module}.IsOnline", () => IsOnline);
- DATA.Subscribe($"{Module}.WaferSize", () => WaferManager.Instance.GetWaferSize(_module, 0).ToString());
- DATA.Subscribe($"{Module}.WaferSize1", () => WaferManager.Instance.GetWaferSize(_module, 1).ToString());
- DATA.Subscribe($"{Module}.IsInMaintainMode", () => !IsOnline);
- //DATA.Subscribe($"{Name}.SelectedRecipeName", () => _recipeRunningInfo.RecipeName);
- //DATA.Subscribe($"{Name}.RecipeStepNumber", () => _recipeRunningInfo.StepNumber);
- //DATA.Subscribe($"{Name}.RecipeStepName", () => _recipeRunningInfo.StepName);
- //DATA.Subscribe($"{Name}.RecipeStepElapseTime", () => _recipeRunningInfo.StepElapseTime);
- //DATA.Subscribe($"{Name}.RecipeStepTime", () => _recipeRunningInfo.StepTime);
- //DATA.Subscribe($"{Name}.RecipeTotalElapseTime", () => _recipeRunningInfo.TotalElapseTime);
- //DATA.Subscribe($"{Name}.RecipeTotalTime", () => _recipeRunningInfo.TotalTime);
- DATA.Subscribe($"{Module}.FsmState", () => ((STATE)FsmState).ToString());
- DATA.Subscribe($"{Module}.FsmPrevState", () => ((STATE)FsmPreviousState).ToString());
- DATA.Subscribe($"{Module}.FsmLastMessage", ((MSG)FsmLastMessage).ToString());
- DATA.Subscribe($"{Module}.IsAutoMode", () => IsAutoMode);
- DATA.Subscribe($"{Module}.IsAlarm", () => _isAlarm);
- DATA.Subscribe($"{Module}.ProcessStatus", () => _processStatus);
- DATA.Subscribe($"{Module}.PumpTime", () => PumpTime);
- DATA.Subscribe($"{Module}.TCTime", () => TCTime);
- DATA.Subscribe($"{Module}.StepNo", () => StepNo);
- DATA.Subscribe($"{Module}.RecipeStepName", () => RecipeStepName);
- DATA.Subscribe($"{Module}.RecipeName", () => RecipeName);
- DATA.Subscribe($"{Module}.LeakRate", () => LeakRate);
- DATA.Subscribe($"{Module}.LeakCheckElapseTime", () => LeakCheckElapseTime);
- DATA.Subscribe($"{Module}.SmallWafer", () => _smallWafer);
- DATA.Subscribe($"{Module}.BigWafer", () => _bigWafer);
- DATA.Subscribe($"{Module}.MidWafer", () => _midWafer);
- DATA.Subscribe($"{Module}.RecipeSteps", () => RecipeSteps);
- DATA.Subscribe($"{Module}.RecipeProcessTime", () => RecipeElapsedTime);
- DATA.Subscribe($"{Module}.RecipeStepTimeElapsed", () => (_processRoutine.CurStepElpasedTime / 1000).ToString("F0"));
- DATA.Subscribe($"{Module}.RecipeStepTimeSetPoint", () => (_processRoutine.CurStepTotalTime / 1000).ToString("F0"));
- }
- private void InitStats()
- {
- _statWaferCount1 = new StatsData($"{Module}.ProcessedWaferCount1", "PM1 Total processed wafer", 0);
- _statWaferCount2 = new StatsData($"{Module}.ProcessedWaferCount2", "PM2 Total processed wafer", 0);
- _statProcessTime1 = new StatsData($"{Module}.ProcessTime1", "PM1 Total process time", 0);
- _statProcessTime2 = new StatsData($"{Module}.ProcessTime2", "PM2 Total process time", 0);
- StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount1", "PM1 Processed Wafer Count", 0);
- StatsDataManager.Instance.Subscribe($"{Module}.ProcessedWaferCount2", "PM2 Processed Wafer Count", 0);
- StatsDataManager.Instance.Subscribe($"{Module}.Rf1.RfOnTime", "Rf 1 On Time");
- StatsDataManager.Instance.Subscribe($"{Module}.Rf2.RfOnTime", "Rf 2 On Time");
- if (_enableBiasRF1)
- StatsDataManager.Instance.Subscribe($"{Module}.BiasRf1.RfOnTime", "Bias Rf 1 On Time");
- if (_enableBiasRF2)
- StatsDataManager.Instance.Subscribe($"{Module}.BiasRf2.RfOnTime", "Bias Rf 2 On Time");
- StatsDataManager.Instance.Subscribe($"{Module}.PumpOnTime", "Pump On Time");
-
- _statRf1OnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.Rf1.RfOnTime");
- _statRf2OnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.Rf2.RfOnTime");
- if (_enableBiasRF1)
- _statBiasRf1OnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRf1.RfOnTime");
- if (_enableBiasRF2)
- _statBiasRf2OnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.BiasRf2.RfOnTime");
- _statPumpOnTime = StatsDataManager.Instance.GetItemRFAndPump($"{Module}.PumpOnTime");
- DATA.Subscribe($"{Module}.ProcessTime1.Value", () => _statProcessTime1.GetValue());
- DATA.Subscribe($"{Module}.ProcessedWaferCount1.Value", () => _statWaferCount1.GetValue());
- DATA.Subscribe($"{Module}.ProcessTime2.Value", () => _statProcessTime2.GetValue());
- DATA.Subscribe($"{Module}.ProcessedWaferCount2.Value", () => _statWaferCount2.GetValue());
- DATA.Subscribe($"{Module}.Rf1.RfOnTime.Value", () => _statRf1OnTime.fromLastPM);
- DATA.Subscribe($"{Module}.Rf2.RfOnTime.Value", () => _statRf2OnTime.fromLastPM);
- DATA.Subscribe($"{Module}.PumpOnTime.Value", () => _statPumpOnTime.fromLastPM);
- if (_enableBiasRF1)
- DATA.Subscribe($"{Module}.BiasRf1.RfOnTime.Value", () => _statBiasRf1OnTime.fromLastPM);
- if (_enableBiasRF2)
- DATA.Subscribe($"{Module}.BiasRf2.RfOnTime.Value", () => _statBiasRf2OnTime.fromLastPM);
- }
- private void InitOp()
- {
- OP.Subscribe($"{Module}.Home", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Home));
- OP.Subscribe($"{Module}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
- OP.Subscribe($"{Module}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
- OP.Subscribe($"{Module}.Pump", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Pump));
- OP.Subscribe($"{Module}.Vent", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Vent));
- OP.Subscribe($"{Module}.Purge", (string cmd, object[] args) => CheckToPostMessage((int)MSG.CyclePurge));
- OP.Subscribe($"{Module}.PutOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
- OP.Subscribe($"{Module}.PutOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
- OP.Subscribe($"{Module}.{RtOperation.PmOnline}", (cmd, args) => CheckToPostMessage((int)MSG.SetOnline));
- OP.Subscribe($"{Module}.{RtOperation.PmOffline}", (cmd, args) => CheckToPostMessage((int)MSG.SetOffline));
- OP.Subscribe($"{Name}.SelectRecipe", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SelectRecipe, args[0]));
- OP.Subscribe($"{Module}.{RtOperation.GasFlow}", (cmd, args) => CheckToPostMessage((int)MSG.GasFlow, args));
- OP.Subscribe($"{Module}.{RtOperation.RfPower}", (cmd, args) => CheckToPostMessage((int)MSG.RfPower, args));
- OP.Subscribe($"{Module}.MoveLiftPin1", (cmd, args) => CheckToPostMessage((int)MSG.MoveLiftPin1, args[0]));
- OP.Subscribe($"{Module}.MoveLiftPin2", (cmd, args) => CheckToPostMessage((int)MSG.MoveLiftPin2, args[0]));
- OP.Subscribe($"{Module}.MoveGuidePin1", (cmd, args) => CheckToPostMessage((int)MSG.MoveGuidePin1, args[0], args[1]));
- OP.Subscribe($"{Module}.MoveGuidePin2", (cmd, args) => CheckToPostMessage((int)MSG.MoveGuidePin2, args[0], args[1]));
- OP.Subscribe($"{Module}.PrepareTransfer", (cmd, args) => CheckToPostMessage((int)MSG.PrepareTransfer, args[0]));
- OP.Subscribe($"{Module}.TransferHandoff", (cmd, args) => CheckToPostMessage((int)MSG.TransferHandoff, args[0]));
- OP.Subscribe($"{Module}.{RtOperation.StartPump}", (cmd, args) => CheckToPostMessage((int)MSG.LaunchPump));
- OP.Subscribe($"{Module}.{RtOperation.LeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.LeakCheck, args));
- OP.Subscribe($"{Module}.{RtOperation.DeleteLeakCheck}", (cmd, args) => CheckToPostMessage((int)MSG.DeleteLeakCheck, args));
- OP.Subscribe($"{Module}.{RtOperation.LockLid}", (cmd, args) => CheckToPostMessage((int)MSG.LockLid, true));
- OP.Subscribe($"{Module}.{RtOperation.UnlockLid}", (cmd, args) => CheckToPostMessage((int)MSG.LockLid, false));
- OP.Subscribe($"{Module}.{RtOperation.RunRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RunRecipe, (string)args[0], "", true));
- OP.Subscribe($"{Module}.{RtOperation.SkipCurrentStep}", (cmd, args) => CheckToPostMessage((int)MSG.RecipeSkipStep));
- OP.Subscribe($"{Module}.{RtOperation.AbortRecipe}", (cmd, args) => CheckToPostMessage((int)MSG.RecipeAbort));
- OP.Subscribe($"{Module}.{RtOperation.PmAuto}", (cmd, args) => CheckToPostMessage((int)MSG.AutoMode));
- OP.Subscribe($"{Module}.{RtOperation.PmManual}", (cmd, args) => CheckToPostMessage((int)MSG.ManualMode));
- OP.Subscribe($"{Module}.{RtOperation.Heat}", (cmd, args) => CheckToPostMessage((int)MSG.Heat, args));
- OP.Subscribe($"{Module}.{RtOperation.MFCVerification}", (cmd, args) => CheckToPostMessage((int)MSG.MFCVerification, args));
- }
- private void InitFsm()
- {
- //Idle
- EnterExitTransition((int)STATE.Idle, FnIdle, (int)FSM_MSG.NONE, null);
- EnterExitTransition<STATE, FSM_MSG>(STATE.Error, fEnterError, FSM_MSG.NONE, null);
- //Error
- Transition(STATE.Init, MSG.Error, FnError, STATE.Error);
- Transition(STATE.Error, MSG.Reset, FnReset, STATE.Idle);
- AnyStateTransition(MSG.Error, FnError, STATE.Error);
- AnyStateTransition(FSM_MSG.WARNING, fWarning, FSM_STATE.SAME);
- AnyStateTransition((int)FSM_MSG.ALARM, fAlarm, (int)STATE.Error);
- AnyStateTransition(MSG.AutoMode, FnSetAuto, FSM_STATE.SAME);
- AnyStateTransition(MSG.ManualMode, FnSetManual, FSM_STATE.SAME);
- AnyStateTransition(MSG.SetOnline, FnSetOnline, FSM_STATE.SAME);
- AnyStateTransition(MSG.SetOffline, FnSetOffline, FSM_STATE.SAME);
- AnyStateTransition(FSM_MSG.TIMER, FnControlPressure, FSM_STATE.SAME);
- //Home
- EnterExitTransition((int)STATE.Homing, FnEnterHome, (int)FSM_MSG.NONE, FnExitHome);
- Transition(STATE.Init, MSG.Home, FnStartHome, STATE.Homing);
- Transition(STATE.Error, MSG.Home, FnStartHome, STATE.Homing);
- Transition(STATE.Idle, MSG.Home, FnStartHome, STATE.Homing);
- Transition(STATE.Homing, FSM_MSG.TIMER, FnMonitorHome, STATE.Idle);
- Transition(STATE.Homing, MSG.Error, null, STATE.Init);
- Transition(STATE.Homing, MSG.Abort, FnAbortTask, STATE.Init);
- // Gas Flow sequence
- Transition(STATE.Idle, MSG.GasFlow, FnStartGasFlow, STATE.GasFlowing);
- Transition(STATE.GasFlowing, MSG.GasFlow, FnStartGasFlow, STATE.GasFlowing);
- Transition(STATE.GasFlowing, FSM_MSG.TIMER, FnGasFlowTimeout, STATE.Idle);
- Transition(STATE.GasFlowing, MSG.StopGasFlow, FnStopGasFlow, STATE.Idle);
- Transition(STATE.GasFlowing, MSG.Abort, FnAbortGasFlow, STATE.Idle);
- //RF Power sequence
- Transition(STATE.Idle, MSG.RfPower, FnStartRfPower, STATE.RfPowering);
- Transition(STATE.GasFlowing, MSG.RfPower, FnStartRfPower, STATE.RfPowering);
- Transition(STATE.RfPowering, FSM_MSG.TIMER, FnRfPowerTimeout, STATE.Idle);
- Transition(STATE.RfPowering, MSG.Abort, FnAbortRfPower, STATE.Idle);
- // Heat substrate
- Transition(STATE.Idle, MSG.Heat, FnHeat, STATE.Heating);
- Transition(STATE.Heating, FSM_MSG.TIMER, FnHeatTimeout, STATE.Idle);
- Transition(STATE.Heating, MSG.Abort, FnAbortHeating, STATE.Idle);
- //Launch Pump sequence
- Transition(STATE.Idle, MSG.LaunchPump, FnLaunchPump, STATE.LaunchingPump);
- Transition(STATE.LaunchingPump, FSM_MSG.TIMER, FnLaunchPumpTimeout, STATE.Idle);
- Transition(STATE.LaunchingPump, MSG.Abort, FnAbortStartPumping, STATE.Idle);
- //Pump sequence
- Transition(STATE.Idle, MSG.Pump, FnStartPumpDown, STATE.Pumping);
- Transition(STATE.Venting, MSG.Pump, FnVentToPumping, STATE.Pumping);
- Transition(STATE.Pumping, FSM_MSG.TIMER, FnPumpDownTimeout, STATE.Idle);
- Transition(STATE.Pumping, MSG.Abort, FnAbortPumping, STATE.Idle);
- //vent sequence
- Transition(STATE.Idle, MSG.Vent, FnStartVent, STATE.Venting);
- Transition(STATE.Pumping, MSG.Vent, FnPumpingToVent, STATE.Venting);
- Transition(STATE.Venting, FSM_MSG.TIMER, FnVentTimeout, STATE.Idle);
- Transition(STATE.Venting, MSG.Abort, FnAbortVent, STATE.Idle);
- // Purge sequence
- Transition(STATE.Idle, MSG.CyclePurge, FnStartPurge, STATE.Purging);
- Transition(STATE.Purging, FSM_MSG.TIMER, FnPurgeTimeout, STATE.Idle);
- Transition(STATE.Purging, MSG.Abort, FnAbortPurge, STATE.Idle);
- //Leak check sequence
- Transition(STATE.Idle, MSG.LeakCheck, FnStartLeakCheck, STATE.LeakCheck);
- Transition(STATE.Idle, MSG.DeleteLeakCheck, FnDeleteLeakCheck, STATE.Idle);
- Transition(STATE.LeakCheck, FSM_MSG.TIMER, FnLeakCheckTimeout, STATE.Idle);
- Transition(STATE.LeakCheck, MSG.Abort, FnAbortLeakCheck, STATE.Idle);
- //MFC verification
- Transition(STATE.Idle, MSG.MFCVerification, FnStartMFCVerification, STATE.MFCVerification);
- Transition(STATE.MFCVerification, FSM_MSG.TIMER, FnMFCVerificationTimeout, STATE.Idle);
- Transition(STATE.MFCVerification, MSG.Abort, FnAbortMFCVerification, STATE.Idle);
- // Transfer
- Transition(STATE.Idle, MSG.PrepareTransfer, FnStartPrepareTransfer, STATE.PrepareTransfer);
- Transition(STATE.PrepareTransfer, FSM_MSG.TIMER, FnPreTransferTimeout, STATE.Idle);
- Transition(STATE.PrepareTransfer, MSG.Abort, FnAbortTask, STATE.Idle);
- Transition(STATE.Idle, MSG.PostTransfer, FnStartPostTransfer, STATE.PostTransfer);
- Transition(STATE.PostTransfer, FSM_MSG.TIMER, FnPostTransferTimeout, STATE.Idle);
- Transition(STATE.PostTransfer, MSG.Abort, FnAbortTask, STATE.Idle);
- Transition(STATE.Idle, MSG.TransferHandoff, FnStartTransferHandoff, STATE.TransferHandoff);
- Transition(STATE.TransferHandoff, FSM_MSG.TIMER, FnTransferHandoffTimeout, STATE.Idle);
- Transition(STATE.TransferHandoff, MSG.Abort, FnAbortTask, STATE.Idle);
- // lift pin
- Transition(STATE.Idle, MSG.MoveLiftPin1, FnSetLiftPin1, STATE.Liftpin1Moving);
- Transition(STATE.Idle, MSG.MoveLiftPin2, FnSetLiftPin2, STATE.Liftpin2Moving);
- Transition(STATE.Liftpin1Moving, FSM_MSG.TIMER, FnLiftpin1Timeout, STATE.Idle);
- Transition(STATE.Liftpin1Moving, FSM_MSG.TIMER, FnLiftpin2Timeout, STATE.Idle);
- // guide pin
- Transition(STATE.Idle, MSG.MoveGuidePin1, FnSetGuidePin, STATE.GuidePin1Moving);
- Transition(STATE.Idle, MSG.MoveGuidePin2, FnSetGuidePin, STATE.GuidePin2Moving);
- Transition(STATE.GuidePin1Moving, FSM_MSG.TIMER, FnGuidePin1Timeout, STATE.Idle);
- Transition(STATE.GuidePin2Moving, FSM_MSG.TIMER, FnGuidePin2Timeout, STATE.Idle);
- //ATM Process
- Transition(STATE.Idle, MSG.ATMProcess, FnStartATMProcess, STATE.ATMProcessing);
- Transition(STATE.ATMProcessing, FSM_MSG.TIMER, FnATMProcessTimeout, STATE.Idle);
- Transition(STATE.ATMProcessing, MSG.Abort, FnAbortATMProcess, STATE.Idle);
- Transition(STATE.ATMProcessing, MSG.RecipeAbort, FnAbortATMProcess, STATE.Idle);
- // PreClean sequence
- Transition(STATE.Idle, MSG.Clean, FnPreClean, STATE.PreClean);
- Transition(STATE.PreClean, FSM_MSG.TIMER, FnPreCleanTimeout, STATE.LoadProcessRecipe);
- // PreProcess sequence
- Transition(STATE.Idle, MSG.RunRecipe, FnProcessLoadRecipe, STATE.LoadProcessRecipe);
- Transition(STATE.LoadProcessRecipe, MSG.PreProcess, FnStartPreProcess, STATE.PreProcess);
- Transition(STATE.LoadProcessRecipe, MSG.Abort, null, STATE.Idle);
- Transition(STATE.LoadProcessRecipe, MSG.Error, null, STATE.Idle);
- Transition(STATE.PreProcess, FSM_MSG.TIMER, FnPreProcessTimeout, STATE.PreProcess);
- Transition(STATE.PreProcess, MSG.Abort, FnAbortPreProcess, STATE.Idle);
- Transition(STATE.PreProcess, MSG.RecipeAbort, FnAbortPreProcess, STATE.Idle);
- Transition(STATE.PreProcess, MSG.Error, FnAbortPreProcess, STATE.Error);
- // Process
- Transition(STATE.PreProcess, MSG.Process, FnStartProcess, STATE.Processing);
- Transition(STATE.Processing, FSM_MSG.TIMER, FnProcessTimeout, STATE.Processing);
- Transition(STATE.Processing, MSG.Error, FnAbortProcess, STATE.Error);
- Transition(STATE.Processing, MSG.RecipeAbort, FnAbortProcess, STATE.PostProcess);
- Transition(STATE.Processing, MSG.RecipePause, FnPauseProcess, STATE.Processing);
- Transition(STATE.Processing, MSG.RecipeResume, FnResumeRecipe, STATE.Processing);
- Transition(STATE.Processing, MSG.RecipeUpdate, FnUpdateRecipe, STATE.Processing);
- Transition(STATE.Processing, MSG.RecipeSkipStep, FnSkipStep, STATE.Processing);
- EnterExitTransition<STATE, FSM_MSG>(STATE.Processing, FnEnterProcess, FSM_MSG.NONE, FnExitProcess);
- //PostProcess sequence
- Transition(STATE.Processing, MSG.PostProcess, FnStartPostProcess, STATE.PostProcess);
- Transition(STATE.PostProcess, FSM_MSG.TIMER, FnPostProcessTimeout, STATE.Idle);
- Transition(STATE.PostProcess, MSG.Abort, FnAbortPostProcess, STATE.Idle);
- Transition(STATE.PostProcess, MSG.RecipeAbort, FnAbortPostProcess, STATE.Idle);
- EnterExitTransition<STATE, FSM_MSG>(STATE.PostProcess, null, FSM_MSG.NONE, fExitPostProcess);
- }
- protected virtual void InitDevice()
- {
- }
- protected virtual void InitInterlock()
- {
- }
- private bool FsmSelectRecipe(object[] param)
- {
- _recipeRunningInfo.RecipeName = (string)param[0];
- return true;
- }
- #region Service functions
- public override bool Home(out string reason)
- {
- CheckToPostMessage((int)MSG.Home);
- reason = string.Empty;
- return true;
- }
- public override void Reset()
- {
- if (IsError)
- CheckToPostMessage((int)MSG.Reset);
- }
- public override bool PrepareTransfer(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
- {
- reason = "";
- return true;
- }
- public override bool PrepareTransfer(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, double temp1, double temp2, bool EanbleCheck, out string reason, EnumDualPM autoPos = EnumDualPM.None)
- {
- CheckToPostMessage((int)MSG.PrepareTransfer, transferType.ToString(), targetSlot, temp1, temp2, EanbleCheck, (int)blade, autoPos.ToString());
- reason = string.Empty;
- return true;
- }
- public override bool TransferHandoff(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
- {
- CheckToPostMessage((int)MSG.TransferHandoff, transferType.ToString(), targetSlot);
- reason = string.Empty;
- return true;
- }
- public override bool PostTransfer(ModuleName robot, Hand blade, int[] targetSlot, EnumTransferType transferType, out string reason)
- {
- CheckToPostMessage((int)MSG.PostTransfer, transferType.ToString(), targetSlot);
- reason = string.Empty;
- return true;
- }
- public override bool CheckTempReady(double Temp1, double Temp2)
- {
- double _checkTemp1;
- double _checkTemp2;
- double _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceToTarget");
- if (SC.GetValue<bool>($"{Module}.Chiller1.EnableChiller"))
- {
- _checkTemp1 = (double)_chamber.CoolantOutletTempFB1;
- }
- else
- {
- _checkTemp1 = (double)_chamber.LETempFB1;
- }
- if (SC.GetValue<bool>($"{Module}.Chiller2.EnableChiller"))
- {
- _checkTemp2 = (double)_chamber.CoolantOutletTempFB2;
- }
- else
- {
- _checkTemp2 = (double)_chamber.LETempFB2;
- }
- return ((_chamber1Disabled || Temp1 <= 0) || ((Temp1 - _tolerance) <= _checkTemp1 && _checkTemp1 <= (Temp1 + _tolerance))) &&
- ((_chamber2Disabled || Temp2 <= 0) || ((Temp2 - _tolerance) <= _checkTemp2 && _checkTemp2 <= (Temp2 + _tolerance)));
- }
- public override bool CheckTemp1Alarm(double recipeTemp1)
- {
- double _checkTemp1;
- double _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceTransferWafer");
- if (SC.GetValue<bool>($"{Module}.Chiller2.EnableChiller"))
- {
- _checkTemp1 = (double)_chamber.CoolantOutletTempFB1;
- }
- else
- {
- _checkTemp1 = (double)_chamber.LETempFB1;
- }
- return recipeTemp1 > (_checkTemp1 + _tolerance);
- }
- public override bool CheckTemp2Alarm(double recipeTemp2)
- {
- double _checkTemp2;
- double _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceTransferWafer");
- if (SC.GetValue<bool>($"{Module}.Chiller1.EnableChiller"))
- {
- _checkTemp2 = (double)_chamber.CoolantOutletTempFB2;
- }
- else
- {
- _checkTemp2 = (double)_chamber.LETempFB2;
- }
- return recipeTemp2 > (_checkTemp2 + _tolerance);
- }
- public override bool CheckTransferTempReady(double Temp1, double Temp2)
- {
- double _checkTemp1;
- double _checkTemp2;
- double _tolerance = SC.GetValue<double>($"System.MaxTemperatureToleranceTransferWafer");
- if (SC.GetValue<bool>($"{Module}.Chiller1.EnableChiller"))
- {
- _checkTemp1 = (double)_chamber.CoolantOutletTempFB1;
- }
- else
- {
- _checkTemp1 = (double)_chamber.LETempFB1;
- }
- if (SC.GetValue<bool>($"{Module}.Chiller2.EnableChiller"))
- {
- _checkTemp2 = (double)_chamber.CoolantOutletTempFB2;
- }
- else
- {
- _checkTemp2 = (double)_chamber.LETempFB2;
- }
- return ((_chamber1Disabled || Temp1 <= 0 ) || ((Temp1 - _tolerance) <= _checkTemp1 && _checkTemp1 <= (Temp1 + _tolerance))) &&
- ((_chamber2Disabled || Temp2 <= 0 ) || ((Temp2 - _tolerance) <= _checkTemp2 && _checkTemp2 <= (Temp2 + _tolerance)));
- }
- public override bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
- {
- reason = string.Empty;
- if (targetSlot == 0)
- {
- if (transferType == EnumTransferType.Pick)
- {
- if (!_chamber.CheckSlitDoor1Open())
- {
- reason = "Slit door is closed";
- return false;
- }
- if (!_chamber.CheckLift1Up())
- {
- reason = "Lift pin is down";
- return false;
- }
- return _chamber.CheckSlitDoor1Open() && _chamber.CheckLift1Up();
- }
- else if (transferType == EnumTransferType.Place)
- {
- if (!_chamber.CheckSlitDoor1Open())
- {
- reason = "Slit door is closed";
- return false;
- }
- if (!_chamber.CheckLift1Down())
- {
- reason = "Lift pin is Up";
- return false;
- }
- return _chamber.CheckSlitDoor1Open() && _chamber.CheckLift1Down();
- }
- }
- if (targetSlot == 1)
- {
- if (transferType == EnumTransferType.Pick)
- {
- if (!_chamber.CheckSlitDoor2Open())
- {
- reason = "Slit door is Closed";
- return false;
- }
- if (!_chamber.CheckLift2Up())
- {
- reason = "Lift pin is Down";
- return false;
- }
- return _chamber.CheckSlitDoor2Open() && _chamber.CheckLift2Up();
- }
- else if (transferType == EnumTransferType.Place)
- {
- if (!_chamber.CheckSlitDoor2Open())
- {
- reason = "Slit door is Closed";
- return false;
- }
- if (!_chamber.CheckLift2Down())
- {
- reason = "Lift pin is Up";
- return false;
- }
- return _chamber.CheckSlitDoor2Open() && _chamber.CheckLift2Down();
- }
- }
- reason = "Check Ready For Transfer Failed";
- return false;
- }
- public override void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
- {
- //if (FsmState == (int)STATE.InTransfer)
- // CheckToPostMessage(MSG.Transfer)
- }
- public override void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
- {
- //if (FsmState == (int)STATE.InTransfer)
- // CheckToPostMessage(MSG.Transfer)
- }
- public override bool Process(string recipeName, bool isCleanRecipe, bool withWafer, out string reason)
- {
- if (isCleanRecipe)
- {
- CheckToPostMessage((int)MSG.Clean, recipeName, "", withWafer);
- reason = string.Empty;
- return true;
- }
- if (SC.IsATMMode)
- {
- CheckToPostMessage((int)MSG.ATMProcess, recipeName);
- reason = string.Empty;
- return true;
- }
- _recipeRunningInfo.RecipeName = recipeName;
- CheckToPostMessage((int)MSG.RunRecipe, recipeName);
- reason = string.Empty;
- return true;
- }
- public override bool PreparePump(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool CheckPreparePump()
- {
- throw new NotImplementedException();
- }
- public override bool SlowPump(int tvPosition, out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool FastPump(int tvPosition, out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool TurnOnPump(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool CheckPumpIsOn()
- {
- throw new NotImplementedException();
- }
- public override bool ShutDownPump(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool AbortPump()
- {
- throw new NotImplementedException();
- }
- public override bool PrepareVent(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool CheckPrepareVent()
- {
- throw new NotImplementedException();
- }
- public override bool Vent(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool StopVent(out string reason)
- {
- throw new NotImplementedException();
- }
- public override bool CloseSlitValve(out string reason)
- {
- return _chamber.SetSlitDoor1(false, out reason) && _chamber.SetSlitDoor2(false, out reason);
- }
- //public override bool CheckSlitValveClose()
- //{
- // return _chamber.IsSlitDoor1Closed && _chamber.IsSlitDoor2Closed;
- //}
- public override bool CheckLiftUp(int _slot)
- {
- if(_slot == 0)
- {
- return _chamber.CheckLift1Up();
- }
- else if(_slot == 1)
- {
- return _chamber.CheckLift2Up();
- }
- return false;
- }
- public override bool CheckLiftDown(int _slot)
- {
- if (_slot == 0)
- {
- return _chamber.CheckLift1Down();
- }
- else if (_slot == 1)
- {
- return _chamber.CheckLift2Down();
- }
- return false;
- }
- public override bool CheckLidClosed()
- {
- throw new NotImplementedException();
- }
- // Methods
- //
- private bool FnAbortTask(object[] param)
- {
- //_task.Abort();
- return true;
- }
- private bool FnSetAuto(object[] param)
- {
- this._AutoMode = AutoFlag.Auto;
- return true;
- }
- private bool FnSetManual(object[] param)
- {
- if (FsmState == (int)STATE.PreProcess || FsmState == (int)STATE.Processing || FsmState == (int)STATE.PostProcess)
- {
- EV.PostWarningLog(Module.ToString(), $"{Module} is in {(STATE)FsmState},can not do SetAutoMode");
- return false;
- }
- this._AutoMode = AutoFlag.Manual;
- return true;
- }
- private bool FnSetOnline(object[] param)
- {
- //if (!SC.IsATMMode && !_chamber.IsVAC)
- //{
- // EV.PostWarningLog(Module, $"System is not ATM , And {Module} is not VAC cannot online");
- // return false;
- //}
- //else
- //{
- this._AutoMode = AutoFlag.Auto;
- IsOnline = true;
- return true;
- //}
- }
- private bool FnSetOffline(object[] param)
- {
- IsOnline = false;
- return true;
- }
- #region Gas&RF
- private bool FnStartGasFlow(object[] objs)
- {
- RState ret = _gasFlowRoutine.Start(objs);
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- }
- private bool FnGasFlowTimeout(object[] objs)
- {
- RState ret = _gasFlowRoutine.Monitor();
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return true;
- }
- return false;
- }
- private bool FnAbortGasFlow(object[] objs)
- {
- _gasFlowRoutine.Abort();
- return true;
- }
- private bool FnStopGasFlow(object[] objs)
- {
- _gasFlowRoutine.StopFlow2();
- return true;
- }
- private bool FnStartRfPower(object[] objs)
- {
- _rfStartTime = DateTime.Now;
- RState ret = _rfPowerRoutine.Start(objs);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- }
- private bool FnRfPowerTimeout(object[] objs)
- {
- RState ret = _rfPowerRoutine.Monitor();
- if (ret == RState.End)
- return true;
- else if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- ;
- }
- private bool FnAbortRfPower(object[] objs)
- {
- _rfPowerRoutine.Abort();
- if (_gasFlowRoutine._gasStatus)
- _gasFlowRoutine.Abort();
- return true;
- }
- private bool FnHeat(object[] objs)
- {
- _tcStartTime = DateTime.Now;
- RState ret = _temperatureControlRoutine.Start(objs);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _temperatureControlRoutine.Start(objs) == RState.RUN;
- }
- private bool FnHeatTimeout(object[] param)
- {
- RState ret = _temperatureControlRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnAbortHeating(object[] param)
- {
- _temperatureControlRoutine.Abort();
- return true;
- }
- #endregion Gas&RF
- #region Subroutine
- private bool FnStartLeakCheck(object[] param)
- {
- _leakCheckStartTime = DateTime.Now;
- RState ret = _leakCheckRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _leakCheckRoutine.Start(param) == Result.RUN;
- }
- private bool FnLeakCheckTimeout(object[] param)
- {
- RState ret = _leakCheckRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- //return res == Result.DONE || res == Result.FAIL;
- }
- private bool FnDeleteLeakCheck(object[] param)
- {
- _leakCheckRoutine.DeleteLeadCheck(param);
- return true;
- }
- private bool FnAbortLeakCheck(object[] param)
- {
- _leakCheckRoutine.Abort();
- return true;
- }
- private bool FnStartMFCVerification(object[] param)
- {
- _mfcVerification.Init((string)param[0], (float)param[1], (int)param[2]);
- RState ret = _mfcVerification.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _mfcVerification.Start(param) == Result.RUN;
- }
- private bool FnMFCVerificationTimeout(object[] param)
- {
- RState ret = _mfcVerification.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- //return res == Result.DONE || res == Result.FAIL;
- }
- private bool FnAbortMFCVerification(object[] param)
- {
- _mfcVerification.Abort();
- return true;
- }
- private bool FnStartVent(object[] param)
- {
- RState ret = _ventRoutine.Start();
- if (ret == RState.End)
- {
- return false;
- }
- else if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- }
- private bool FnVentTimeout(object[] param)
- {
- RState ret = _ventRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnVentToPumping(object[] param)
- {
- _ventRoutine.Abort();
- return FnStartPumpDown(param);
- }
- private bool FnAbortVent(object[] param)
- {
- _ventRoutine.Abort();
- return true;
- }
- private bool FnLaunchPump(object[] param)
- {
- _pumpStartTime = DateTime.Now;
- RState ret = _startPumpRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _startPumpRoutine.Start() == Result.RUN;
- }
- private bool FnLaunchPumpTimeout(object[] param)
- {
- RState ret = _startPumpRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnAbortStartPumping(object[] param)
- {
- _startPumpRoutine.Abort();
- return true;
- }
- private bool FnStartPumpDown(object[] param)
- {
- _pumpStartTime = DateTime.Now;
- RState ret = _pumpRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _pumpRoutine.Start() == Result.RUN;
- }
- private bool FnPumpDownTimeout(object[] param)
- {
- RState ret = _pumpRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnPumpingToVent(object[] param)
- {
- _pumpRoutine.Abort();
- return FnStartVent(param);
- }
- private bool FnAbortPumping(object[] param)
- {
- _pumpRoutine.Abort();
- return true;
- }
- private bool FnStartPurge(object[] param)
- {
- RState ret = _cyclePurgeRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //return _cyclePurgeRoutine.Start(param) == Result.RUN;
- }
- private bool FnPurgeTimeout(object[] param)
- {
- RState ret = _cyclePurgeRoutine.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- else if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return true;
- }
- return false;
- }
- private bool FnAbortPurge(object[] param)
- {
- _cyclePurgeRoutine.Abort();
- return true;
- }
- #endregion Subroutine
- #region Transfer
- private bool FnStartPrepareTransfer(object[] param)
- {
- //if (param.Length > 2)
- // _prepareTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (EnumDualPM)Enum.Parse(typeof(EnumDualPM), (string)param[1]), (float)param[2], (WaferSize)param[3]);
- //else if (param.Length > 1)
- // _prepareTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (EnumDualPM)Enum.Parse(typeof(EnumDualPM), (string)param[1]), (float)param[2]);
- //else
- int blade = -1;
- int bladeIndex = 5;
- if(param.Length > bladeIndex)
- {
- int.TryParse(param[bladeIndex].ToString(), out blade);
- }
- EnumDualPM pos = EnumDualPM.None;
- int posIndex = 6;
- if(param.Length > posIndex)
- {
- pos = (EnumDualPM)Enum.Parse(typeof(EnumDualPM), (string)param[posIndex]);
- }
- _prepareTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (int[])param[1], (double)param[2], (double)param[3], (bool)param[4], blade, pos);
- RState ret = _prepareTrans.Start();
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- return true;
- //Result ret = _prepareTrans.Start();
- //if (ret == Result.FAIL || ret == Result.DONE)
- // return false;
- //return ret == Result.RUN;
- }
- private bool FnPreTransferTimeout(object[] param)
- {
- RState ret = _prepareTrans.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnStartPostTransfer(object[] param)
- {
- _postTrans.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (int[])param[1]);
- RState ret = _postTrans.Start();
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.Running;
- }
- private bool FnPostTransferTimeout(object[] param)
- {
- RState ret = _postTrans.Monitor();
- if (ret == RState.End)
- {
- return true;
- }
- if (ret == RState.Failed || ret == RState.Timeout)
- {
- PostMsg(MSG.Error);
- //do nothing
- return true;
- }
- return false;
- }
- private bool FnStartTransferHandoff(object[] param)
- {
- _transferHandoff.Init((EnumTransferType)Enum.Parse(typeof(EnumTransferType), (string)param[0]), (int[])param[1]);
- RState ret = _transferHandoff.Start();
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.Running;
- }
- private bool FnTransferHandoffTimeout(object[] param)
- {
- RState ret = _transferHandoff.Monitor();
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.End;
- }
- private bool FnSetLiftPin1(object[] param)
- {
- MovementPosition pos = (MovementPosition)param[0];
- _ActivatedActionID = (ushort)param[1];
- if (pos == MovementPosition.Down) //增加Place & Pick的Delay功能
- {
- int LiftDelayTime = SC.GetValue<int>($"{Module}.PlaceAndPickDelayTime") * 1000;
- System.Threading.Thread.Sleep(LiftDelayTime);
- }
- _chamber.SetLiftPin1(pos, out _);
- EV.PostInfoLog(Module.ToString(), $"执行 lift pin {pos}");
- _goalLiftPin = pos;
- return true;
- }
- private bool FnSetLiftPin2(object[] param)
- {
- MovementPosition pos = (MovementPosition)param[0];
- _ActivatedActionID = (ushort)param[1];
- if (pos == MovementPosition.Down) //增加Place & Pick的Delay功能
- {
- int LiftDelayTime = SC.GetValue<int>($"{Module}.PlaceAndPickDelayTime") * 1000;
- System.Threading.Thread.Sleep(LiftDelayTime);
- }
- _chamber.SetLiftPin2(pos, out _);
- EV.PostInfoLog(Module.ToString(), $"执行 lift pin {pos}");
- _goalLiftPin = pos;
- return true;
- }
- private bool FnLiftpin1Timeout(object[] param)
- {
- if (_chamber.LiftPinPosition == _goalLiftPin)
- {
- EV.PostInfoLog(Module.ToString(), $"lift pin 当前位置 {_chamber.LiftPinPosition}");
- //EquipmentManager.Modules[ModuleName.EFEM].PostMsg(
- // _goalLiftPin == MovementPosition.Up ? EfemEntity.MSG.PMLiftPinUp : EfemEntity.MSG.PMLiftPinDown, _ActivatedActionID);
- _goalLiftPin = MovementPosition.Unknown;
- _ActivatedActionID = 0;
- return true;
- }
- return false;
- }
- private bool FnLiftpin2Timeout(object[] param)
- {
- if (_chamber.LiftPinPosition == _goalLiftPin)
- {
- EV.PostInfoLog(Module.ToString(), $"lift pin 当前位置 {_chamber.LiftPinPosition}");
- //EquipmentManager.Modules[ModuleName.EFEM].PostMsg(
- // _goalLiftPin == MovementPosition.Up ? EfemEntity.MSG.PMLiftPinUp : EfemEntity.MSG.PMLiftPinDown, _ActivatedActionID);
- _goalLiftPin = MovementPosition.Unknown;
- _ActivatedActionID = 0;
- return true;
- }
- return false;
- }
- private bool FnSetGuidePin(object[] param)
- {
- WaferSize ws = (WaferSize)param[0];
- MovementPosition pos = (MovementPosition)param[1];
- _chamber.SetGuidePin(ws, pos);
- return true;
- }
- private bool FnGuidePin1Timeout(object[] param)
- {
- return true;
- }
- private bool FnGuidePin2Timeout(object[] param)
- {
- return true;
- }
- private bool FnPreClean(object[] param)
- {
- _cleanRoutine.param = param;
- _chamber.SetSlitDoor1(false, out _);
- _chamber.SetSlitDoor2(false, out _);
- return true;
- }
- private bool FnPreCleanTimeout(object[] param)
- {
- if (_chamber.IsSlitDoor1Closed && _chamber.IsSlitDoor2Closed)
- {
- if (!FnProcessLoadRecipe(_cleanRoutine.param))
- {
- EV.PostAlarmLog(_chamber.Module.ToString(), "Clean recipe read failed");
- PostMsg(FSM_MSG.ALARM);
- return false;
- }
- return true;
- }
- return false;
- }
- #endregion Transfer
- #region Process
- private bool FnStartATMProcess(object[] param)
- {
- RState ret = _ATMProcessRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false; //do noting
- }
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.InProcess);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.InProcess);
- return true;
- }
- private bool FnATMProcessTimeout(object[] param)
- {
- RState ret = _ATMProcessRoutine.Monitor();
- if (ret == RState.End)
- {
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Completed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Completed);
- return true;
- }
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return true;
- }
- return false;
- }
- private bool FnAbortATMProcess(object[] param)
- {
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- _ATMProcessRoutine.Abort();
- return true;
- }
- private bool FnProcessLoadRecipe(object[] param)
- {
- _processStatus = "Succeed to load recipe";
- _recipeStartTime = DateTime.Now;
- RState ret = _preProcessRoutine.LoadRecipe(param);
- if (ret == RState.End)
- {
- PostMsg(MSG.PreProcess);
- }
- else if (ret == RState.Failed)
- {
- _processStatus = "Failed to load recipe";
- return false;
- }
- return true;
- }
- private bool FnStartPreProcess(object[] param)
- {
- _pumpStartTime = DateTime.Now;
- //_processStatus = Resources.PMEntity_fStartPreProcess_PreparingRunningRecipe;
- RState ret = _preProcessRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- if (ret == RState.Failed)
- {
- //_processStatus = Resources.PMEntity_fStartPreProcess_PreparingRunningRecipeFailed;
- PostMsg(MSG.Error);
- return false; //do noting
- }
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.InProcess);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.InProcess);
- return true;
- }
- private bool FnPreProcessTimeout(object[] param)
- {
- //_processStatus = Resources.PMEntity_fPreProcess_RunRecipePumpingDown;
- RState ret = _preProcessRoutine.Monitor();
- if (ret == RState.End)
- {
- PostMsg(MSG.Process,
- _preProcessRoutine.CurrentRecipeBaseName,
- _preProcessRoutine.CurrentRecipeRunningName,
- 0,
- _preProcessRoutine.CurrentLotName,
- _preProcessRoutine.CurrentRecipeContent,
- _preProcessRoutine.CurrentRecipeHead,
- _preProcessRoutine.CurrentRecipeStepList);
- return true;
- }
- if (ret == RState.Failed)
- {
- //_processStatus = Resources.PMEntity_fPreProcess_RunRecipePumpingDownFailed;
- PostMsg(MSG.Error);
- return true;
- }
- return false; ;
- }
- private bool FnAbortPreProcess(object[] param)
- {
- //_processStatus = Resources.PMEntity_fAbortPreProcess_RunRecipePumpingDownAborted;
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- _preProcessRoutine.Abort();
- return true;
- }
- private bool FnStartProcess(object[] param)
- {
- //_processStatus = Resources.PMEntity_fStartProcess_StartRunningRecipe;
- RState ret = _processRoutine.Start(param);
- if (ret == RState.End)
- {
- return true;
- }
- else if (ret == RState.Failed)
- {
- //_processStatus = Resources.PMEntity_fStartProcess_RunRecipeFailed;
- PostMsg(MSG.Error);
- return true; //do noting
- }
- return true;
- }
- private bool FnProcessTimeout(object[] param)
- {
- //_processStatus = Resources.PMEntity_fProcess_RunningRecipe;
- RState ret = _processRoutine.Monitor();
- {
- if (ret == RState.End)
- {
- PostMsg(MSG.PostProcess, _processRoutine.CurrentRecipeRunningName, _processRoutine.CurrentRecipeContent);
- return true;
- }
- else if (ret == RState.Failed)
- {
- //_processStatus = Resources.PMEntity_fStartProcess_RunRecipeFailed;
- PostMsg(MSG.Error);
- return true;
- }
- return false;
- }
- }
- private bool FnAbortProcess(object[] param)
- {
- //_processStatus = Resources.PMEntity_fAbortProcess_RunningRecipeAborted;
- _processRoutine.AbortRecipe();
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- _processRoutine.Abort();
- RState ret = _postProcessRoutine.Start(new object[] { _processRoutine.CurrentRecipeRunningName, _processRoutine.CurrentRecipeContent });
- if (ret == RState.End)
- {
- return false;
- }
- else if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- //_processStatus = Resources.PMEntity_fAbortProcess_RunRecipeAborted;
- return false; //do noting
- }
- return true;
- }
- private bool FnPauseProcess(object[] param)
- {
- return true;
- }
- private bool FnResumeRecipe(object[] param)
- {
- return true;
- }
- private bool FnUpdateRecipe(object[] param)
- {
- return true;
- }
- private bool FnSkipStep(object[] param)
- {
- _processRoutine.SkipCurrentRecipeStep();
- return true;
- }
- private bool FnExitProcess(object[] param)
- {
- _processRoutine.Exit();
-
- return true;
- }
- private bool FnEnterProcess(object[] param)
- {
- return true;
- }
- private bool FnStartPostProcess(object[] param)
- {
- //_processStatus = Resources.PMEntity_fStartPostProcess_RunRecipePostProcess;
- RState ret = _postProcessRoutine.Start(param);
- if (ret == RState.End)
- {
- return false;
- }
- else if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return true;
- }
- private bool FnPostProcessTimeout(object[] param)
- {
- //_processStatus = Resources.PMEntity_fPostProcess_RunRecipeCyclePurge;
- RState ret = _postProcessRoutine.Monitor();
- if (ret == RState.End)
- {
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Completed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Completed);
- //_processStatus = Resources.PMEntity_fPostProcess_RecipeCompleted;
- return true;
- }
- else if (ret == RState.Failed)
- {
- //_processStatus = Resources.PMEntity_fPostProcess_RunRecipeCyclePurgeError;
- PostMsg(MSG.Error);
- return true;
- }
- return false;
- }
- private bool FnAbortPostProcess(object[] param)
- {
- //_processStatus = Resources.PMEntity_fAbortPostProcess_RecipeAborted;
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- _postProcessRoutine.Abort();
- return true;
- }
- private bool fExitPostProcess(object[] objs)
- {
- _postProcessRoutine.Exit();
- //EV.Notify(EventLotFinished, new SerializableDictionary<string, string>()
- //{
- // {DVIDName.LotId, preProcessRoutine.CurrentLotName},
- // {DVIDName.JobId, preProcessRoutine.CurrentJobName},
- // {DVIDName.RecipeId, preProcessRoutine.CurrentRecipeBaseName }
- //});
- return true;
- }
- #endregion PROCESS
- private bool FnReset(object[] param)
- {
- _isAlarm = false;
- if ((STATE)FsmState == STATE.Error)
- return true;
- return false;
- }
- public bool Check(int msg, out string reason, object[] objs)
- {
- reason = "";
- return true;
- }
- public bool IsProcessed()
- {
- return IsIdle;
- }
- public override bool IsPrepareTransferReady(EnumTransferType type, EnumDualPM pos, WaferSize waferSize)
- {
- return _chamber.CheckEnableTransfer(type, pos, waferSize);
- }
- public void Home()
- {
- CheckToPostMessage((int)MSG.Home);
- }
- private bool FnExitHome(object[] param)
- {
- return true;
- }
- private bool FnEnterHome(object[] param)
- {
- return true;
- }
- private bool FnStartHome(object[] objs)
- {
- RState ret = _home.Start();
- if (ret == RState.Failed || ret == RState.End)
- return false;
- return ret == RState.Running;
- }
- private bool FnMonitorHome(object[] objs)
- {
- RState ret = _home.Monitor();
- if (ret == RState.Failed)
- {
- PostMsg(MSG.Error);
- return false;
- }
- return ret == RState.End;
- }
- private bool fExitTransfer(object[] objs)
- {
- return true;
- }
- private bool fEnterError(object[] objs)
- {
- //if (IsProcessMode)
- //{
- // EV.Notify(EventLotFinished, new SerializableDictionary<string, string>()
- // {
- // {DVIDName.LotId, preProcessRoutine.CurrentLotName},
- // {DVIDName.JobId, preProcessRoutine.CurrentJobName},
- // {DVIDName.RecipeId, preProcessRoutine.CurrentRecipeBaseName }
- // });
- //}
- _chamber.Generator1PowerOn(false);
- _chamber.GeneratorBias1PowerOn(false);
- _chamber.Generator2PowerOn(false);
- _chamber.GeneratorBias2PowerOn(false);
- _chamber.StopAllGases();
- return true;
- }
- private bool FnError(object[] objs)
- {
- OP.DoOperation("TM.SignalTower.ResetBuzzer");
- if (((STATE)FsmState == STATE.Processing) || ((STATE)FsmState == STATE.PreProcess)
- || ((STATE)FsmState == STATE.Homing) || ((STATE)FsmState == STATE.LoadProcessRecipe))
- return false;
- if (IsProcessing)
- {
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- }
- return true;
- }
- private bool fWarning(object[] objs)
- {
- //IsWarning = false;
- return true;
- }
- private bool fAlarm(object[] objs)
- {
- OP.DoOperation("TM.SignalTower.ResetBuzzer");
- _isAlarm = true;
- if (FsmState == (int)STATE.Init)
- return false;
- if (FsmState == (int)STATE.GasFlowing)
- {
- FnAbortGasFlow(null);
- }
- if (FsmState == (int)STATE.RfPowering)
- {
- FnAbortRfPower(null);
- }
- if (IsProcessing || FsmState == (int)STATE.ATMProcessing)
- {
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, EnumWaferProcessStatus.Failed);
- if (!WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 1).IsEmpty)
- WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 1, EnumWaferProcessStatus.Failed);
- }
- return true;
- }
- private bool FnIdle(object[] objs)
- {
- return true;
- }
- 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 override bool InvokePreHeat(double temperature1, double temperature2)
- {
- if (CheckToPostMessage((int)MSG.Heat, (double)temperature1, (double)temperature2))
- return true;
- return false;
- }
- public void InvokeReset()
- {
- PostMsg((int)MSG.Reset);
- }
- public void SetAuto()
- {
- this._AutoMode = AutoFlag.Auto;
- }
- private bool firstflag = false;
- private bool SoftPumpFlag = false;//表示在pump
- private bool FastPumpFlag = false;//表示在pump
- private bool ControlFlag = false;
- private bool InitFlag = true;
- public bool FnControlPressure(object[] objs)
- {
- if (SC.IsATMMode)
- {
- return true;
- }
- if (InitFlag)
- {
- if(_chamber.IsFastPumpOpened)
- {
- _chamber.OpenValve(ValveType.FAST_PUMP, false);
- }
- InitFlag = false;
- }
- if (!IsIdle)
- {
- firstflag = false;
- SoftPumpFlag = false;
- FastPumpFlag = false;
- ControlFlag = false;
- return true;
- }
- if (IsOnline)
- {
- //控压采用两种方式
- //1. 底压下抽(取决于腔体)
- //2. 联合控压(取决于压力配置)
- if (SC.IsSmartControlPressure)
- {
- //压力大 softpump先抽
- if (_chamber.ChamberPressurePressure >= 10000 && !SoftPumpFlag)
- {
- if(_chamber.CheckValveSwitchStatus(ValveType.FAST_PUMP, true))
- _chamber.OpenValve(ValveType.FAST_PUMP,false);
- if (_chamber.CheckValveSwitchStatus(ValveType.SOFT_PUMP, false))
- _chamber.OpenValve(ValveType.SOFT_PUMP,true);
- SoftPumpFlag = true;
- FastPumpFlag = false;
- }
- if (_chamber.ChamberPressurePressure < 10000 && !FastPumpFlag)
- {
- if (_chamber.CheckValveSwitchStatus(ValveType.SOFT_PUMP, true))
- _chamber.OpenValve(ValveType.SOFT_PUMP, false);
- if (_chamber.CheckValveSwitchStatus(ValveType.FAST_PUMP, false))
- _chamber.OpenValve(ValveType.FAST_PUMP, true);
- FastPumpFlag = true;
- SoftPumpFlag = false;
- }
- //如果小于PMControlPressureCheckPoint 开启蝶阀和N2 Purge Gas
- if (_chamber.ChamberPressurePressure <= SC.PMControlPressureCheckPoint && !ControlFlag)
- {
- _chamber.PressureControl(SC.PMControlPressureTarget);
- if (_chamber.CheckValveSwitchStatus(ValveType.Mfc2, false))
- {
- _chamber.OpenValve(ValveType.Mfc2, true);
- _chamber.SetGas2(SC.GetValue<double>($"{Module}.MFCForPressureControl"));
- }
- if (_chamber.CheckValveSwitchStatus(ValveType.PURGE, false))
- _chamber.OpenValve(ValveType.PURGE, true);
- if (_chamber.CheckValveSwitchStatus(ValveType.PROCESS, false))
- _chamber.OpenValve(ValveType.PROCESS, true);
-
- ControlFlag = true;
- }
- if(_chamber.ChamberPressurePressure > SC.PMControlPressureCheckPoint && ControlFlag)
- {
- if (_chamber.CheckValveSwitchStatus(ValveType.Mfc2, true))
- _chamber.OpenValve(ValveType.Mfc2, false);
- if (_chamber.CheckValveSwitchStatus(ValveType.PURGE, true))
- _chamber.OpenValve(ValveType.PURGE, false);
- if (_chamber.CheckValveSwitchStatus(ValveType.PROCESS, true))
- _chamber.OpenValve(ValveType.PROCESS, false);
- ControlFlag = false;
- }
- }
- else
- {
- if (_chamber.IsSoftPumpOpened)
- {
- if (_chamber.IsFastPumpOpened)
- _chamber.OpenValve(ValveType.FAST_PUMP, false);
- }
- else
- {
- if (!_chamber.IsFastPumpOpened)
- {
- _chamber.OpenValve(ValveType.FAST_PUMP, true);
- firstflag = true;
- }
- }
- }
- }
- else
- {
- if (SC.IsSmartControlPressure && (SoftPumpFlag || FastPumpFlag || ControlFlag))
- {
- if (SoftPumpFlag)
- {
- if (_chamber.CheckValveSwitchStatus(ValveType.SOFT_PUMP, true))
- _chamber.OpenValve(ValveType.SOFT_PUMP, false);
- SoftPumpFlag = false;
- }
- if (FastPumpFlag)
- {
- if (_chamber.CheckValveSwitchStatus(ValveType.FAST_PUMP, true))
- _chamber.OpenValve(ValveType.FAST_PUMP, false);
- FastPumpFlag = false;
- }
- if (ControlFlag)
- {
- if (_chamber.CheckValveSwitchStatus(ValveType.Mfc2, true))
- _chamber.OpenValve(ValveType.Mfc2, false);
- if (_chamber.CheckValveSwitchStatus(ValveType.PURGE, true))
- _chamber.OpenValve(ValveType.PURGE, false);
- if (_chamber.CheckValveSwitchStatus(ValveType.PROCESS, true))
- _chamber.OpenValve(ValveType.PROCESS, false);
- ControlFlag = false;
- }
- }
- else
- {
- if (firstflag && _chamber.IsFastPumpOpened)
- {
- _chamber.OpenValve(ValveType.FAST_PUMP, false);
- firstflag = false;
- }
- }
- }
-
-
- return true;
- }
- #region EndPoint
- public bool CheckEndPoint()
- {
- EPDDevice epd = DEVICE.GetDevice<EPDDevice>($"{Module}.EPD");
- if (epd == null)
- return false;
- return epd.IsEnd;
- }
- public void StartEndPoint(string config, int index)
- {
- EPDDevice epd = DEVICE.GetDevice<EPDDevice>($"{Module}.EPD");
- if (epd == null)
- return;
- epd.StepStart(config, index);
- }
- public void StopEndPoint()
- {
- EPDDevice epd = DEVICE.GetDevice<EPDDevice>($"{Module}.EPD");
- if (epd == null)
- return;
- epd.StepStop();
- }
- public void EndPointRecipeStop()
- {
- EPDDevice epd = DEVICE.GetDevice<EPDDevice>($"{Module}.EPD");
- if (epd == null)
- return;
- epd.RecipeStop();
- }
- public void EndPointRecipeStart(string recipeName)
- {
- EPDDevice epd = DEVICE.GetDevice<EPDDevice>($"{Module}.EPD");
- if (epd == null)
- return;
- epd.RecipeStart(recipeName);
- }
- #endregion
- #endregion
- }
- }
|