fix parts in the runway manager

This commit is contained in:
Sven Czarnian
2021-11-10 22:44:55 +01:00
parent ccb3774872
commit dd9e725fc2

View File

@@ -20,7 +20,7 @@ class RunwayManager:
if not runway.Runway.Name in self.RunwayInbounds: if not runway.Runway.Name in self.RunwayInbounds:
self.RunwayInbounds[runway.Runway.Name] = None self.RunwayInbounds[runway.Runway.Name] = None
def calculateEarliestArrivalTime(self, runway : str, inbound : Inbound, useITA : bool, earliestArrivalTime : datetime): def calculateEarliestArrivalTime(self, runway : str, inbound : Inbound, useETA : bool, earliestArrivalTime : datetime):
constrainedETA = None constrainedETA = None
if None != self.RunwayInbounds[runway]: if None != self.RunwayInbounds[runway]:
@@ -37,12 +37,13 @@ class RunwayManager:
# calculate the arrival times for the dependent inbounds # calculate the arrival times for the dependent inbounds
for dependentRunway in self.Configuration.RunwayConstraints.findDependentRunways(runway): for dependentRunway in self.Configuration.RunwayConstraints.findDependentRunways(runway):
if None != self.RunwayInbounds[dependentRunway.Runway.Name]: if None != self.RunwayInbounds[dependentRunway.Runway.Name]:
# TODO staggered spacing variabel
candidate = self.RunwayInbounds[dependentRunway.Runway.Name].PlannedArrivalTime + timedelta(minutes = 3 / (inbound.PerformanceData.SpeedApproach / 60)) candidate = self.RunwayInbounds[dependentRunway.Runway.Name].PlannedArrivalTime + timedelta(minutes = 3 / (inbound.PerformanceData.SpeedApproach / 60))
if None == constrainedETA or candidate > constrainedETA: if None == constrainedETA or candidate > constrainedETA:
constrainedETA = candidate constrainedETA = candidate
# get the arrival time on the runway of the inbound # get the arrival time on the runway of the inbound
if True == useITA: if True == useETA:
arrivalTime = inbound.ArrivalCandidates[runway].EarliestArrivalTime arrivalTime = inbound.ArrivalCandidates[runway].EarliestArrivalTime
else: else:
arrivalTime = inbound.ArrivalCandidates[runway].InitialArrivalTime arrivalTime = inbound.ArrivalCandidates[runway].InitialArrivalTime
@@ -56,7 +57,7 @@ class RunwayManager:
else: else:
return eta, timedelta(seconds = 0) return eta, timedelta(seconds = 0)
def selectArrivalRunway(self, inbound : Inbound, useITA : bool, earliestArrivalTime : datetime): def selectArrivalRunway(self, inbound : Inbound, useETA : bool, earliestArrivalTime : datetime):
availableRunways = self.Configuration.RunwayConstraints.ActiveArrivalRunways availableRunways = self.Configuration.RunwayConstraints.ActiveArrivalRunways
#if 1 < len(availableRunways): #if 1 < len(availableRunways):
@@ -67,7 +68,7 @@ class RunwayManager:
# fallback to check if we have available runways # fallback to check if we have available runways
if 0 == len(availableRunways): if 0 == len(availableRunways):
runway = self.Configuration.RunwayConstraints.ActiveArrivalRunways[0] runway = self.Configuration.RunwayConstraints.ActiveArrivalRunways[0]
return runway, self.calculateEarliestArrivalTime(runway.Runway.Name, inbound, useITA, earliestArrivalTime) return runway, self.calculateEarliestArrivalTime(runway.Runway.Name, inbound, useETA, earliestArrivalTime)
# start with the beginning # start with the beginning
selectedRunway = None selectedRunway = None
@@ -76,7 +77,7 @@ class RunwayManager:
# get the runway with the earliest ETA # get the runway with the earliest ETA
for runway in availableRunways: for runway in availableRunways:
candidate, delta = self.calculateEarliestArrivalTime(runway.Runway.Name, inbound, useITA, earliestArrivalTime) candidate, delta = self.calculateEarliestArrivalTime(runway.Runway.Name, inbound, useETA, earliestArrivalTime)
if None == eta or eta > candidate: if None == eta or eta > candidate:
selectedRunway = runway.Runway selectedRunway = runway.Runway
lostTime = delta lostTime = delta