|
@@ -9,6 +9,7 @@ from aman.config.RHC import RHC
|
|
|
from aman.config.AirportSequencing import AirportSequencing
|
|
|
from aman.config.RunwaySequencing import RunwaySequencing
|
|
|
from aman.formats.SctEseFormat import SctEseFormat
|
|
|
+from aman.types.Waypoint import Waypoint
|
|
|
|
|
|
class Airport:
|
|
|
def findGngData(data, path):
|
|
@@ -103,11 +104,65 @@ class Airport:
|
|
|
for i in range(0, len(dependencies), 2):
|
|
|
self.DefaultSequencing.addDependency(dependencies[i], dependencies[i + 1])
|
|
|
|
|
|
- def parseConstraints(self, icao : str, planning):
|
|
|
+ def parseConstraints(self, planning):
|
|
|
+ self.ArrivalRouteConstraints = {}
|
|
|
+
|
|
|
for key in planning:
|
|
|
if True == key.startswith('constraints'):
|
|
|
star = key.replace('constraints', '').upper()
|
|
|
- #print(star)
|
|
|
+ if '' != star:
|
|
|
+ elements = list(filter(None, planning[key].split(':')))
|
|
|
+ if 3 > len(elements):
|
|
|
+ sys.stderr.write('Invalid constraint line: ' + key + '=' + planning[key])
|
|
|
+ sys.exit(-1)
|
|
|
+
|
|
|
+ waypoints = []
|
|
|
+
|
|
|
+ # values for the waypoint constraints
|
|
|
+ waypointName = elements[0]
|
|
|
+ constraints = [-1, -1]
|
|
|
+ isBaseTurn = False
|
|
|
+ isFinalTurn = False
|
|
|
+
|
|
|
+ index = 1
|
|
|
+ while index < len(elements):
|
|
|
+ if 'A' == elements[index] or 'S' == elements[index]:
|
|
|
+ if index + 1 == len(elements) or False == elements[index + 1].isnumeric():
|
|
|
+ sys.stderr.write('Invalid constraint line: ' + key + '=' + planning[key])
|
|
|
+ sys.exit(-1)
|
|
|
+
|
|
|
+ if 'A' == elements[index]:
|
|
|
+ constraints[0] = int(elements[index + 1])
|
|
|
+ else:
|
|
|
+ constraints[1] = int(elements[index + 1])
|
|
|
+ index += 1
|
|
|
+ elif 'B' == elements[index]:
|
|
|
+ isBaseTurn = True
|
|
|
+ elif 'F' == elements[index]:
|
|
|
+ isFinalTurn = True
|
|
|
+ else:
|
|
|
+ if False == isBaseTurn and False == isFinalTurn and -1 == constraints[0] and -1 == constraints[1] and '' == waypointName:
|
|
|
+ sys.stderr.write('Invalid constraint line: ' + key + '=' + planning[key])
|
|
|
+ sys.exit(-1)
|
|
|
+ if True == isBaseTurn and True == isFinalTurn:
|
|
|
+ sys.stderr.write('Invalid constraint line: ' + key + '=' + planning[key])
|
|
|
+ sys.exit(-1)
|
|
|
+
|
|
|
+ waypoints.append(Waypoint(name = waypointName, base = isBaseTurn, final = isFinalTurn))
|
|
|
+ if -1 != constraints[0]:
|
|
|
+ waypoints[-1].Altitude = constraints[0]
|
|
|
+ if -1 != constraints[1]:
|
|
|
+ waypoints[-1].Speed = constraints[1]
|
|
|
+
|
|
|
+ # reset temporary data
|
|
|
+ waypointName = elements[index]
|
|
|
+ constraints = [-1, -1]
|
|
|
+ isBaseTurn = False
|
|
|
+ isFinalTurn = False
|
|
|
+
|
|
|
+ index += 1
|
|
|
+
|
|
|
+ self.ArrivalRouteConstraints[star] = waypoints
|
|
|
|
|
|
def __init__(self, filepath : str, icao : str):
|
|
|
config = configparser.ConfigParser()
|
|
@@ -157,6 +212,6 @@ class Airport:
|
|
|
sys.exit(-1)
|
|
|
self.GaforId = dataConfig['gaforid']
|
|
|
|
|
|
- # get the default sequencing data and constraints
|
|
|
+ # get the default sequencing data
|
|
|
self.parseDefaultSequencingConfiguration(icao, planningConfig)
|
|
|
- self.parseConstraints(icao, planningConfig)
|
|
|
+ self.parseConstraints(planningConfig)
|