fix the prediction calculation
This commit is contained in:
@@ -168,16 +168,21 @@ 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:
|
||||||
|
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:
|
if 0.0 > self.PredictedDistanceToIAF:
|
||||||
self.PredictedDistanceToIAF = 0.0
|
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:
|
||||||
star = Node.findArrivalRoute(self.Inbound.Report.initialApproachFix, identifier.Runway, navData)
|
star = Node.findArrivalRoute(self.Inbound.Report.initialApproachFix, identifier.Runway, navData)
|
||||||
|
|||||||
Reference in New Issue
Block a user