Bläddra i källkod

Enhance routing algorithm.

sangwq 9 månader sedan
förälder
incheckning
5687e44ebc

+ 1 - 1
Venus/Framework/Common/Fsm/Entity.cs

@@ -169,7 +169,7 @@ namespace Aitex.Core.RT.Fsm
                         return 0;
                 }
                     
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }
 

+ 1 - 38
Venus/Venus_RT/Modules/EFEM/EfemSwapRoutine.cs

@@ -247,44 +247,7 @@ namespace Venus_RT.Modules.EFEM
         }
         private bool NotifyLLDone()
         {
-            var waferStatus = _llModule.GetWaferProcessStatus();
-
-            bool bAutoPump = false;
-            if (_bAutoMode)
-            {
-                if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLA) ||
-                     (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLB)) &&
-                      waferStatus.unprocessed >= _autoPumpOptInWafer)
-                {
-                    bAutoPump = true;
-                }
-                else if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLB) ||
-                          (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLA)) &&
-                           waferStatus.processed <= _autoPumpOptOutWafer)
-                {
-                    bAutoPump = true;
-                }
-                else if (_sequencePattern == SequenceLLInOutPath.DInDOut &&
-                    waferStatus.processed <= _autoPumpOptOutWafer &&
-                    waferStatus.unprocessed >= _autoPumpOptInWafer)
-                {
-                    bAutoPump = true;
-                }
-            }
-
-            LOG.Write(eEvent.EV_EFEM_ROBOT, Module, $"NotifyLLDone() => {_targetModule}, Sequence Pattern{_sequencePattern}, unprocessed wafer:{waferStatus.unprocessed}, processed wafer: {waferStatus.processed},bAutoPump  = {bAutoPump}, Config Option:{_autoPumpOptInWafer},{_autoPumpOptOutWafer}");
-
-
-            if (bAutoPump)
-            {
-                _llModule.PostMsg(LLEntity.MSG.AutoPump);
-
-            }
-            else
-            {
-                _llModule.PostMsg(LLEntity.MSG.EFEM_Exchange_Ready);
-            }
-
+            _llModule.PostMsg(LLEntity.MSG.EFEM_Exchange_Ready);
             return true;
         }
 

+ 27 - 15
Venus/Venus_RT/Modules/LLs/LLEntity.cs

@@ -121,7 +121,7 @@ namespace Venus_RT.Modules
 
                 }
 
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }
 
@@ -234,6 +234,10 @@ namespace Venus_RT.Modules
             Transition(STATE.Venting,           FSM_MSG.TIMER,          FnVentTimeout,          STATE.Idle);
             Transition(STATE.Venting,           MSG.Abort,              FnAbortVent,            STATE.Idle);
 
+            Transition(STATE.Idle,              MSG.AutoCooling,        FnStartCooling,         STATE.Cooling);
+            Transition(STATE.Cooling,           FSM_MSG.TIMER,          FnCoolingTimeout,       STATE.Idle);
+            Transition(STATE.Cooling,           MSG.Abort,              FnAbortCooling,         STATE.Idle);
+
             //Pump sequence
             Transition(STATE.Idle,              MSG.Pump,               FnStartPump,            STATE.Pumping);
             Transition(STATE.Pumping,           FSM_MSG.TIMER,          FnPumpTimeout,          STATE.Idle);
@@ -269,15 +273,7 @@ namespace Venus_RT.Modules
             Transition(STATE.Ready_For_EFEM,    MSG.Prepare_EFEM,       null,                   STATE.Ready_For_EFEM);
             Transition(STATE.Ready_For_EFEM,    MSG.Abort,              null,                   STATE.Idle);
             Transition(STATE.Ready_For_EFEM,    MSG.AutoPump,           FnTryAutoPump,          STATE.Pumping);
-            //Transition(STATE.Ready_For_EFEM,    MSG.Transfer_EFEM_SlotInfo, FnEFEMExchange,     STATE.Ready_For_EFEM);
-
-            //Cooling
-            //AnyStateTransition(FSM_MSG.TIMER,   LLCoolingTimer_Elapsed, FSM_STATE.SAME);
 
-            Transition(STATE.Venting,                MSG.AutoCooling, FnStartCooling, STATE.Cooling);
-            
-            //Transition(STATE.Ready_For_EFEM,         MSG.AutoCooling, FnStartCooling, STATE.Ready_For_EFEM);
-            Transition(STATE.Cooling,                FSM_MSG.TIMER,   FnCoolingTimeout, STATE.Idle);
             Running = true;
         }
 
@@ -288,7 +284,8 @@ namespace Venus_RT.Modules
                 case "Home":
                 case "Vent":
                 case "Pump":
-                    if(Enum.TryParse(function, out MSG message))
+                case "AutoCooling":
+                    if (Enum.TryParse(function, out MSG message))
                     {
                         if (CheckToPostMessage((int)message))
                             return (int)message;
@@ -451,7 +448,7 @@ namespace Venus_RT.Modules
 
         private bool FnStartVent(object[] param)
         {
-            return _ventingRoutine.Start() == RState.Running;
+            return _ventingRoutine.Start(false) == RState.Running;
         }
 
         private  bool FnTryAutoVent(object[] param)
@@ -463,7 +460,7 @@ namespace Venus_RT.Modules
             }
             _coolingMFCFlow = SC.GetValue<double>($"{Module.ToString()}.Cooling.MFCFlow");
             _coolingTime = SC.GetValue<int>($"{Module.ToString()}.Cooling.CoolingTime");
-            return _ventingRoutine.Start() == RState.Running;
+            return _ventingRoutine.Start(false) == RState.Running;
         }
 
         private bool FnVentTimeout(object[] param)
@@ -625,7 +622,7 @@ namespace Venus_RT.Modules
             if (RouteManager.IsATMMode)
                 return true;
 
-            return _ventingRoutine.Start() == RState.Running;
+            return _ventingRoutine.Start(false) == RState.Running;
         }
 
         private bool FnPrepareEFEMTimeout(object[] param)
@@ -724,19 +721,34 @@ namespace Venus_RT.Modules
 
         private bool FnStartCooling(object[] param)
         {
-           return _coolingRoutine.Start() == RState.Running;         
+            _coolingStopWatch.Restart();
+            _coolingTime = SC.GetValue<int>($"{Module}.Cooling.CoolingTime") * 1000;
+            return _ventingRoutine.Start(true) == RState.Running;         
         }
        
         private bool FnCoolingTimeout(object[] param)
         {          
-            RState ret = _coolingRoutine.Monitor();
+            RState ret = _ventingRoutine.Monitor();
             if (ret == RState.Failed || ret == RState.Timeout)
             {
                 PostMsg(MSG.Error);
                 return false;
             }
+
+            if(_coolingStopWatch.ElapsedMilliseconds > _coolingTime)
+            {
+                _ventingRoutine.Abort();
+                return true;
+            }
+
             return ret == RState.End;
         }
+
+        private bool FnAbortCooling(object[] param)
+        {
+            _ventingRoutine.Abort();
+            return true;
+        }
         private bool FnTMExchange(object[] param)
         {
             var needcooling = (bool)param[0];

+ 1 - 1
Venus/Venus_RT/Modules/PMs/PMEntity.cs

@@ -224,7 +224,7 @@ namespace Venus_RT.Modules.PMs
 
                 }
 
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }
 

+ 2 - 52
Venus/Venus_RT/Modules/Schedulers/SchedulerLoadLock.cs

@@ -52,15 +52,6 @@ namespace Venus_RT.Modules.Schedulers
         }
 
         private LLEntity _entity = null;
-
-        enum CoolingState
-        {
-            Init,
-            Start,
-            Cooling,
-            End,
-        }
-        private CoolingState _coolingState =  CoolingState.End;
         public SchedulerLoadLock(ModuleName module) : base(module.ToString())
         {
             _entity = Singleton<RouteManager>.Instance.GetLL(module);
@@ -68,45 +59,11 @@ namespace Venus_RT.Modules.Schedulers
 
         private bool CheckTaskDone()
         {
-            if (Singleton<RouteManager>.Instance.IsAutoMode)
-            {
-                if(IsOnline && IsInclude)
-                {
-                    if (IsIdle)
-                    {
-                        switch(_coolingState)
-                        {
-                            case CoolingState.Init:
-                                {
-                                    if(_entity.Invoke(LLEntity.MSG.AutoCooling.ToString()) == (int)LLEntity.MSG.AutoCooling)
-                                    {
-                                        _coolingState =  CoolingState.Start;
-                                    }
-                                }
-                                break;
-                            case CoolingState.Cooling:
-                                _coolingState = CoolingState.End;
-                                break;
-                        }
-                    }
-                    else
-                    {
-                        switch(_coolingState)
-                        {
-                            case CoolingState.Start:
-                                _coolingState = CoolingState.Cooling;
-                                break; ;
-                        }
-                    }
-                }
-            }
-
             return true;
         }
 
         public override void ResetTask()
         {
-            _coolingState = CoolingState.End;
             base.ResetTask();
         }
 
@@ -122,19 +79,12 @@ namespace Venus_RT.Modules.Schedulers
 
         public bool PrePump()
         {
-            _coolingState = CoolingState.End;
             return _entity.Invoke(LLEntity.MSG.Pump.ToString()) == (int)LLEntity.MSG.Pump;
         }
 
-        public bool SubscribeCoolingTask()
+        public bool Cooling()
         {
-            if (!IsAtm)
-            {
-                if (_coolingState == CoolingState.End)
-                    _coolingState = CoolingState.Init;
-            }
-
-            return true;
+            return _entity.Invoke(LLEntity.MSG.AutoCooling.ToString()) == (int)LLEntity.MSG.AutoCooling;
         }
     }
 }

+ 69 - 25
Venus/Venus_RT/Modules/SystemDispatcher.cs

@@ -214,6 +214,10 @@ namespace Venus_RT.Modules
         StartVent,
         Venting,
         AtmReady,
+        WaitCooling,
+        StartCooling,
+        Cooling,
+        CoolingDone,
 
         // Unknown
         Unknown,
@@ -271,7 +275,7 @@ namespace Venus_RT.Modules
                 if(Scheduler.IsAvailable)
                     return 0;
 
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }
 
@@ -341,7 +345,7 @@ namespace Venus_RT.Modules
                         break;
                 }
 
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }
 
@@ -743,10 +747,13 @@ namespace Venus_RT.Modules
 
         public bool PreVent()
         {
-            if (Scheduler.IsAvailable && Scheduler.IsVac)
+            if (Scheduler.IsAvailable && !Scheduler.IsAtm)
             {
-                Status = ModuleStatus.StartVent;
-                return (Scheduler as SchedulerLoadLock).PreVent();
+                if ((Scheduler as SchedulerLoadLock).PreVent())
+                {
+                    Status = ModuleStatus.StartVent;
+                    return true;
+                }
             }
 
             return false;
@@ -754,30 +761,64 @@ namespace Venus_RT.Modules
 
         public bool PrePump()
         {
-            if (Scheduler.IsAvailable && Scheduler.IsAtm)
+            if (Scheduler.IsAvailable && !Scheduler.IsVac)
             {
-                Status = ModuleStatus.StartPump;
-                return (Scheduler as SchedulerLoadLock).PrePump();
+                if ((Scheduler as SchedulerLoadLock).PrePump())
+                {
+                    Status = ModuleStatus.StartPump;
+                    return true;
+                }
             }
 
             return false;
         }
 
-        public override RState Run()
+        public bool Cooling()
         {
-            if (Scheduler.IsIdle)
+            if (Scheduler.IsAvailable && !Scheduler.IsAtm)
             {
-                if (Scheduler.IsAvailable && Scheduler.IsVac)
+                if((Scheduler as SchedulerLoadLock).Cooling())
                 {
-                    Status = ModuleStatus.VacReady;
-                }
-                else if (Scheduler.IsAvailable && Scheduler.IsAtm)
-                {
-                    Status = ModuleStatus.AtmReady;
+                    Status = ModuleStatus.StartCooling;
+                    return true;
                 }
-                else
+            }
+
+            return false;
+        }
+
+        public override RState Run()
+        {
+            if (Scheduler.IsIdle)
+            {
+                if (Scheduler.IsAvailable)
                 {
-                    Status = ModuleStatus.Idle;
+                    switch(Status)
+                    {
+                        case ModuleStatus.Pumping:
+                            if(Scheduler.IsVac)
+                            {
+                                Status = ModuleStatus.VacReady;
+                            }
+                            break;
+                        case ModuleStatus.Venting:
+                            if(Scheduler.IsAtm)
+                            {
+                                Status = ModuleStatus.AtmReady;
+                            }
+                            break;
+                        case ModuleStatus.Cooling:
+                            if(Scheduler.IsAtm)
+                            {
+                                Status = ModuleStatus.CoolingDone;
+                            }
+                            break;
+                        default:
+                            {
+                                Status = Scheduler.IsAtm ? ModuleStatus.AtmReady : Scheduler.IsVac ? ModuleStatus.VacReady : Status;
+                            }
+                            break;
+                    }
                 }
             }
             else
@@ -790,6 +831,9 @@ namespace Venus_RT.Modules
                     case ModuleStatus.StartVent:
                         Status = ModuleStatus.Venting;
                         break;
+                    case ModuleStatus.StartCooling:
+                        Status = ModuleStatus.Cooling;
+                        break;
                 }
             }
                 
@@ -2869,7 +2913,7 @@ namespace Venus_RT.Modules
                 }
             }
 
-            return int.MaxValue;
+            return int.MaxValue / 2;
         }
 
         List<Hand> GetTMValidFreeHands(List<WaferTask> robotWafers, List<MoveItem> swapActions)
@@ -4209,22 +4253,22 @@ namespace Venus_RT.Modules
                 }
             }
 
-            foreach(var ventLL in schdVentingLLs)
+            foreach (var ventLL in schdVentingLLs)
             {
                 if (_dictModuleTask[ventLL].Scheduler.IsAvailable && !_dictModuleTask[ventLL].Scheduler.IsAtm)
-                    (_dictModuleTask[ventLL].Scheduler as SchedulerLoadLock).PreVent();
+                    (_dictModuleTask[ventLL] as LoadlockTask).PreVent();
             }
 
-            foreach(var pumpLL in schdPumpingLLs)
+            foreach (var pumpLL in schdPumpingLLs)
             {
                 if (_dictModuleTask[pumpLL].Scheduler.IsAvailable && !_dictModuleTask[pumpLL].Scheduler.IsVac && !schdVentingLLs.Contains(pumpLL))
-                    (_dictModuleTask[pumpLL].Scheduler as SchedulerLoadLock).PrePump();
+                    (_dictModuleTask[pumpLL] as LoadlockTask).PrePump();
             }
 
-            foreach(var coolLL in schdCoolingLLs)
+            foreach (var coolLL in schdCoolingLLs)
             {
                 if (_dictModuleTask[coolLL].Scheduler.IsOnline && !_dictModuleTask[coolLL].Scheduler.IsAtm)
-                    (_dictModuleTask[coolLL].Scheduler as SchedulerLoadLock).SubscribeCoolingTask();
+                    (_dictModuleTask[coolLL] as LoadlockTask).Cooling();
             }
         }
 

+ 0 - 25
Venus/Venus_RT/Modules/TM/MFPickRoutine.cs

@@ -305,31 +305,6 @@ namespace Venus_RT.Modules.TM
 
         private bool NotifyLLDone()
         {
-            bool bAutoVent = false;
-            var waferStatus = _llModule.GetWaferProcessStatus();
-            if (_bAutoMode)
-            {
-                if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLA) ||
-                     (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLB)) &&
-                      waferStatus.unprocessed <= _autoVentOptInWafer)
-                {
-                    bAutoVent = true;
-                }
-                else if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLB) ||
-                          (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLA)) &&
-                           waferStatus.processed >= _autoVentOptOutWafer)
-                {
-                    bAutoVent = true;
-                }
-                else if (_sequencePattern == SequenceLLInOutPath.DInDOut &&
-                    waferStatus.processed >= _autoVentOptOutWafer &&
-                    waferStatus.unprocessed <= _autoVentOptInWafer)
-                {
-                    bAutoVent = true;
-                }
-            }
-
-            LOG.Write(eEvent.INFO_TM, Module, $"NotifyLLDone() => {_targetModule}, Sequence Pattern{_sequencePattern}, unprocessed wafer:{waferStatus.unprocessed}, processed wafer: {waferStatus.processed},bAutoVent  = {bAutoVent}, Config Option:{_autoVentOptInWafer},{_autoVentOptOutWafer}");
             _llModule.PostMsg(LLEntity.MSG.TM_Exchange_Ready, false);
             return true;
         }

+ 1 - 26
Venus/Venus_RT/Modules/TM/MFPlaceRoutine.cs

@@ -297,32 +297,7 @@ namespace Venus_RT.Modules.TM
 
         private bool NotifyLLDone()
         {
-            bool bAutoVent = false;
-            var waferStatus = _llModule.GetWaferProcessStatus();
-            if (_bAutoMode)
-            {
-                if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLA) ||
-                     (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLB)) &&
-                      waferStatus.unprocessed <= _autoVentOptInWafer)
-                {
-                    bAutoVent = true;
-                }
-                else if (((_sequencePattern == SequenceLLInOutPath.AInBOut && _targetModule == ModuleName.LLB) ||
-                          (_sequencePattern == SequenceLLInOutPath.BInAOut && _targetModule == ModuleName.LLA)) &&
-                           waferStatus.processed >= _autoVentOptOutWafer)
-                {
-                    bAutoVent = true;
-                }
-                else if (_sequencePattern == SequenceLLInOutPath.DInDOut &&
-                    waferStatus.processed >= _autoVentOptOutWafer &&
-                    waferStatus.unprocessed <= _autoVentOptInWafer)
-                {
-                    bAutoVent = true;
-                }
-            }
-
-            LOG.Write(eEvent.INFO_TM, Module, $"NotifyLLDone() => {_targetModule}, Sequence Pattern{_sequencePattern}, unprocessed wafer:{waferStatus.unprocessed}, processed wafer: {waferStatus.processed},bAutoVent  = {bAutoVent}, Config Option:{_autoVentOptInWafer},{_autoVentOptOutWafer}");
-            _llModule.PostMsg(LLEntity.MSG.TM_Exchange_Ready, true);
+            _llModule.PostMsg(LLEntity.MSG.TM_Exchange_Ready, false);
             return true;
         }
 

+ 64 - 11
Venus/Venus_RT/Modules/TM/MFVentRoutine.cs

@@ -10,12 +10,16 @@ namespace Venus_RT.Modules.TM
     {
         private enum VentStep
         {
-            kVenting,
-            kOpenSoftVent,
-            KSwitchFastVent,
-            kCloseVentValves,
-            KDelay,
-            kCloseExhaustValve,
+            Venting,
+            OpenSoftVent,
+            SwitchFastVent,
+            CloseVentValves,
+            Delay,
+            CloseExhaustValve,
+            PrepareCooling,
+            StartCooling,
+            Cooling,
+            End,
 
         }
 
@@ -23,6 +27,8 @@ namespace Venus_RT.Modules.TM
         private int _SoftVentEndPressure;
         private readonly JetTM _JetTM;
         private int _ventTimeDelay = 1;
+        private bool _needCooling = false;
+        private double _coolingMFCFlow = 0;
         public MFVentRoutine(JetTM jetTM, ModuleName mod) : base(mod)
         {
             _JetTM = jetTM;
@@ -31,6 +37,12 @@ namespace Venus_RT.Modules.TM
 
         public RState Start(params object[] objs)
         {
+            if(objs.Length > 0)
+            {
+                _needCooling = (bool)objs[0];
+                _coolingMFCFlow = SC.GetValue<double>($"{Module}.Cooling.MFCFlow");
+            }
+
             _JetTM.TurnSoftPumpValve(Module, false);
             _JetTM.TurnFastPumpValve(Module, false);
             _JetTM.TurnPurgeValve(Module, false);
@@ -52,11 +64,13 @@ namespace Venus_RT.Modules.TM
 
         public RState Monitor()
         {
-            Runner.Run(VentStep.kOpenSoftVent,       OpenSoftVentValve,   IsSoftVentEnd)
-                  .Run(VentStep.KSwitchFastVent,     SwitchFastVentValve, IsPressureReady, _ventingTimeout)
-                  .Delay(VentStep.KDelay,            _ventTimeDelay)
-                  .Run(VentStep.kCloseVentValves,    CloseVentValve,              _delay_1s)
-                  .End(VentStep.kCloseExhaustValve,  CloseExhaustValve);
+            Runner.Run(VentStep.OpenSoftVent,       OpenSoftVentValve,      IsSoftVentEnd)
+                  .Run(VentStep.SwitchFastVent,     SwitchFastVentValve,    IsPressureReady,    _ventingTimeout)
+                  .Delay(VentStep.Delay,            _ventTimeDelay)
+                  .Run(VentStep.CloseVentValves,    CloseVentValve,         _delay_1s)
+                  .RunIf(VentStep.PrepareCooling,   _needCooling,           StopVent)
+                  .RunIf(VentStep.StartCooling,     _needCooling,           StartCooling,       3600000)
+                  .End(VentStep.CloseExhaustValve,  CloseExhaustValve);
 
             return Runner.Status;
         }
@@ -125,6 +139,31 @@ namespace Venus_RT.Modules.TM
             return true;
         }
 
+        private bool StopVent()
+        {
+            _JetTM.TurnVentValve(Module, false);
+            _JetTM.TurnExhaustValve(Module, false);
+
+            return true;
+        }
+
+        private bool StartCooling()
+        {
+            _JetTM.TurnPurgeValve(Module, true);
+            _JetTM.TurnExhaustValve(Module, true);
+
+            if (Module == ModuleName.LLA)
+            {
+                _JetTM.SetLLAFlow(_coolingMFCFlow);
+            }
+            else if (Module == ModuleName.LLB)
+            {
+                _JetTM.SetLLBFlow(_coolingMFCFlow);
+            }
+
+            return true;
+        }
+
         private bool IsPressureReady()
         {
             return _JetTM.IsModuleATM(Module);
@@ -133,6 +172,20 @@ namespace Venus_RT.Modules.TM
         public void Abort()
         {
             CloseVentValve();
+
+            if (_needCooling)
+            {
+                if (Module == ModuleName.LLA)
+                {
+                    _JetTM.SetLLAFlow(0);
+                }
+                else if (Module == ModuleName.LLB)
+                {
+                    _JetTM.SetLLBFlow(0);
+                }
+                _JetTM.TurnPurgeValve(Module, false);
+                _JetTM.TurnExhaustValve(Module, false);
+            }
         }
     }
 }

+ 1 - 1
Venus/Venus_RT/Modules/TM/TMEntity.cs

@@ -409,7 +409,7 @@ namespace Venus_RT.Modules
 
         private bool FnStartVent(object[] param)
         {
-            return _ventingRoutine.Start() == RState.Running;
+            return _ventingRoutine.Start(false) == RState.Running;
         }
 
         private bool FnVentTimeout(object[] param)

+ 1 - 1
Venus/Venus_RT/Modules/VenusDispatcher.cs

@@ -62,7 +62,7 @@ namespace Venus_RT.Modules
                         }
                 }
 
-                return int.MaxValue;
+                return int.MaxValue / 2;
             }
         }