diff --git a/aman/sys/RecedingHorizonControl.py b/aman/sys/RecedingHorizonControl.py index 9e97dc5..ecc50cb 100644 --- a/aman/sys/RecedingHorizonControl.py +++ b/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: