diff --git a/aman/sys/aco/Colony.py b/aman/sys/aco/Colony.py index c881636..6ca7f6e 100644 --- a/aman/sys/aco/Colony.py +++ b/aman/sys/aco/Colony.py @@ -120,26 +120,14 @@ class Colony: # finalize the sequence rwyManager = RunwayManager(self.Configuration) for i in range(0, len(bestSequence[1])): - self.Result.append(self.Nodes[bestSequence[1][i]].Inbound) + self.Result.append(self.Nodes[bestSequence[1][i]]) Colony.associateInbound(rwyManager, self.Nodes[bestSequence[1][i]], 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 + reqTimeDelta = self.Result[-1].Inbound.InitialArrivalTime - self.Result[-1].Inbound.PlannedArrivalTime + self.Result[-1].Inbound.PlannedArrivalRoute[0].PTA = self.Result[-1].Inbound.PlannedArrivalRoute[0].ETA - reqTimeDelta + for i in range(1, len(self.Result[-1].Inbound.PlannedArrivalRoute)): + prev = self.Result[-1].Inbound.PlannedArrivalRoute[i - 1] + current = self.Result[-1].Inbound.PlannedArrivalRoute[i] + if None == prev.ETA or None == current.ETA: + print(self.Result[-1].Inbound.Callsign + ': ' + prev.Waypoint.Name + ', ' + str(prev.ETA) + '; ' + current.Waypoint.Name + ', ' + current.ETA) + current.PTA = prev.PTA + (current.ETA - prev.ETA)