define member variables with capital letters
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
class ArrivalRoute:
|
||||
def __init__(self, name : str, runway : str, waypoints : list):
|
||||
self.name = name
|
||||
self.runway = runway
|
||||
self.iaf = waypoints[0]
|
||||
self.route = waypoints
|
||||
self.Name = name
|
||||
self.Runway = runway
|
||||
self.Iaf = waypoints[0]
|
||||
self.Route = waypoints
|
||||
|
||||
def __str__(self):
|
||||
return 'Name: ' + self.name + ', IAF: ' + self.iaf.name + ', RWY: ' + self.runway
|
||||
return 'Name: ' + self.Name + ', IAF: ' + self.Iaf.name + ', RWY: ' + self.Runway
|
||||
@@ -39,7 +39,7 @@ class Inbound:
|
||||
distance = 100000.0
|
||||
currentPosition = Waypoint('', self.Report.position.latitude, self.Report.position.longitude)
|
||||
for runway in sequencingConfig.ActiveArrivalRunways:
|
||||
candidateDistance = runway.Runway.start.haversine(currentPosition)
|
||||
candidateDistance = runway.Runway.Start.haversine(currentPosition)
|
||||
if distance > candidateDistance:
|
||||
self.PlannedRunway = runway
|
||||
distance = candidateDistance
|
||||
@@ -49,11 +49,11 @@ class Inbound:
|
||||
if None == self.PlannedRunway:
|
||||
return
|
||||
|
||||
for arrivalRunway in navData.arrivalRoutes:
|
||||
if arrivalRunway == self.PlannedRunway.Runway.name:
|
||||
stars = navData.arrivalRoutes[arrivalRunway]
|
||||
for arrivalRunway in navData.ArrivalRoutes:
|
||||
if arrivalRunway == self.PlannedRunway.Runway.Name:
|
||||
stars = navData.ArrivalRoutes[arrivalRunway]
|
||||
for star in stars:
|
||||
if 0 != len(star.route) and self.Report.initialApproachFix == star.iaf.name:
|
||||
if 0 != len(star.Route) and self.Report.initialApproachFix == star.Iaf.Name:
|
||||
self.PlannedStar = star
|
||||
return
|
||||
|
||||
@@ -63,14 +63,14 @@ class Inbound:
|
||||
|
||||
# calculate remaining trackmiles
|
||||
remainingDistanceNM = self.Report.distanceToIAF
|
||||
start = self.PlannedStar.route[0]
|
||||
for i in range(1, len(self.PlannedStar.route)):
|
||||
remainingDistanceNM += start.haversine(self.PlannedStar.route[i]) * 0.539957
|
||||
start = self.PlannedStar.route[i]
|
||||
start = self.PlannedStar.Route[0]
|
||||
for i in range(1, len(self.PlannedStar.Route)):
|
||||
remainingDistanceNM += start.haversine(self.PlannedStar.Route[i]) * 0.539957
|
||||
start = self.PlannedStar.Route[i]
|
||||
|
||||
# calculate descend profile
|
||||
flightTimeSeconds = 0
|
||||
currentHeading = Waypoint('', self.Report.position.latitude, self.Report.position.longitude).bearing(self.PlannedStar.route[0])
|
||||
currentHeading = Waypoint('', self.Report.position.latitude, self.Report.position.longitude).bearing(self.PlannedStar.Route[0])
|
||||
distanceToWaypoint = self.Report.distanceToIAF
|
||||
nextWaypointIndex = 0
|
||||
currentPosition = [ self.Report.dynamics.altitude, self.Report.dynamics.groundSpeed ]
|
||||
@@ -105,7 +105,7 @@ class Inbound:
|
||||
distanceToWaypoint -= abs(lastDistance - remainingDistanceNM)
|
||||
if 0 >= distanceToWaypoint:
|
||||
nextWaypointIndex += 1
|
||||
if nextWaypointIndex < len(self.PlannedStar.route):
|
||||
currentHeading = self.PlannedStar.route[nextWaypointIndex - 1].bearing(self.PlannedStar.route[nextWaypointIndex])
|
||||
if nextWaypointIndex < len(self.PlannedStar.Route):
|
||||
currentHeading = self.PlannedStar.Route[nextWaypointIndex - 1].bearing(self.PlannedStar.Route[nextWaypointIndex])
|
||||
|
||||
return timedelta(seconds = flightTimeSeconds)
|
||||
|
||||
@@ -2,27 +2,29 @@
|
||||
|
||||
class PerformanceData:
|
||||
def __init__(self, icao : str):
|
||||
self.icao = icao
|
||||
self.speedAboveFL240 = 0.0
|
||||
self.speedAboveFL100 = 0.0
|
||||
self.speedBelowFL100 = 0.0
|
||||
self.speedApproach = 0.0
|
||||
self.rodAboveFL240 = 0.0
|
||||
self.rodAboveFL100 = 0.0
|
||||
self.rodBelowFL100 = 2000.0
|
||||
self.Icao = icao
|
||||
self.SpeedAboveFL240 = 0.0
|
||||
self.SpeedAboveFL100 = 0.0
|
||||
self.SpeedBelowFL100 = 0.0
|
||||
self.SpeedApproach = 0.0
|
||||
self.RodAboveFL240 = 0.0
|
||||
self.RodAboveFL100 = 0.0
|
||||
self.RodBelowFL100 = 2000.0
|
||||
|
||||
def ias(self, altitude, distance):
|
||||
if 24000 >= altitude:
|
||||
return self.speedAboveFL240
|
||||
return self.SpeedAboveFL240
|
||||
elif 10000 >= altitude:
|
||||
return self.speedAboveFL100
|
||||
return self.SpeedAboveFL100
|
||||
elif 10000 < altitude and 5 < distance:
|
||||
return self.SpeedBelowFL100
|
||||
elif 5 >= distance:
|
||||
return self.speedApproach
|
||||
return self.SpeedApproach
|
||||
else:
|
||||
return 220
|
||||
|
||||
def __str__(self):
|
||||
return 'ICAO: ' + self.icao + ', FL240: ' + str(self.rodAboveFL240) + '@' + str(self.speedAboveFL240) + \
|
||||
', +FL100: ' + str(self.rodAboveFL100) + '@' + str(self.speedAboveFL100) + \
|
||||
', -FL100: ' + str(self.rodBelowFL100) + '@' + str(self.speedBelowFL100) + \
|
||||
', Vapp: ' + str(self.speedApproach)
|
||||
return 'ICAO: ' + self.icao + ', FL240: ' + str(self.RodAboveFL240) + '@' + str(self.SpeedAboveFL240) + \
|
||||
', +FL100: ' + str(self.RodAboveFL100) + '@' + str(self.SpeedAboveFL100) + \
|
||||
', -FL100: ' + str(self.RodBelowFL100) + '@' + str(self.SpeedBelowFL100) + \
|
||||
', Vapp: ' + str(self.SpeedApproach)
|
||||
|
||||
@@ -4,9 +4,9 @@ from aman.types.Waypoint import Waypoint
|
||||
|
||||
class Runway:
|
||||
def __init__(self, start : Waypoint, end : Waypoint):
|
||||
self.name = start.name
|
||||
self.start = start
|
||||
self.end = end
|
||||
self.Name = start.Name
|
||||
self.Start = start
|
||||
self.End = end
|
||||
|
||||
def heading(self):
|
||||
return self.start.bearing(self.end)
|
||||
return self.Start.bearing(self.End)
|
||||
|
||||
@@ -21,18 +21,18 @@ class Waypoint:
|
||||
return dd
|
||||
|
||||
def __init__(self, name : str, latitude : float, longitude : float):
|
||||
self.name = name
|
||||
self.coordinate = np.array([ latitude, longitude ])
|
||||
self.Name = name
|
||||
self.Coordinate = np.array([ latitude, longitude ])
|
||||
|
||||
def __str__(self):
|
||||
return 'Name: ' + self.name + ', Lat: ' + str(self.coordinate[0]) + ', Lon: ' + str(self.coordinate[1])
|
||||
return 'Name: ' + self.Name + ', Lat: ' + str(self.Coordinate[0]) + ', Lon: ' + str(self.Coordinate[1])
|
||||
|
||||
def haversine(self, other):
|
||||
geodesic = pyproj.Geod(ellps='WGS84')
|
||||
forward, backward, distance = geodesic.inv(self.coordinate[1], self.coordinate[0], other.coordinate[1], other.coordinate[0])
|
||||
forward, backward, distance = geodesic.inv(self.Coordinate[1], self.Coordinate[0], other.Coordinate[1], other.Coordinate[0])
|
||||
return distance / 1000.0
|
||||
|
||||
def bearing(self, other):
|
||||
geodesic = pyproj.Geod(ellps='WGS84')
|
||||
forward, backward, distance = geodesic.inv(self.coordinate[1], self.coordinate[0], other.coordinate[1], other.coordinate[0])
|
||||
forward, backward, distance = geodesic.inv(self.Coordinate[1], self.Coordinate[0], other.Coordinate[1], other.Coordinate[0])
|
||||
return forward
|
||||
|
||||
Reference in New Issue
Block a user