add a predicted waypoint for later calculations

This commit is contained in:
Sven Czarnian
2021-11-24 12:04:52 +01:00
parent be6fe84d77
commit f359ec8189

View File

@@ -144,6 +144,7 @@ class Node:
def __init__(self, inbound : Inbound, referenceTime : datetime, weatherModel : WeatherModel, def __init__(self, inbound : Inbound, referenceTime : datetime, weatherModel : WeatherModel,
navData : SctEseFormat, sequencingConfig : AirportSequencing): navData : SctEseFormat, sequencingConfig : AirportSequencing):
self.PredictedDistanceToIAF = inbound.Report.distanceToIAF self.PredictedDistanceToIAF = inbound.Report.distanceToIAF
self.PredictedCoordinate = [ inbound.CurrentPosition.latitude, inbound.CurrentPosition.longitude ]
self.ArrivalCandidates = {} self.ArrivalCandidates = {}
self.Inbound = inbound self.Inbound = inbound
@@ -157,17 +158,14 @@ class Node:
course = weatherModel.estimateCourse(inbound.Report.dynamics.altitude, inbound.Report.dynamics.groundSpeed, inbound.Report.dynamics.heading) course = weatherModel.estimateCourse(inbound.Report.dynamics.altitude, inbound.Report.dynamics.groundSpeed, inbound.Report.dynamics.heading)
tempWaypoint = Waypoint(longitude = inbound.CurrentPosition.longitude, latitude = inbound.CurrentPosition.latitude) tempWaypoint = Waypoint(longitude = inbound.CurrentPosition.longitude, latitude = inbound.CurrentPosition.latitude)
gs = inbound.Report.dynamics.groundSpeed * 0.514444 # ground speed in m/s gs = inbound.Report.dynamics.groundSpeed * 0.514444 # ground speed in m/s
distance = gs * timePrediction * 0.000539957 # distance back to nm distance = gs * timePrediction
self.PredictedCoordinate = 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, navData)
if None != star:
bearing = tempWaypoint.bearing(star.Route[0])
else:
bearing = inbound.Report.dynamics.heading
# 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
self.PredictedDistanceToIAF -= math.cos(math.radians(bearing - course)) * distance self.PredictedDistanceToIAF = Waypoint(longitude = self.PredictedCoordinate[1], latitude = self.PredictedCoordinate[0]).haversine(star.Route[0])
if 0.0 > self.PredictedDistanceToIAF: if 0.0 > self.PredictedDistanceToIAF:
self.PredictedDistanceToIAF = 0.0 self.PredictedDistanceToIAF = 0.0