Kaynağa Gözat

add more values for later plannings

Sven Czarnian 3 yıl önce
ebeveyn
işleme
9887aa48a4
1 değiştirilmiş dosya ile 15 ekleme ve 3 silme
  1. 15 3
      aman/types/Inbound.py

+ 15 - 3
aman/types/Inbound.py

@@ -28,8 +28,17 @@ class Inbound:
         self.findArrivalRunway(sequencingConfig)
         self.findArrivalRoute(navData)
 
-        duration = self.secondsUntilTouchdown(weatherModel)
-        self.InitialArrivalTime = self.ReportTime + duration
+        flightTime, flightTimeUntilIaf, trackmiles = self.secondsUntilTouchdown(weatherModel)
+
+        # calculate the maximum time to gain (assumption: 10% speed increase by acceleration and shortcuts)
+        avgSpeed = self.Report.distanceToIAF / (float(flightTimeUntilIaf.seconds) / 3600.0)
+        self.MaximumTimeToGain = flightTimeUntilIaf - timedelta(minutes = (self.Report.distanceToIAF / (avgSpeed * 1.1)) * 60)
+        avgSpeed = trackmiles / (float(flightTime.seconds) / 3600.0)
+        self.MaximumTimeToGain += flightTime - timedelta(minutes = (trackmiles / (avgSpeed * 1.1)) * 60)
+
+        # calculate the different arrival times
+        self.InitialArrivalTime = self.ReportTime + flightTime
+        self.EarliestArrivalTime = self.InitialArrivalTime - self.MaximumTimeToGain
         self.EstimatedArrivalTime = self.InitialArrivalTime
         self.EstimatedStarEntryTime = None
 
@@ -104,6 +113,7 @@ class Inbound:
         currentIAS = self.PerformanceData.ias(self.Report.dynamics.altitude, trackmiles)
         currentPosition = [ self.Report.dynamics.altitude, self.Report.dynamics.groundSpeed ]
         distanceToWaypoint = self.Report.distanceToIAF
+        flightTimeUntilIafSeconds = 0
         flightTimeSeconds = 0
         nextWaypointIndex = 0
         flownDistance = 0.0
@@ -147,6 +157,8 @@ class Inbound:
                 currentIAS = newIAS
 
             flightTimeSeconds += 10
+            if flownDistance <= self.Report.distanceToIAF:
+                flightTimeUntilIafSeconds += 10
             if flownDistance >= trackmiles:
                 break
 
@@ -165,4 +177,4 @@ class Inbound:
                     currentHeading = self.PlannedStar.Route[lastWaypointIndex].bearing(self.PlannedStar.Route[nextWaypointIndex])
                     currentPosition[1] = min(weather.calculateGS(newAltitude, currentIAS, currentHeading), currentPosition[1])
 
-        return timedelta(seconds = flightTimeSeconds)
+        return timedelta(seconds = flightTimeSeconds), timedelta(seconds = flightTimeUntilIafSeconds), trackmiles