RHC.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python
  2. from datetime import timedelta
  3. import configparser;
  4. import sys
  5. class RHC():
  6. def __init__(self, config : configparser.ConfigParser):
  7. # latest scheduling fix in minutes
  8. self.FixedBeforeArrival = None
  9. # number of seconds per window
  10. self.WindowSize = None
  11. # number of horizon windows for optimization iteration
  12. self.WindowOverlap = None
  13. # distance until IAF to add an aircraft to the optimization
  14. self.MaximumIafDistance = None
  15. # search the required sections
  16. for key in config:
  17. if 'windowsize' == key:
  18. self.WindowSize = int(config['windowsize'])
  19. elif 'windowoverlap' == key:
  20. self.WindowOverlap = int(config['windowoverlap'])
  21. elif 'fixedbeforearrival' == key:
  22. self.FixedBeforeArrival = timedelta(minutes = int(config['fixedbeforearrival']))
  23. elif 'maximumiafdistance' == key:
  24. self.MaximumIafDistance = int(config['maximumiafdistance'])
  25. if self.WindowSize is None:
  26. sys.stderr.write('No window size configuration found!')
  27. sys.exit(-1)
  28. if self.WindowOverlap is None:
  29. sys.stderr.write('No window overlap configuration found!')
  30. sys.exit(-1)
  31. if self.FixedBeforeArrival is None:
  32. sys.stderr.write('No fixed before IAF configuration found!')
  33. sys.exit(-1)
  34. if self.MaximumIafDistance is None:
  35. sys.stderr.write('No maximum IAF distance found!')
  36. sys.exit(-1)