From ad129dc2b662fe93926a1c7088b6af4903dd84c6 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Tue, 14 Dec 2021 11:25:51 +0100 Subject: [PATCH] fix the prediction calculation --- aman/sys/aco/Node.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/aman/sys/aco/Node.py b/aman/sys/aco/Node.py index 4c9dd25..138da55 100644 --- a/aman/sys/aco/Node.py +++ b/aman/sys/aco/Node.py @@ -168,15 +168,20 @@ class Node: tempWaypoint = Waypoint(longitude = inbound.CurrentPosition.longitude, latitude = inbound.CurrentPosition.latitude) gs = inbound.Report.dynamics.groundSpeed * 0.514444 # ground speed in m/s distance = gs * timePrediction - self.PredictedCoordinate = tempWaypoint.project(course, distance) + 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) # calculate the distance based on the flown distance and update the predicted distance - self.PredictedDistanceToIAF = Waypoint(longitude = self.PredictedCoordinate[1], latitude = self.PredictedCoordinate[0]).haversine(star.Route[0]) - if 0.0 > self.PredictedDistanceToIAF: - self.PredictedDistanceToIAF = 0.0 + if None != star: + bearing = Waypoint(longitude = prediction[1], latitude = prediction[0]).bearing(star.Route[0]) + correctedDistance = math.cos(abs(bearing - course)) * distance * 0.000539957 + self.PredictedDistanceToIAF -= correctedDistance + if 0.0 > self.PredictedDistanceToIAF: + self.PredictedDistanceToIAF = 0.0 + + self.PredictedCoordinate = prediction # calculate the timings for the different arrival runways for identifier in sequencingConfig.ActiveArrivalRunways: