From 921919488fe2d0aa6e1224822547e166614aa59b Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Fri, 12 Nov 2021 19:40:19 +0100 Subject: [PATCH] calculate the PTA based on linear functions for the complete arrival route --- aman/sys/aco/Colony.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/aman/sys/aco/Colony.py b/aman/sys/aco/Colony.py index 93a925f..7e590f5 100644 --- a/aman/sys/aco/Colony.py +++ b/aman/sys/aco/Colony.py @@ -113,3 +113,24 @@ class Colony: for i in range(0, len(bestSequence[1])): self.Result.append(self.Configuration.Inbounds[bestSequence[1][i]]) Colony.associateInbound(rwyManager, self.Result[-1], self.Configuration.EarliestArrivalTime, True) + + # the idea behind the TTL/TTG per waypoint is that the TTL and TTG needs to be achieved in the + # first 2/3 of the estimated trackmiles and assign it with a linear function to the waypoints + + # calculate the TTL/TTG for all the waypoints (TTG is positive) + reqTimeDelta = abs((self.Result[-1].InitialArrivalTime - self.Result[-1].PlannedArrivalTime).total_seconds()) + gainTime = self.Result[-1].InitialArrivalTime >= self.Result[-1].PlannedArrivalTime + m = -3 * reqTimeDelta / (2 * self.Result[-1].PlannedTrackmiles) + timeDelta = 0.0 + + for waypoint in self.Result[-1].PlannedArrivalRoute: + waypointDT = m * waypoint.Trackmiles + reqTimeDelta + timeDelta += waypointDT + if timeDelta > reqTimeDelta: + waypointDT -= timeDelta - reqTimeDelta + waypointDT = timedelta(seconds = (waypointDT if False == gainTime else -1.0 * waypointDT)) + waypoint.PTA = waypoint.ETA + waypointDT + + # reached the PTA at the waypoint + if timeDelta >= reqTimeDelta: + break