瀏覽代碼

do not ignore inbounds that respawned inside the freezed time

Sven Czarnian 3 年之前
父節點
當前提交
2fdb73e32e
共有 1 個文件被更改,包括 14 次插入4 次删除
  1. 14 4
      aman/sys/RecedingHorizonControl.py

+ 14 - 4
aman/sys/RecedingHorizonControl.py

@@ -175,13 +175,23 @@ class RecedingHorizonControl:
         return runwayInbounds, iafInbounds
 
     def optimizationRelevantInbounds(self):
-        # no new inbounds
-        if len(self.Windows) <= self.FreezedIndex + 1:
-            return None, None
-
         inbounds = []
         earliestArrivalTime = self.Windows[self.FreezedIndex + 1].StartTime
 
+        # check if we have a reconnect in the freezed blocks (VATSIM specific behavior)
+        for i in range(0, self.FreezedIndex + 1):
+            for inbound in self.Windows[i].Inbounds:
+                if False == inbound.HasValidSequence:
+                    inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
+                    inbounds.append(copy.deepcopy(inbound))
+
+        # no new inbounds
+        if len(self.Windows) <= self.FreezedIndex + 1:
+            if 0 == len(inbounds):
+                return None, None
+            else:
+                return inbounds, earliestArrivalTime
+
         # check the overlapping windows
         for i in range(self.FreezedIndex + 1, len(self.Windows)):
             for inbound in self.Windows[i].Inbounds: