コード例 #1
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def single_run():

    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    #plot.init()

    # Construct flight list
    planes = generators.get_via_stdin()

    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)

    # Register hub arrivals to determine flow rates
    listeners.init(config.hubs)

    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)

    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))

    sim.run()

    debug.print_dictionary(statistics.vars)
コード例 #2
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def single_run():
    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    visualization.init()

    # Construct flight list
    planes = [
        Aircraft('FLT001', Route([Waypoint('DUS'), Waypoint('IAD')]), 0),
        Aircraft('FLT002', Route([Waypoint('BRU'), Waypoint('ORD')]), 0),
        Aircraft('FLT003', Route([Waypoint('AMS'), Waypoint('IAH')]), 0),
        Aircraft('FLT004', Route([Waypoint('LHR'), Waypoint('ATL')]), 45),
        Aircraft('FLT005', Route([Waypoint('FRA'), Waypoint('SFO')]), 0),
    ]

    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)
    
    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)
    
    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))
    
    sim.run()

    debug.print_dictionary(statistics.vars)
コード例 #3
0
def execute():

    for hub in config.hubs:

        sim.init()
        aircraft_handlers.init()
        formation_handlers.init()
        statistics.init()
        visualization.init()

        # Construct flight list
        planes = [
            Aircraft('FLT001', Route([Waypoint('LHR'),
                                      Waypoint('IAD')]), 0),
            Aircraft('FLT001', Route([Waypoint('LHR'),
                                      Waypoint('IAD')]), 0),
            Aircraft('FLT001', Route([Waypoint('LHR'),
                                      Waypoint('IAD')]), 0),
            Aircraft('FLT002', Route([Waypoint('LHR'),
                                      Waypoint('JFK')]), 0),
            #Aircraft('FLT003', Route([Waypoint('LHR'), Waypoint('SFO')]), 0),
            Aircraft('FLT003', Route([Waypoint('LHR'),
                                      Waypoint('ORD')]), 0),
        ]

        # Allocate hubs to flights
        allocators.allocate(planes, config.hubs)

        for flight in planes:
            sim.events.append(sim.Event('aircraft-init', flight, 0))

        sim.run()

        debug.print_dictionary(statistics.vars)
コード例 #4
0
def single_run():
    
    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    #plot.init()
    
    # Construct flight list
    planes = generators.get_via_stdin()
    #planes = generators.get_manual()
    
    if len(planes) > 0:

        # Find hubs
        config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)
    
        # Allocate hubs to flights
        allocators.allocate(planes, config.hubs)
        
        for flight in planes:
            sim.events.append(sim.Event('aircraft-init', flight, 0))
        
    sim.run()

    sink.push(statistics.vars)
    debug.print_dictionary(statistics.vars)
コード例 #5
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def execute():

    for hub in config.hubs:

        sim.init()
        aircraft_handlers.init()
        formation_handlers.init()
        statistics.init()
        visualization.init()

        # Construct flight list
        planes = [
            Aircraft('FLT001', Route([Waypoint('LHR'), Waypoint('IAD')]), 0),
            Aircraft('FLT001', Route([Waypoint('LHR'), Waypoint('IAD')]), 0),
            Aircraft('FLT001', Route([Waypoint('LHR'), Waypoint('IAD')]), 0),
            Aircraft('FLT002', Route([Waypoint('LHR'), Waypoint('JFK')]), 0),
            #Aircraft('FLT003', Route([Waypoint('LHR'), Waypoint('SFO')]), 0),
            Aircraft('FLT003', Route([Waypoint('LHR'), Waypoint('ORD')]), 0),
        ]

        # Allocate hubs to flights
        allocators.allocate(planes, config.hubs)
        
        for flight in planes:
            sim.events.append(sim.Event('aircraft-init', flight, 0))

        sim.run()

        debug.print_dictionary(statistics.vars)
コード例 #6
0
def single_run():

    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    #plot.init()

    # Construct flight list
    planes = generators.get_via_stdin()

    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)

    # Register hub arrivals to determine flow rates
    listeners.init(config.hubs)

    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)

    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))

    sim.run()

    debug.print_dictionary(statistics.vars)
コード例 #7
0
def single_run():

    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()

    # Construct flight list
    config.planes = generators.get_via_stdin()

    # Find hubs
    config.hubs = builders.build_hubs(config.planes, config.count_hubs,
                                      config.Z)

    # Allocate hubs to flights
    allocators.allocate(config.planes, config.hubs)

    for flight in config.planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))

    sim.run()

    debug.print_dictionary(statistics.vars)

    return statistics.vars['fuel_saved'], statistics.vars['fuel_saved_abs']
コード例 #8
0
def single_run():
    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    visualization.init()

    # Construct flight list
    planes = [
        Aircraft('FLT001', Route([Waypoint('DUS'),
                                  Waypoint('IAD')]), 0),
        Aircraft('FLT002', Route([Waypoint('BRU'),
                                  Waypoint('ORD')]), 0),
        Aircraft('FLT003', Route([Waypoint('AMS'),
                                  Waypoint('IAH')]), 0),
        Aircraft('FLT004', Route([Waypoint('LHR'),
                                  Waypoint('ATL')]), 45),
        Aircraft('FLT005', Route([Waypoint('FRA'),
                                  Waypoint('SFO')]), 0),
    ]

    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)

    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)

    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))

    sim.run()

    debug.print_dictionary(statistics.vars)
コード例 #9
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def execute():
    
    print 'init sink %s' % config.sink_dir
    
    sink.init(config.sink_dir)

    for hub in config.hubs:
        
        print 'Progress: %d of %d iterations' % (
            config.hubs.index(hub)+1,
            len(config.hubs)
        )

        sim.init()
        aircraft_handlers.init()
        formation_handlers.init()
        statistics.init()
        
        # Construct flight list
        planes = generators.get_via_stdin()
        
        # Allocate hubs to flights
        for flight in planes:

            # Assign hub by injecting into route
            flight.route.waypoints = [
                flight.route.waypoints[0],
                hub,
                flight.route.waypoints[1]
            ]
    
            flight.route.init_segments()
        
        for flight in planes:
            sim.events.append(sim.Event('aircraft-init', flight, 0))

        sim.run()
        
        # Prepare data matrix
        d = {
            'hub_lat'                : hub.lat,
            'hub_lon'                : hub.lon,
            'distance_total'         : float(statistics.vars['distance_total']),
            'distance_formation'     : float(statistics.vars['distance_formation']),
            'distance_solo'          : float(statistics.vars['distance_solo']),
            'formation_count'        : float(statistics.vars['formation_count']),
            'formation_success_rate' : float(statistics.vars['formation_success_rate']),
            'alpha_eff'              : float(statistics.vars['alpha_effective']),
            'distance_success_rate'  : float(statistics.vars['distance_success_rate']),
            'avg_formation_size'     : float(statistics.vars['avg_formation_size']),
            'fuel_saved'             : float(statistics.vars['fuel_saved']),
            'distance_penalty'       : float(statistics.vars['distance_penalty']),
        }

        sink.push(d)
        debug.print_dictionary(d)
コード例 #10
0
def single_run(planes):

    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    calibrate.init()

    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)

    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)

    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))

    sim.run()
コード例 #11
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def single_run(planes):
    
    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    calibrate.init()
    
    # Find hubs
    config.hubs = builders.build_hubs(planes, config.count_hubs, config.Z)
    
    # Allocate hubs to flights
    allocators.allocate(planes, config.hubs)
    
    for flight in planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))
    
    sim.run()
コード例 #12
0
ファイル: run.py プロジェクト: mauzeh/formation-flight
def single_run():

    sim.init()
    aircraft_handlers.init()
    formation_handlers.init()
    statistics.init()
    
    # Construct flight list
    config.planes = generators.get_via_stdin()
    
    # Find hubs
    config.hubs = builders.build_hubs(config.planes, config.count_hubs, config.Z)

    # Allocate hubs to flights
    allocators.allocate(config.planes, config.hubs)
    
    for flight in config.planes:
        sim.events.append(sim.Event('aircraft-init', flight, 0))
    
    sim.run()

    debug.print_dictionary(statistics.vars)
    
    return statistics.vars['fuel_saved'], statistics.vars['fuel_saved_abs']
コード例 #13
0
def execute():

    print 'init sink %s' % config.sink_dir

    sink.init(config.sink_dir)

    for hub in config.hubs:

        print 'Progress: %d of %d iterations' % (config.hubs.index(hub) + 1,
                                                 len(config.hubs))

        sim.init()
        aircraft_handlers.init()
        formation_handlers.init()
        statistics.init()

        # Construct flight list
        planes = generators.get_via_stdin()

        # Allocate hubs to flights
        for flight in planes:

            # Assign hub by injecting into route
            flight.route.waypoints = [
                flight.route.waypoints[0], hub, flight.route.waypoints[1]
            ]

            flight.route.init_segments()

        for flight in planes:
            sim.events.append(sim.Event('aircraft-init', flight, 0))

        sim.run()

        # Prepare data matrix
        d = {
            'hub_lat':
            hub.lat,
            'hub_lon':
            hub.lon,
            'distance_total':
            float(statistics.vars['distance_total']),
            'distance_formation':
            float(statistics.vars['distance_formation']),
            'distance_solo':
            float(statistics.vars['distance_solo']),
            'formation_count':
            float(statistics.vars['formation_count']),
            'formation_success_rate':
            float(statistics.vars['formation_success_rate']),
            'alpha_eff':
            float(statistics.vars['alpha_effective']),
            'distance_success_rate':
            float(statistics.vars['distance_success_rate']),
            'avg_formation_size':
            float(statistics.vars['avg_formation_size']),
            'fuel_saved':
            float(statistics.vars['fuel_saved']),
            'distance_penalty':
            float(statistics.vars['distance_penalty']),
        }

        sink.push(d)
        debug.print_dictionary(d)