From 2fdb73e32e342837fe665159d54f2ec9bb0561a5 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Sat, 25 Dec 2021 08:59:59 +0100 Subject: [PATCH] do not ignore inbounds that respawned inside the freezed time --- aman/sys/RecedingHorizonControl.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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: