fix the issues with the time delta estimation
This commit is contained in:
@@ -21,7 +21,7 @@ class RecedingHorizonControl:
|
|||||||
|
|
||||||
def insertInWindow(self, inbound : Inbound, usePTA : bool):
|
def insertInWindow(self, inbound : Inbound, usePTA : bool):
|
||||||
if False == usePTA:
|
if False == usePTA:
|
||||||
referenceTime = inbound.InitialArrivalTime
|
referenceTime = inbound.EnrouteArrivalTime
|
||||||
else:
|
else:
|
||||||
referenceTime = inbound.PlannedArrivalTime
|
referenceTime = inbound.PlannedArrivalTime
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ class RecedingHorizonControl:
|
|||||||
self.AssignedWindow[inbound.Callsign] = [ i, 0 ]
|
self.AssignedWindow[inbound.Callsign] = [ i, 0 ]
|
||||||
inbound.FixedSequence = i < self.FreezedIndex
|
inbound.FixedSequence = i < self.FreezedIndex
|
||||||
if True == inbound.FixedSequence and None == inbound.PlannedArrivalTime:
|
if True == inbound.FixedSequence and None == inbound.PlannedArrivalTime:
|
||||||
inbound.PlannedArrivalTime = inbound.InitialArrivalTime
|
inbound.PlannedArrivalTime = inbound.EnrouteArrivalTime
|
||||||
window.insert(inbound)
|
window.insert(inbound)
|
||||||
inserted = True
|
inserted = True
|
||||||
break
|
break
|
||||||
@@ -56,11 +56,11 @@ class RecedingHorizonControl:
|
|||||||
self.AssignedWindow[inbound.Callsign] = [ len(self.Windows) - 1, 0 ]
|
self.AssignedWindow[inbound.Callsign] = [ len(self.Windows) - 1, 0 ]
|
||||||
inbound.FixedSequence = len(self.Windows) < self.FreezedIndex
|
inbound.FixedSequence = len(self.Windows) < self.FreezedIndex
|
||||||
if True == inbound.FixedSequence and None == inbound.PlannedArrivalTime:
|
if True == inbound.FixedSequence and None == inbound.PlannedArrivalTime:
|
||||||
inbound.PlannedArrivalTime = inbound.InitialArrivalTime
|
inbound.PlannedArrivalTime = inbound.EnrouteArrivalTime
|
||||||
break
|
break
|
||||||
lastWindowTime = self.Windows[-1].EndTime
|
lastWindowTime = self.Windows[-1].EndTime
|
||||||
|
|
||||||
window.Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.InitialArrivalTime)
|
window.Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
|
||||||
|
|
||||||
def updateReport(self, inbound : Inbound):
|
def updateReport(self, inbound : Inbound):
|
||||||
# check if we need to update
|
# check if we need to update
|
||||||
@@ -81,18 +81,18 @@ class RecedingHorizonControl:
|
|||||||
|
|
||||||
# check if we need to update the inbound
|
# check if we need to update the inbound
|
||||||
if None == plannedInbound.PlannedStar:
|
if None == plannedInbound.PlannedStar:
|
||||||
reference = inbound.InitialArrivalTime
|
reference = inbound.EnrouteArrivalTime
|
||||||
if plannedInbound.InitialArrivalTime > reference:
|
if plannedInbound.EnrouteArrivalTime > reference:
|
||||||
reference = plannedInbound.InitialArrivalTime
|
reference = plannedInbound.EnrouteArrivalTime
|
||||||
|
|
||||||
if reference < self.Windows[index].StartTime or reference >= self.Windows[index].EndTime:
|
if reference < self.Windows[index].StartTime or reference >= self.Windows[index].EndTime:
|
||||||
self.Windows[index].remove(inbound.Callsign)
|
self.Windows[index].remove(inbound.Callsign)
|
||||||
self.AssignedWindow.pop(inbound.Callsign)
|
self.AssignedWindow.pop(inbound.Callsign)
|
||||||
inbound.InitialArrivalTime = reference
|
inbound.EnrouteArrivalTime = reference
|
||||||
self.updateReport(inbound)
|
self.updateReport(inbound)
|
||||||
else:
|
else:
|
||||||
plannedInbound.InitialArrivalTime = reference
|
plannedInbound.EnrouteArrivalTime = reference
|
||||||
self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.InitialArrivalTime)
|
self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
|
||||||
else:
|
else:
|
||||||
self.insertInWindow(inbound, False)
|
self.insertInWindow(inbound, False)
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class RecedingHorizonControl:
|
|||||||
self.insertInWindow(inbound, True)
|
self.insertInWindow(inbound, True)
|
||||||
else:
|
else:
|
||||||
inbound.FixedSequence = index < self.FreezedIndex
|
inbound.FixedSequence = index < self.FreezedIndex
|
||||||
self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.InitialArrivalTime)
|
self.Windows[index].Inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
|
||||||
|
|
||||||
def lastFixedInboundOnRunway(self, runway : str):
|
def lastFixedInboundOnRunway(self, runway : str):
|
||||||
# no inbounds available
|
# no inbounds available
|
||||||
@@ -138,7 +138,7 @@ class RecedingHorizonControl:
|
|||||||
|
|
||||||
# check if we found relevant inbounds
|
# check if we found relevant inbounds
|
||||||
if 0 != len(inbounds):
|
if 0 != len(inbounds):
|
||||||
inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.InitialArrivalTime)
|
inbounds.sort(key = lambda x: x.PlannedArrivalTime if None != x.PlannedArrivalTime else x.EnrouteArrivalTime)
|
||||||
return inbounds, earliestArrivalTime
|
return inbounds, earliestArrivalTime
|
||||||
else:
|
else:
|
||||||
return None, None
|
return None, None
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class Worker(Thread):
|
|||||||
if '' != report.initialApproachFix:
|
if '' != report.initialApproachFix:
|
||||||
inbound = Inbound(report, self.PerformanceData)
|
inbound = Inbound(report, self.PerformanceData)
|
||||||
Node(inbound, inbound.ReportTime, self.WeatherModel, self.Configuration, self.SequencingConfiguration)
|
Node(inbound, inbound.ReportTime, self.WeatherModel, self.Configuration, self.SequencingConfiguration)
|
||||||
if None != inbound.InitialArrivalTime:
|
if None != inbound.EnrouteArrivalTime:
|
||||||
self.RecedingHorizonControl.updateReport(inbound)
|
self.RecedingHorizonControl.updateReport(inbound)
|
||||||
else:
|
else:
|
||||||
print('Unable to find all data of ' + report.aircraft.callsign)
|
print('Unable to find all data of ' + report.aircraft.callsign)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class Colony:
|
|||||||
self.Result.append(node)
|
self.Result.append(node)
|
||||||
Colony.associateInbound(rwyManager, node, self.Configuration.EarliestArrivalTime)
|
Colony.associateInbound(rwyManager, node, self.Configuration.EarliestArrivalTime)
|
||||||
|
|
||||||
reqTimeDelta = self.Result[-1].Inbound.InitialArrivalTime - self.Result[-1].Inbound.PlannedArrivalTime
|
reqTimeDelta = self.Result[-1].Inbound.EnrouteArrivalTime - self.Result[-1].Inbound.PlannedArrivalTime
|
||||||
self.Result[-1].Inbound.PlannedArrivalRoute[0].PTA = self.Result[-1].Inbound.PlannedArrivalRoute[0].ETA - reqTimeDelta
|
self.Result[-1].Inbound.PlannedArrivalRoute[0].PTA = self.Result[-1].Inbound.PlannedArrivalRoute[0].ETA - reqTimeDelta
|
||||||
for i in range(1, len(self.Result[-1].Inbound.PlannedArrivalRoute)):
|
for i in range(1, len(self.Result[-1].Inbound.PlannedArrivalRoute)):
|
||||||
prev = self.Result[-1].Inbound.PlannedArrivalRoute[i - 1]
|
prev = self.Result[-1].Inbound.PlannedArrivalRoute[i - 1]
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class Node:
|
|||||||
|
|
||||||
self.PredictedCoordinate = prediction
|
self.PredictedCoordinate = prediction
|
||||||
|
|
||||||
setInitialArrivalTime = None == self.Inbound.InitialArrivalTime
|
setEnrouteTime = None == self.Inbound.EnrouteArrivalTime
|
||||||
|
|
||||||
# calculate the timings for the different arrival runways
|
# calculate the timings for the different arrival runways
|
||||||
for identifier in sequencingConfig.ActiveArrivalRunways:
|
for identifier in sequencingConfig.ActiveArrivalRunways:
|
||||||
@@ -214,6 +214,5 @@ class Node:
|
|||||||
self.ArrivalCandidates[identifier.Runway.Name] = ArrivalData(star = star, ita = earliest, route = arrivalRoute,
|
self.ArrivalCandidates[identifier.Runway.Name] = ArrivalData(star = star, ita = earliest, route = arrivalRoute,
|
||||||
trackmiles = trackmiles)
|
trackmiles = trackmiles)
|
||||||
|
|
||||||
ita = self.ArrivalCandidates[identifier.Runway.Name].InitialArrivalTime
|
if True == setEnrouteTime and (None == self.Inbound.EnrouteArrivalTime or ita < self.Inbound.EnrouteArrivalTime):
|
||||||
if True == setInitialArrivalTime and (None == self.Inbound.InitialArrivalTime or ita < self.Inbound.InitialArrivalTime):
|
self.Inbound.EnrouteArrivalTime = ita
|
||||||
self.Inbound.InitialArrivalTime = ita
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Inbound:
|
|||||||
self.Callsign = report.aircraft.callsign
|
self.Callsign = report.aircraft.callsign
|
||||||
self.CurrentPosition = report.position
|
self.CurrentPosition = report.position
|
||||||
self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC)
|
self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC)
|
||||||
self.InitialArrivalTime = None
|
self.EnrouteArrivalTime = None
|
||||||
self.RequestedRunway = None
|
self.RequestedRunway = None
|
||||||
self.PlannedArrivalTime = None
|
self.PlannedArrivalTime = None
|
||||||
self.PlannedRunway = None
|
self.PlannedRunway = None
|
||||||
|
|||||||
Reference in New Issue
Block a user