fix the TTG calculation

This commit is contained in:
Sven Czarnian
2021-12-14 11:26:25 +01:00
vanhempi ad129dc2b6
commit 4f21f8968b

Näytä tiedosto

@@ -196,15 +196,13 @@ class Node:
decreasedSpeedFlighttime = (trackmiles / avgSpeedDecrease) * 3600.0 # given in seconds
# calculate shortcut gain and add 15 miles for final and base turn
currentPosition = Waypoint(latitude = self.PredictedCoordinate[0], longitude = self.PredictedCoordinate[1])
shortcutDistance = currentPosition.haversine(identifier.Runway.Start) + 25.0
shortcutFlighttime = (shortcutDistance / avgSpeed) * 3600.0
if shortcutFlighttime > flightTime.total_seconds():
shortcutFlighttime = flightTime.total_seconds()
timeUntilIAF = flightTime - flightTimeOnStar
if 0.0 > timeUntilIAF.total_seconds():
timeUntilIAF = timedelta(seconds = 0)
# the best TTG is the shortest path with the fastest speed
ttg = timedelta(seconds = flightTime.total_seconds() - shortcutFlighttime)
# the best TTL is the longest path with the slowest speed
# TODO use configurations to define the maximum time gain
ttg = timedelta(seconds = timeUntilIAF.total_seconds() * 0.2)
ttl = timedelta(seconds = decreasedSpeedFlighttime - flightTime.total_seconds())
ita = self.Inbound.ReportTime + flightTime
earliest = ita - ttg