Browse Source

Enhance sequence aligner configurability

sangwq 1 year ago
parent
commit
f53fecc7bb
1 changed files with 40 additions and 13 deletions
  1. 40 13
      Venus/Venus_RT/Modules/SystemDispatcher.cs

+ 40 - 13
Venus/Venus_RT/Modules/SystemDispatcher.cs

@@ -87,7 +87,7 @@ namespace Venus_RT.Modules
 
         private DateTime _scheduledTime;
 
-        public WaferTask(ModuleName source, int srcSlot, ModuleName dest, int dstSlot, float temp, Guid waferID, string recipeName, string wtwClean, SequenceLLInOutPath inOutPath, int LLDelay)
+        public WaferTask(ModuleName source, int srcSlot, ModuleName dest, int dstSlot, float temp, Guid waferID, string recipeName, string wtwClean, SequenceLLInOutPath inOutPath, int LLDelay, bool needAlign)
         {
             sourceMod = currentMod = nextMod = routedMod = source;
             sourceSlot = currentSlot = nextSlot = routedSlot = srcSlot;
@@ -101,7 +101,7 @@ namespace Venus_RT.Modules
             wtwCleanRecipe = wtwClean;
             llInOutPath = inOutPath;
             llDelayTime = LLDelay;
-            IsAligned = false;
+            IsAligned = !needAlign;
 
             pressureStatus = RState.Init;
             temperatureStatus = RState.End;
@@ -1923,7 +1923,7 @@ namespace Venus_RT.Modules
 
                         if (wafer.ProcessJob.Sequence.PMs.Contains(pm) && wafer.NextSequenceStep == 0 && !_lstWaferTasks.Exists(task => task.sourceMod == (ModuleName)wafer.OriginStation && task.sourceSlot == wafer.OriginSlot))
                         {
-                            CreateWaferTasks(wafer, pm,  wafer.ProcessJob.Sequence.LLDelayTime);
+                            CreateWaferTasks(wafer, pm);
                             return;
                         }
                     }
@@ -1931,12 +1931,13 @@ namespace Venus_RT.Modules
             }
         }
 
-        private void CreateWaferTasks(WaferInfo wafer, ModuleName pm, int LLDeayTime)
+        private void CreateWaferTasks(WaferInfo wafer, ModuleName pm)
         {
             var recipeName = wafer.ProcessJob.Sequence.GetRecipe(pm);
             var recipeContent = RecipeFileManager.Instance.LoadRecipe(pm.ToString(), recipeName, false, RecipeType.Process.ToString());
             Recipe recipe = Recipe.Load(recipeContent);
             int temperature = 0;
+
             if(int.TryParse(recipe.Header.Temperature, out int temp))
             {
                 temperature = temp;
@@ -1951,7 +1952,8 @@ namespace Venus_RT.Modules
                                             recipeName,
                                             wafer.ProcessJob.Sequence.WTWCleanRecipe,
                                             wafer.ProcessJob.Sequence.LLInOutPath, 
-                                            LLDeayTime);
+                                            wafer.ProcessJob.Sequence.LLDelayTime,
+                                            IsSequenceNeedAlign(wafer.ProcessJob.Sequence));
 
             waferTask.OnWaferArrived += WaferArrived;
             waferTask.OnWaferLeaved += WaferLeaved;
@@ -1967,7 +1969,7 @@ namespace Venus_RT.Modules
             var readyInWafers = _lstWaferTasks.Where(wafer => ModuleHelper.IsLoadPort(wafer.currentMod) && IsCtrlJobExecuting(wafer.currentMod) && wafer.movingStatus == RState.Init && wafer.pressureStatus == RState.Init && CanWaferGotoLL(wafer, ll)).OrderBy(wafer => wafer.currentSlot).ToArray();
             var freeHands = GetEFEMFreeHand();
 
-            if ((atmWafers.Count >= 2 && atmWafers.Count(wafer => !wafer.IsAligned) == 0) || freeHands.Count == 0 || readyInWafers.Length == 0)
+            if ((atmWafers.Count >= 2 && !atmWafers.Exists(wafer => !wafer.IsAligned)) || freeHands.Count == 0 || readyInWafers.Length == 0)
                 return false;
 
             // force all wafer aligned
@@ -1977,15 +1979,23 @@ namespace Venus_RT.Modules
                 _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(notAlignedWafer.First().currentMod, notAlignedWafer.First().currentSlot, ModuleName.Aligner1, 0, (Hand)notAlignedWafer.First().currentSlot) });
             }
             // forward one wafer
-            else if ((readyInWafers.Length > 0) && (atmWafers.Count == 0 || (atmWafers.Count == 1 && _lstWaferTasks.Count(wafer => ModuleHelper.IsAligner(wafer.currentMod)) == 0 && emptySlots.Count >= 2)))
+            else if ((readyInWafers.Length > 0) && (atmWafers.Count == 0 || (atmWafers.Count == 1 && emptySlots.Count >= 2)))
             {
-                readyInWafers[0].RouteTo(ModuleName.Aligner1, 0);
+                if(readyInWafers[0].IsAligned)
+                {
+                    // pick from LP
+                    _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(readyInWafers[0].currentMod, readyInWafers[0].currentSlot, ModuleName.EfemRobot, (int)freeHands[0], freeHands[0]) });
+                }
+                else if(!_lstWaferTasks.Exists(wt => ModuleHelper.IsAligner(wt.currentMod)))
+                {
+                    readyInWafers[0].RouteTo(ModuleName.Aligner1, 0);
 
-                // pick from LP
-                _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(readyInWafers[0].currentMod, readyInWafers[0].currentSlot, ModuleName.EfemRobot, (int)freeHands[0], freeHands[0]) });
+                    // pick from LP
+                    _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(readyInWafers[0].currentMod, readyInWafers[0].currentSlot, ModuleName.EfemRobot, (int)freeHands[0], freeHands[0]) });
 
-                // place to aligner
-                _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(ModuleName.EfemRobot, (int)freeHands[0], ModuleName.Aligner1, 0, freeHands[0]) });
+                    // place to aligner
+                    _efemSchdActions.Enqueue(new List<MoveItem> { new MoveItem(ModuleName.EfemRobot, (int)freeHands[0], ModuleName.Aligner1, 0, freeHands[0]) });
+                }
             }
             // forward aligner wafer
             else if (atmWafers.Count == 1 && emptySlots.Count >= 2 && ModuleHelper.IsAligner(atmWafers.First().currentMod) && freeHands.Count > 1)
@@ -2262,7 +2272,9 @@ namespace Venus_RT.Modules
                         return;
                 }
 
-                if(atmWaferCount == 0 || (atmWaferCount == 1 && inLLWaferStatus.emptySlot.Count == 2 && _efemRobotSingleArmOption == 0 && (outLLWaferStatus.outSlot.Count < 2 || _dictModuleTask[outLL].TimeToReady > 20)))
+                // 有两片processed wafer 时且, 不需要align wafer 时, 不要预期
+                if((atmWaferCount == 0 && (outLLWaferStatus.outSlot.Count() < 2 || _lstWaferTasks.Exists(wt => ModuleHelper.IsLoadPort(wt.currentMod) && !wt.IsAligned))) || 
+                   (atmWaferCount == 1 && inLLWaferStatus.emptySlot.Count == 2 && _efemRobotSingleArmOption == 0 && (outLLWaferStatus.outSlot.Count < 2 || _dictModuleTask[outLL].TimeToReady > 20)))
                 {
                     if (ForwardATMWafers(inLL))
                         return;
@@ -4402,6 +4414,21 @@ namespace Venus_RT.Modules
             return true;
         }
 
+        private bool IsSequenceNeedAlign(SequenceInfo sequence)
+        {
+            // check wether need align
+            foreach (var step in sequence.Steps)
+            {
+                foreach(var mod in step.StepModules)
+                {
+                    if(ModuleHelper.IsAligner(mod))
+                        return true;
+                }
+            }
+
+            return false;
+        }
+
         #endregion
     }
 }