|
@@ -20,37 +20,26 @@ class RunwayManager:
|
|
|
if not runway.Runway.Name in self.RunwayInbounds:
|
|
|
self.RunwayInbounds[runway.Runway.Name] = None
|
|
|
|
|
|
- def validateWtc(inbound : Inbound):
|
|
|
- wtc = inbound.Report.aircraft.wtc.upper()
|
|
|
- if 'L' == wtc or 'M' == wtc or 'H' == wtc or 'J' == wtc:
|
|
|
- return wtc
|
|
|
- else:
|
|
|
- return None
|
|
|
-
|
|
|
def calculateEarliestArrivalTime(self, runway : str, inbound : Inbound, useITA : bool, earliestArrivalTime : datetime):
|
|
|
- earliestArrivalTimes = []
|
|
|
+ constrainedETA = None
|
|
|
|
|
|
if None != self.RunwayInbounds[runway]:
|
|
|
# get the WTC based ETA
|
|
|
- wtcPre = RunwayManager.validateWtc(self.RunwayInbounds[runway])
|
|
|
- wtcThis = RunwayManager.validateWtc(inbound)
|
|
|
- if None == wtcPre or None == wtcThis:
|
|
|
- spacing = 3
|
|
|
+ if None == self.RunwayInbounds[runway].WTC or None == inbound.WTC:
|
|
|
+ spacingWTC = 3
|
|
|
else:
|
|
|
- spacing = self.Spacings[wtcPre][wtcThis]
|
|
|
- delay = timedelta(minutes = spacing / (inbound.PerformanceData.SpeedApproach / 60))
|
|
|
- earliestArrivalTimes.append(self.RunwayInbounds[runway].PlannedArrivalTime + delay)
|
|
|
+ spacingWTC = self.Spacings[self.RunwayInbounds[runway].WTC][inbound.WTC]
|
|
|
|
|
|
# get the runway time spacing
|
|
|
- spacing = self.Configuration.RunwayConstraints.findRunway(runway).Spacing
|
|
|
- delay = timedelta(minutes = spacing / (inbound.PerformanceData.SpeedApproach / 60))
|
|
|
- earliestArrivalTimes.append(self.RunwayInbounds[runway].PlannedArrivalTime + delay)
|
|
|
+ spacingRunway = self.Configuration.RunwayConstraints.findRunway(runway).Spacing
|
|
|
+ constrainedETA = self.RunwayInbounds[runway].PlannedArrivalTime + timedelta(minutes = max(spacingWTC, spacingRunway) / (inbound.PerformanceData.SpeedApproach / 60))
|
|
|
|
|
|
# calculate the arrival times for the dependent inbounds
|
|
|
for dependentRunway in self.Configuration.RunwayConstraints.findDependentRunways(runway):
|
|
|
if None != self.RunwayInbounds[dependentRunway.Runway.Name]:
|
|
|
- delay = timedelta(minutes = 3 / (inbound.PerformanceData.SpeedApproach / 60))
|
|
|
- earliestArrivalTimes.append(self.RunwayInbounds[dependentRunway.Runway.Name].PlannedArrivalTime + delay)
|
|
|
+ candidate = self.RunwayInbounds[dependentRunway.Runway.Name].PlannedArrivalTime + timedelta(minutes = 3 / (inbound.PerformanceData.SpeedApproach / 60))
|
|
|
+ if None == constrainedETA or candidate > constrainedETA:
|
|
|
+ constrainedETA = candidate
|
|
|
|
|
|
# get the arrival time on the runway of the inbound
|
|
|
if True == useITA:
|
|
@@ -58,19 +47,17 @@ class RunwayManager:
|
|
|
else:
|
|
|
arrivalTime = inbound.ArrivalCandidates[runway].InitialArrivalTime
|
|
|
|
|
|
- if 0 == len(earliestArrivalTimes):
|
|
|
- return arrivalTime, timedelta(seconds = 0)
|
|
|
+ if None == constrainedETA:
|
|
|
+ return max(arrivalTime, earliestArrivalTime), timedelta(seconds = 0)
|
|
|
else:
|
|
|
- eta = max(earliestArrivalTimes)
|
|
|
+ eta = max(constrainedETA, earliestArrivalTime)
|
|
|
if eta < arrivalTime:
|
|
|
return arrivalTime, arrivalTime - eta
|
|
|
else:
|
|
|
return eta, timedelta(seconds = 0)
|
|
|
|
|
|
def selectArrivalRunway(self, inbound : Inbound, useITA : bool, earliestArrivalTime : datetime):
|
|
|
- availableRunways = []
|
|
|
- for runway in self.Configuration.RunwayConstraints.ActiveArrivalRunways:
|
|
|
- availableRunways.append(runway)
|
|
|
+ availableRunways = self.Configuration.RunwayConstraints.ActiveArrivalRunways
|
|
|
|
|
|
#if 1 < len(availableRunways):
|
|
|
# TODO filter based on type
|