Inbound.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.RequestedRunway = None
  15. self.PlannedArrivalTime = None
  16. self.PlannedRunway = None
  17. self.PlannedStar = None
  18. self.PlannedArrivalRoute = None
  19. self.PlannedTrackmiles = None
  20. self.FixedSequence = False
  21. self.WTC = None
  22. # analyze the WTC
  23. wtc = report.aircraft.wtc.upper()
  24. if 'L' == wtc or 'M' == wtc or 'H' == wtc or 'J' == wtc:
  25. self.WTC = wtc
  26. # analyze the requested runway
  27. if '' != report.requestedRunway:
  28. self.RequestedRunway = report.requestedRunway
  29. # search performance data -> fallback to A320
  30. if self.Report.aircraft.type in performanceData.Aircrafts:
  31. self.PerformanceData = performanceData.Aircrafts[self.Report.aircraft.type]
  32. if None == self.PerformanceData:
  33. self.PerformanceData = performanceData.Aircrafts['A320']