Pārlūkot izejas kodu

calculate the PTA based on linear functions for the complete arrival route

Sven Czarnian 3 gadi atpakaļ
vecāks
revīzija
921919488f
1 mainītis faili ar 21 papildinājumiem un 0 dzēšanām
  1. 21 0
      aman/sys/aco/Colony.py

+ 21 - 0
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