use the optimization thresholds to calculate the TTG
This commit is contained in:
		| @@ -48,7 +48,7 @@ class Colony: | ||||
|         # create the new planning instances | ||||
|         currentTime = dt.utcfromtimestamp(int(time.time())).replace(tzinfo = pytz.UTC) | ||||
|         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) | ||||
|         delay = Colony.calculateInitialCosts(rwyManager, self.Nodes, self.Configuration.EarliestArrivalTime) | ||||
|   | ||||
| @@ -9,8 +9,7 @@ class Configuration: | ||||
|         self.PreceedingInbounds = kwargs.get('preceeding', None) | ||||
|         self.EarliestArrivalTime = kwargs.get('earliest', None) | ||||
|         self.WeatherModel = kwargs.get('weather', None) | ||||
|         self.NavData = kwargs.get('nav', None) | ||||
|         self.MaxDelayMay = kwargs.get('maxDelayMay', timedelta(minutes=10)) | ||||
|         self.AirportConfiguration = kwargs.get('config', None) | ||||
|  | ||||
|         # the ACO specific information | ||||
|         self.AntCount = kwargs.get('ants', 20) | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import sys | ||||
|  | ||||
| from datetime import datetime, timedelta | ||||
|  | ||||
| from aman.config.Airport import Airport | ||||
| from aman.config.AirportSequencing import AirportSequencing | ||||
| from aman.formats.SctEseFormat import SctEseFormat | ||||
| from aman.sys.WeatherModel import WeatherModel | ||||
| @@ -150,7 +151,7 @@ class Node: | ||||
|         return timedelta(seconds = flightTimeSeconds), trackmiles, arrivalRoute, timedelta(seconds = flightTimeOnStarSeconds) | ||||
|  | ||||
|     def __init__(self, inbound : Inbound, referenceTime : datetime, weatherModel : WeatherModel, | ||||
|                  navData : SctEseFormat, sequencingConfig : AirportSequencing): | ||||
|                  airportConfig : Airport, sequencingConfig : AirportSequencing): | ||||
|         self.PredictedDistanceToIAF = inbound.Report.distanceToIAF | ||||
|         self.PredictedCoordinate = [ inbound.CurrentPosition.latitude, inbound.CurrentPosition.longitude ] | ||||
|         self.PredictionTime = referenceTime | ||||
| @@ -171,7 +172,7 @@ class Node: | ||||
|             prediction = tempWaypoint.project(course, distance) | ||||
|  | ||||
|             # 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 | ||||
|             if None != star: | ||||
| @@ -187,7 +188,7 @@ class Node: | ||||
|  | ||||
|         # calculate the timings for the different arrival runways | ||||
|         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: | ||||
|                 flightTime, trackmiles, arrivalRoute, flightTimeOnStar = self.arrivalEstimation(identifier.Runway, star, weatherModel) | ||||
| @@ -203,8 +204,16 @@ class Node: | ||||
|                     timeUntilIAF = timedelta(seconds = 0) | ||||
|  | ||||
|                 # the best TTL is the longest path with the slowest speed | ||||
|                 # TODO use configurations to define the maximum time gain | ||||
|                 ttg = timedelta(seconds = timeUntilIAF.total_seconds() * 0.2) | ||||
|                 ttgMax = 60 | ||||
|                 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()) | ||||
|                 ita = self.Inbound.ReportTime + flightTime | ||||
|                 earliest = ita - ttg | ||||
|   | ||||
| @@ -106,12 +106,12 @@ class RunwayManager: | ||||
|             if RunwayAssignmentType.AircraftType in runway.MayAssignments: | ||||
|                 if node.Inbound.Report.aircraft.type in runway.MayAssignments[RunwayAssignmentType.AircraftType]: | ||||
|                     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) | ||||
|             if RunwayAssignmentType.GateAssignment in runway.MayAssignments: | ||||
|                 if node.Inbound.Report.plannedGate in runway.MayAssignments[RunwayAssignmentType.GateAssignment]: | ||||
|                     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) | ||||
|  | ||||
|         runway = self.selectShallShouldMayArrivalRunway(node, shallRunways, useETA, earliestArrivalTime) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user