add optimization thresholds
This commit is contained in:
@@ -221,7 +221,40 @@ class Airport:
|
||||
else:
|
||||
dictionary[runway][key].extend(assignments[key])
|
||||
|
||||
def parseOptimization(self, key : str, line : str):
|
||||
star = key.replace('optimization', '').upper()
|
||||
|
||||
# check if the STAR exists
|
||||
found = False
|
||||
for rwy in self.GngData.ArrivalRoutes:
|
||||
for route in self.GngData.ArrivalRoutes[rwy]:
|
||||
if star == route.Name:
|
||||
found = True
|
||||
break
|
||||
if True == found:
|
||||
break
|
||||
|
||||
if False == found:
|
||||
sys.stderr.write('Unknown star:' + key)
|
||||
raise Exception()
|
||||
|
||||
elements = line.split(':')
|
||||
if 2 != len(elements):
|
||||
sys.stderr.write('Invalid optimization parameter for ' + key)
|
||||
raise Exception()
|
||||
|
||||
maxTTG = int(elements[0])
|
||||
ttgRatio = float(elements[1])
|
||||
|
||||
return star, maxTTG, ttgRatio
|
||||
|
||||
def updateOptimizationParameters(dictionary, star, maxTTG, ttgRatio):
|
||||
if star not in dictionary:
|
||||
dictionary.setdefault(star, [])
|
||||
dictionary[star] = [ maxTTG, ttgRatio ]
|
||||
|
||||
def parseRunwayAssignment(self, icao : str, planning):
|
||||
self.OptimizationParameters = {}
|
||||
self.RunwayAssignmentsShall = {}
|
||||
self.RunwayAssignmentsShould = {}
|
||||
self.RunwayAssignmentsMay = {}
|
||||
@@ -242,6 +275,10 @@ class Airport:
|
||||
assignments = Airport.parseAssignment(planning[key])
|
||||
Airport.updateRunwayAssignment(self.RunwayAssignmentsMay, runway, assignments)
|
||||
mayFound = True
|
||||
elif True == key.startswith('optimization'):
|
||||
star, maxTTG, ttgRatio = self.parseOptimization(key, planning[key])
|
||||
Airport.updateOptimizationParameters(self.OptimizationParameters, star, maxTTG, ttgRatio)
|
||||
|
||||
|
||||
# find the max delays
|
||||
if True == mayFound:
|
||||
|
||||
Reference in New Issue
Block a user