42 行
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			42 行
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| #!/usr/bin/env python
 | |
| 
 | |
| from datetime import timedelta
 | |
| 
 | |
| import configparser;
 | |
| import sys
 | |
| 
 | |
| class RHC():
 | |
|     def __init__(self, config : configparser.ConfigParser):
 | |
|         # latest scheduling fix in minutes
 | |
|         self.FixedBeforeArrival = None
 | |
|         # number of seconds per window
 | |
|         self.WindowSize = None
 | |
|         # number of horizon windows for optimization iteration
 | |
|         self.WindowOverlap = None
 | |
|         # distance until IAF to add an aircraft to the optimization
 | |
|         self.MaximumIafDistance = None
 | |
| 
 | |
|         # search the required sections
 | |
|         for key in config:
 | |
|             if 'windowsize' == key:
 | |
|                 self.WindowSize = int(config['windowsize'])
 | |
|             elif 'windowoverlap' == key:
 | |
|                 self.WindowOverlap = int(config['windowoverlap'])
 | |
|             elif 'fixedbeforearrival' == key:
 | |
|                 self.FixedBeforeArrival = timedelta(minutes = int(config['fixedbeforearrival']))
 | |
|             elif 'maximumiafdistance' == key:
 | |
|                 self.MaximumIafDistance = int(config['maximumiafdistance'])
 | |
| 
 | |
|         if self.WindowSize is None:
 | |
|             sys.stderr.write('No window size configuration found!')
 | |
|             sys.exit(-1)
 | |
|         if self.WindowOverlap is None:
 | |
|             sys.stderr.write('No window overlap configuration found!')
 | |
|             sys.exit(-1)
 | |
|         if self.FixedBeforeArrival is None:
 | |
|             sys.stderr.write('No fixed before IAF configuration found!')
 | |
|             sys.exit(-1)
 | |
|         if self.MaximumIafDistance is None:
 | |
|             sys.stderr.write('No maximum IAF distance found!')
 | |
|             sys.exit(-1)
 |