fix the prediction calculation
This commit is contained in:
		| @@ -168,15 +168,20 @@ class Node: | |||||||
|             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 |             distance = gs * timePrediction | ||||||
|             self.PredictedCoordinate = tempWaypoint.project(course, distance) |             prediction = 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) | ||||||
|  |  | ||||||
|             # 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 = Waypoint(longitude = self.PredictedCoordinate[1], latitude = self.PredictedCoordinate[0]).haversine(star.Route[0]) |             if None != star: | ||||||
|             if 0.0 > self.PredictedDistanceToIAF: |                 bearing = Waypoint(longitude = prediction[1], latitude = prediction[0]).bearing(star.Route[0]) | ||||||
|                 self.PredictedDistanceToIAF = 0.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 |         # calculate the timings for the different arrival runways | ||||||
|         for identifier in sequencingConfig.ActiveArrivalRunways: |         for identifier in sequencingConfig.ActiveArrivalRunways: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user