diff --git a/aman/sys/RecedingHorizonControl.py b/aman/sys/RecedingHorizonControl.py index b3a6ae3..f64d477 100644 --- a/aman/sys/RecedingHorizonControl.py +++ b/aman/sys/RecedingHorizonControl.py @@ -31,11 +31,11 @@ class RecedingHorizonControl: # find the correct window if window.StartTime <= referenceTime and window.EndTime > referenceTime: - if i > self.FreezedIndex: - self.AssignedWindow[inbound.Callsign] = [ i, 0 ] - if False == usePTA: - inbound.PlannedArrivalTime = inbound.EarliestArrivalTime - window.insert(inbound) + self.AssignedWindow[inbound.Callsign] = [ i, 0 ] + if False == usePTA: + inbound.PlannedArrivalTime = inbound.EarliestArrivalTime + inbound.FixedSequence = i < self.FreezedIndex + window.insert(inbound) inserted = True break @@ -56,7 +56,7 @@ class RecedingHorizonControl: window.insert(inbound) if False == usePTA: inbound.PlannedArrivalTime = max(window.StartTime, inbound.EarliestArrivalTime) - + inbound.FixedSequence = len(self.Windows) < self.FreezedIndex break lastWindowTime = self.Windows[-1].EndTime @@ -68,12 +68,11 @@ class RecedingHorizonControl: index = self.AssignedWindow[inbound.Callsign][0] self.AssignedWindow[inbound.Callsign][1] = 0 - # check if we assume the scheduling as fixed - if index < self.FreezedIndex: - return - plannedInbound = self.Windows[index].inbound(inbound.Callsign) plannedInbound.CurrentPosition = inbound.CurrentPosition + # ingore fixed updates + if True == plannedInbound.FixedSequence or index < self.FreezedIndex: + return plannedInbound.ArrivalCandidates = inbound.ArrivalCandidates plannedInbound.WTC = inbound.WTC @@ -100,6 +99,7 @@ class RecedingHorizonControl: self.AssignedWindow.pop(inbound.Callsign) self.insertInWindow(inbound, True) else: + inbound.FixedSequence = index < self.FreezedIndex self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime) def lastFixedInboundOnRunway(self, runway : str): @@ -165,6 +165,8 @@ class RecedingHorizonControl: if 0 != offsetCorrection: for callsign in self.AssignedWindow: self.AssignedWindow[callsign][0] -= offsetCorrection + if self.AssignedWindow[callsign][0] < self.FreezedIndex: + self.Windows[self.AssignedWindow[callsign][0]].inbound(callsign).FixedSequence = True # delete the non-updated aircrafts and increase the missed-counter for later runs callsigns = []