Browse Source

enhance the routing algorithm.

sangwq 1 year ago
parent
commit
4ca490bbbf
1 changed files with 28 additions and 14 deletions
  1. 28 14
      Venus/Venus_RT/Modules/AutoCycle.cs

+ 28 - 14
Venus/Venus_RT/Modules/AutoCycle.cs

@@ -733,7 +733,7 @@ namespace Venus_RT.Modules
             var validSlots = GetModuleValidSlots(inModule);
             foreach(var slot in _vacReadyOutSlots)
             {
-                if (slot.Key.Module == inModule && _vacModules[slot.Key.Module].MovingStatus == MovingStatus.Moving)
+                if (slot.Key.Module == inModule || _vacModules[slot.Key.Module].MovingStatus != MovingStatus.Idle)
                     continue;
 
                 if (IsLoadLockReservedByEFEM(slot.Key.Module))
@@ -817,18 +817,21 @@ namespace Venus_RT.Modules
                                         _movingItems.Add(new MoveItem(item.Key.Module, item.Key.Slot, destSlot_2.Module, destSlot_2.Slot, Hand.None));
                                         UpdateModuleMovingStatus(item.Key.Module);
                                         UpdateModuleMovingStatus(destSlot_2.Module);
+                                        break;
                                     }
                                 }
                             }
 
                             // check whether match swap pattern
+                            int inCount = 0;
                             var in_slots = SearchWaitInSlots(slot.Key.Module);
                             foreach(var in_slot in in_slots)
                             {
-                                if(_vacModules[in_slot.Module].MovingStatus == MovingStatus.Idle)
+                                if(_vacModules[in_slot.DestinationModule].MovingStatus == MovingStatus.Idle && inCount < 2)
                                 {
                                     _movingItems.Add(in_slot);
                                     UpdateItemMovingStatus(in_slot);
+                                    inCount++;
                                 }
                             }
 
@@ -844,20 +847,31 @@ namespace Venus_RT.Modules
                             UpdateModuleMovingStatus(destSlot.Module);
 
                             // check whether match swap pattern
+                            int swapCount = 0;
                             var in_slots = SearchWaitInSlots(slot.Key.Module);
-                            if(in_slots.Count >= 1)
+                            foreach(var swap_slot in in_slots)
                             {
-                                _movingItems.Add(in_slots.First());
-                                UpdateItemMovingStatus(in_slots.First());
+                                if(_vacModules[swap_slot.SourceModule].MovingStatus == MovingStatus.Idle && swapCount < 1)
+                                {
+                                    _movingItems.Add(swap_slot);
+                                    UpdateItemMovingStatus(swap_slot);
+                                    swapCount++;
+                                }
                             }
-                            else
+                            
+                            if(swapCount == 0)
                             {
                                 // check whether match double move pattern
+                                int inCount = 0;
                                 var same_dest = SearchWaitInSlots(destSlot.Module);
-                                if(same_dest.Count > 0 && _vacModules[same_dest[0].SourceModule].MovingStatus == MovingStatus.Idle)
+                                foreach(var in_slot in same_dest)
                                 {
-                                    _movingItems.Add(same_dest[0]);
-                                    UpdateItemMovingStatus(same_dest[0]);
+                                    if(_vacModules[in_slot.SourceModule].MovingStatus == MovingStatus.Idle && inCount < 1)
+                                    {
+                                        _movingItems.Add(in_slot);
+                                        UpdateItemMovingStatus(in_slot);
+                                        inCount++;
+                                    }
                                 }
                             }
 
@@ -993,17 +1007,17 @@ namespace Venus_RT.Modules
                 if (!scheduler.Value.IsAvailable)
                     continue;
 
-                if(ModuleHelper.IsLoadLock(scheduler.Key))
+                if(ModuleHelper.IsAligner(scheduler.Key))
                 {
-                    if (ProcessLLEFEMRobotTask(scheduler.Key))
+                    if (ProcessAlignerEFEMRobotTask(scheduler.Key))
                         return;
                 }
-                else if(ModuleHelper.IsAligner(scheduler.Key))
+                else if (ModuleHelper.IsLoadLock(scheduler.Key))
                 {
-                    if (ProcessAlignerEFEMRobotTask(scheduler.Key))
+                    if (ProcessLLEFEMRobotTask(scheduler.Key))
                         return;
                 }
-                else if(ModuleHelper.IsCooling(scheduler.Key))
+                else if (ModuleHelper.IsCooling(scheduler.Key))
                 {
                     if (ProcessCoolingEFEMRobotTask(scheduler.Key))
                         return;