fix bugs in TTL and TTG calculations
This commit is contained in:
		| @@ -176,12 +176,23 @@ class Node: | |||||||
|             if None != star: |             if None != star: | ||||||
|                 flightTime, trackmiles, arrivalRoute = self.arrivalEstimation(identifier.Runway, star, weatherModel) |                 flightTime, trackmiles, arrivalRoute = self.arrivalEstimation(identifier.Runway, star, weatherModel) | ||||||
|  |  | ||||||
|                 avgSpeed = trackmiles / (float(flightTime.seconds) / 3600.0) |                 # calculate average speed gain | ||||||
|                 # the closer we get to the IAF the less time delta can be achieved by short cuts, delay vectors or speeds |                 avgSpeed = trackmiles / (flightTime.total_seconds() / 3600.0) | ||||||
|                 ratio = min(2.0, max(0.0, self.PredictedDistanceToIAF / (trackmiles - self.PredictedDistanceToIAF))) |                 avgSpeedIncrease = avgSpeed * 1.10 | ||||||
|                 possibleTimeDelta = (trackmiles / (avgSpeed * 0.9)) * 60 |                 avgSpeedDecrease = avgSpeed * 0.80 | ||||||
|                 ttg = timedelta(minutes = (possibleTimeDelta - flightTime.total_seconds() / 60) * ratio) |                 decreasedSpeedFlighttime = (trackmiles / avgSpeedDecrease) * 3600.0 # given in seconds | ||||||
|                 ttl = timedelta(minutes = (possibleTimeDelta - flightTime.total_seconds() / 60)) |  | ||||||
|  |                 # 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) + 15.0 | ||||||
|  |                 shortcutFlighttime = (shortcutDistance / avgSpeedIncrease) * 3600.0 | ||||||
|  |                 if shortcutFlighttime > flightTime.total_seconds(): | ||||||
|  |                     shortcutFlighttime = flightTime.total_seconds() | ||||||
|  |  | ||||||
|  |                 # 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 | ||||||
|  |                 ttl = timedelta(seconds = decreasedSpeedFlighttime - flightTime.total_seconds()) | ||||||
|                 ita = self.Inbound.ReportTime + flightTime |                 ita = self.Inbound.ReportTime + flightTime | ||||||
|                 earliest = ita - ttg |                 earliest = ita - ttg | ||||||
|                 latest = ita + ttl |                 latest = ita + ttl | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user