use the optimization thresholds to calculate the TTG

This commit is contained in:
Sven Czarnian
2021-12-15 09:28:59 +01:00
parent 72959a8e26
commit 5242fe0d87
5 changed files with 21 additions and 14 deletions

View File

@@ -87,7 +87,7 @@ class Worker(Thread):
if 0 != report.distanceToIAF and '' != report.initialApproachFix: if 0 != report.distanceToIAF and '' != report.initialApproachFix:
inbound = Inbound(report, self.PerformanceData) inbound = Inbound(report, self.PerformanceData)
Node(inbound, inbound.ReportTime, self.WeatherModel, self.Configuration.GngData, self.SequencingConfiguration) Node(inbound, inbound.ReportTime, self.WeatherModel, self.Configuration, self.SequencingConfiguration)
if None != inbound.InitialArrivalTime: if None != inbound.InitialArrivalTime:
self.RecedingHorizonControl.updateReport(inbound) self.RecedingHorizonControl.updateReport(inbound)
else: else:
@@ -109,11 +109,10 @@ class Worker(Thread):
preceedingInbounds[runway.Runway.Name] = Node(inbound, None, None, None, None) preceedingInbounds[runway.Runway.Name] = Node(inbound, None, None, None, None)
# configure the ACO run # configure the ACO run
acoConfig = Configuration(constraints = self.SequencingConfiguration, nav = self.Configuration.GngData, acoConfig = Configuration(constraints = self.SequencingConfiguration, config = self.Configuration,
earliest = earliestArrivalTime, weather = self.WeatherModel, earliest = earliestArrivalTime, weather = self.WeatherModel,
preceeding = None if 0 == len(preceedingInbounds) else preceedingInbounds, preceeding = None if 0 == len(preceedingInbounds) else preceedingInbounds,
ants = 5 * len(relevantInbounds), generations = 5 * len(relevantInbounds), ants = 5 * len(relevantInbounds), generations = 5 * len(relevantInbounds))
maxDelayMay=self.Configuration.MaxDelayMay)
# perform the ACO run # perform the ACO run
aco = Colony(relevantInbounds, acoConfig) aco = Colony(relevantInbounds, acoConfig)

View File

@@ -48,7 +48,7 @@ class Colony:
# create the new planning instances # create the new planning instances
currentTime = dt.utcfromtimestamp(int(time.time())).replace(tzinfo = pytz.UTC) currentTime = dt.utcfromtimestamp(int(time.time())).replace(tzinfo = pytz.UTC)
for inbound in inbounds: for inbound in inbounds:
self.Nodes.append(Node(inbound, currentTime, self.Configuration.WeatherModel, self.Configuration.NavData, self.Configuration.RunwayConstraints)) self.Nodes.append(Node(inbound, currentTime, self.Configuration.WeatherModel, self.Configuration.AirportConfiguration, self.Configuration.RunwayConstraints))
rwyManager = RunwayManager(self.Configuration) rwyManager = RunwayManager(self.Configuration)
delay = Colony.calculateInitialCosts(rwyManager, self.Nodes, self.Configuration.EarliestArrivalTime) delay = Colony.calculateInitialCosts(rwyManager, self.Nodes, self.Configuration.EarliestArrivalTime)

View File

@@ -9,8 +9,7 @@ class Configuration:
self.PreceedingInbounds = kwargs.get('preceeding', None) self.PreceedingInbounds = kwargs.get('preceeding', None)
self.EarliestArrivalTime = kwargs.get('earliest', None) self.EarliestArrivalTime = kwargs.get('earliest', None)
self.WeatherModel = kwargs.get('weather', None) self.WeatherModel = kwargs.get('weather', None)
self.NavData = kwargs.get('nav', None) self.AirportConfiguration = kwargs.get('config', None)
self.MaxDelayMay = kwargs.get('maxDelayMay', timedelta(minutes=10))
# the ACO specific information # the ACO specific information
self.AntCount = kwargs.get('ants', 20) self.AntCount = kwargs.get('ants', 20)

View File

@@ -5,6 +5,7 @@ import sys
from datetime import datetime, timedelta from datetime import datetime, timedelta
from aman.config.Airport import Airport
from aman.config.AirportSequencing import AirportSequencing from aman.config.AirportSequencing import AirportSequencing
from aman.formats.SctEseFormat import SctEseFormat from aman.formats.SctEseFormat import SctEseFormat
from aman.sys.WeatherModel import WeatherModel from aman.sys.WeatherModel import WeatherModel
@@ -150,7 +151,7 @@ class Node:
return timedelta(seconds = flightTimeSeconds), trackmiles, arrivalRoute, timedelta(seconds = flightTimeOnStarSeconds) return timedelta(seconds = flightTimeSeconds), trackmiles, arrivalRoute, timedelta(seconds = flightTimeOnStarSeconds)
def __init__(self, inbound : Inbound, referenceTime : datetime, weatherModel : WeatherModel, def __init__(self, inbound : Inbound, referenceTime : datetime, weatherModel : WeatherModel,
navData : SctEseFormat, sequencingConfig : AirportSequencing): airportConfig : Airport, sequencingConfig : AirportSequencing):
self.PredictedDistanceToIAF = inbound.Report.distanceToIAF self.PredictedDistanceToIAF = inbound.Report.distanceToIAF
self.PredictedCoordinate = [ inbound.CurrentPosition.latitude, inbound.CurrentPosition.longitude ] self.PredictedCoordinate = [ inbound.CurrentPosition.latitude, inbound.CurrentPosition.longitude ]
self.PredictionTime = referenceTime self.PredictionTime = referenceTime
@@ -171,7 +172,7 @@ class Node:
prediction = tempWaypoint.project(course, distance) prediction = tempWaypoint.project(course, distance)
# calculate the bearing between the current position and the IAF # calculate the bearing between the current position and the IAF
star = Node.findArrivalRoute(inbound.Report.initialApproachFix, sequencingConfig.ActiveArrivalRunways[0].Runway, navData) star = Node.findArrivalRoute(inbound.Report.initialApproachFix, sequencingConfig.ActiveArrivalRunways[0].Runway, airportConfig.GngData)
# calculate the distance based on the flown distance and update the predicted distance # calculate the distance based on the flown distance and update the predicted distance
if None != star: if None != star:
@@ -187,7 +188,7 @@ class Node:
# 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:
star = Node.findArrivalRoute(self.Inbound.Report.initialApproachFix, identifier.Runway, navData) star = Node.findArrivalRoute(self.Inbound.Report.initialApproachFix, identifier.Runway, airportConfig.GngData)
if None != star: if None != star:
flightTime, trackmiles, arrivalRoute, flightTimeOnStar = self.arrivalEstimation(identifier.Runway, star, weatherModel) flightTime, trackmiles, arrivalRoute, flightTimeOnStar = self.arrivalEstimation(identifier.Runway, star, weatherModel)
@@ -203,8 +204,16 @@ class Node:
timeUntilIAF = timedelta(seconds = 0) timeUntilIAF = timedelta(seconds = 0)
# the best TTL is the longest path with the slowest speed # the best TTL is the longest path with the slowest speed
# TODO use configurations to define the maximum time gain ttgMax = 60
ttg = timedelta(seconds = timeUntilIAF.total_seconds() * 0.2) ttgRatio = 0.05
if star.Name in airportConfig.OptimizationParameters:
ttgMax = airportConfig.OptimizationParameters[star.Name][0]
ttgRatio = airportConfig.OptimizationParameters[star.Name][1]
ttg = timedelta(seconds = timeUntilIAF.total_seconds() * ttgRatio)
if (ttg.total_seconds() > ttgMax):
ttg = timedelta(seconds = ttgMax)
print(self.Inbound.Callsign + ': ' + str(ttg))
ttl = timedelta(seconds = decreasedSpeedFlighttime - flightTime.total_seconds()) ttl = timedelta(seconds = decreasedSpeedFlighttime - flightTime.total_seconds())
ita = self.Inbound.ReportTime + flightTime ita = self.Inbound.ReportTime + flightTime
earliest = ita - ttg earliest = ita - ttg

View File

@@ -106,12 +106,12 @@ class RunwayManager:
if RunwayAssignmentType.AircraftType in runway.MayAssignments: if RunwayAssignmentType.AircraftType in runway.MayAssignments:
if node.Inbound.Report.aircraft.type in runway.MayAssignments[RunwayAssignmentType.AircraftType]: if node.Inbound.Report.aircraft.type in runway.MayAssignments[RunwayAssignmentType.AircraftType]:
eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, useETA, earliestArrivalTime) eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, useETA, earliestArrivalTime)
if (eta - reference) <= self.Configuration.MaxDelayMay: if (eta - reference) <= self.Configuration.AirportConfiguration.MaxDelayMay:
mayRunways.append(runway) mayRunways.append(runway)
if RunwayAssignmentType.GateAssignment in runway.MayAssignments: if RunwayAssignmentType.GateAssignment in runway.MayAssignments:
if node.Inbound.Report.plannedGate in runway.MayAssignments[RunwayAssignmentType.GateAssignment]: if node.Inbound.Report.plannedGate in runway.MayAssignments[RunwayAssignmentType.GateAssignment]:
eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, useETA, earliestArrivalTime) eta, _ = self.calculateEarliestArrivalTime(runway.Runway.Name, node, useETA, earliestArrivalTime)
if (eta - reference) <= self.Configuration.MaxDelayMay: if (eta - reference) <= self.Configuration.AirportConfiguration.MaxDelayMay:
mayRunways.append(runway) mayRunways.append(runway)
runway = self.selectShallShouldMayArrivalRunway(node, shallRunways, useETA, earliestArrivalTime) runway = self.selectShallShouldMayArrivalRunway(node, shallRunways, useETA, earliestArrivalTime)