Inbound.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python
  2. import pytz
  3. from datetime import datetime
  4. from aman.com import AircraftReport_pb2
  5. from aman.sys.WeatherModel import WeatherModel
  6. from aman.types.PerformanceData import PerformanceData
  7. class Inbound:
  8. def __init__(self, report : AircraftReport_pb2.AircraftReport, performanceData : PerformanceData):
  9. self.Report = report
  10. self.Callsign = report.aircraft.callsign
  11. self.CurrentPosition = report.position
  12. self.ReportTime = datetime.strptime(report.reportTime + '+0000', '%Y%m%d%H%M%S%z').replace(tzinfo = pytz.UTC)
  13. self.EnrouteArrivalTime = None
  14. self.InitialArrivalTime = None
  15. self.RequestedRunway = None
  16. self.MaximumTimeToGain = None
  17. self.PlannedArrivalTime = None
  18. self.PlannedRunway = None
  19. self.PlannedStar = None
  20. self.PlannedArrivalRoute = None
  21. self.PlannedTrackmiles = None
  22. self.FixedSequence = False
  23. self.ExpectedRunway = None
  24. self.AssignmentMode = None
  25. self.HasValidSequence = False
  26. self.WTC = None
  27. # analyze the WTC
  28. wtc = report.aircraft.wtc.upper()
  29. if 'L' == wtc or 'M' == wtc or 'H' == wtc or 'J' == wtc:
  30. self.WTC = wtc
  31. # analyze the requested runway
  32. if '' != report.requestedRunway:
  33. self.RequestedRunway = report.requestedRunway
  34. # search performance data -> fallback to A320
  35. if self.Report.aircraft.type in performanceData.Aircrafts:
  36. self.PerformanceData = performanceData.Aircrafts[self.Report.aircraft.type]
  37. if None == self.PerformanceData:
  38. self.PerformanceData = performanceData.Aircrafts['A320']