Exemple #1
0
    def __init__(self, name, timeout, useragent):
        '''
        Constructor
        '''
        frame_c = frame(time_step=timeout)
        frame_c.attach_app(CrawlerFrame(frame_c, name, useragent))

        frame_c.run_async()
        frame.loop()
    def __init__(self, address, port):
        '''
        Constructor
        '''
        frame_c = frame(address = "http://" + address + ":" + str(port) + "/", time_step = 1000)
        frame_c.attach_app(CrawlerFrame(frame_c))

        frame_c.run_async()
        frame.loop()
    def __init__(self):
        '''
        Constructor
        '''
        frame_c = frame(time_step=1000)
        frame_c.attach_app(LoadBalancer(frame_c))

        frame_c.run_async()
        frame.loop()
Exemple #4
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(address="http://ucigridb.nacs.uci.edu:12000", time_step=1000)
        frame_car.attach_app(TrafficSimulation2(frame_car))

        frame_car.run_async()

        frame.loop()
Exemple #5
0
    def __init__(self, args):
        '''
        Constructor
        '''
        frametest = frame(time_step=200)
        frametest.attach_app(TestSimulation(frametest))

        frametest.run_async()

        frame.loop()
    def __init__(self, args):
        '''
        Constructor
        '''
        frameos = frame(time_step=200)
        frameos.attach_app(OpenSimPuller(frameos, args))

        frameos.run_async()

        frame.loop()
Exemple #7
0
    def __init__(self, args):
        '''
        Constructor
        '''
        frameos = frame(time_step=200)
        frameos.attach_app(OpenSimPuller(frameos, args))

        frameos.run_async()

        frame.loop()
    def __init__(self, args):
        '''
        Constructor
        '''
        frametest = frame(time_step=200)
        frametest.attach_app(TestSimulation(frametest))

        frametest.run_async()

        frame.loop()
Exemple #9
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(address="http://ucigridb.nacs.uci.edu:12000",
                          time_step=1000)
        frame_car.attach_app(TrafficSimulation2(frame_car))

        frame_car.run_async()

        frame.loop()
Exemple #10
0
    def __init__(self):
        '''
        Constructor
        '''
        framenode = frame("http://ucigridb.nacs.uci.edu:12000/", time_step=200)
        framenode.attach_app(NodeSimulation(framenode))

        # frametest = frame(time_step=200)
        # frametest.attach_app(NodeTestSimulation(frametest))

        framenode.run_async()
        # frametest.run_async()

        frame.loop()
Exemple #11
0
    def __init__(self):
        '''
        Constructor
        '''
        framenode = frame(time_step=200)
        framenode.attach_app(NodeSimulation(framenode))

        frametest = frame(time_step=200)
        frametest.attach_app(NodeTestSimulation(frametest))

        framenode.run_async()
        frametest.run_async()

        frame.loop()
Exemple #12
0
    def __init__(self):
        '''
        Constructor
        '''
        framenode = frame("http://ucigridb.nacs.uci.edu:12000/", time_step=200)
        framenode.attach_app(NodeSimulation(framenode))

        # frametest = frame(time_step=200)
        # frametest.attach_app(NodeTestSimulation(frametest))

        framenode.run_async()
        # frametest.run_async()

        frame.loop()
Exemple #13
0
    def __init__(self):
        frame_car = frame(time_step=1000)
        frame_car.attach_app(TrafficSimulation(frame_car))

        frame_node = frame(time_step=1000)
        frame_node.attach_app(NodeSimulation(frame_node))

        frame_request = frame(time_step=1000)
        frame_request.attach_app(ReqSimulation(frame_request))

        frame_car.run_async()
        frame_node.run_async()
        frame_request.run_async()

        frame.loop()
Exemple #14
0
    def __init__(self):
        '''
        Constructor
        '''
        framenode = frame(time_step=200, instrument=True)
        framenode.attach_app(NodeSimulation(framenode))

        frametest = frame(time_step=200, instrument=True)
        frametest.attach_app(NodeTestSimulation(frametest))

        si.setup_instruments(frame.framelist)

        framenode.run_async()
        frametest.run_async()

        frame.loop()
Exemple #15
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(time_step = 1000, wire_format = 'bson')
        frame_car.attach_app(TrafficSimulation(frame_car))

        frame_ped = frame(time_step = 1000)
        frame_ped.attach_app(PedestrianSimulation(frame_ped))

        gfx_frame = frame(time_step = 500)
        gfx_frame.attach_app(GFXSimulation(gfx_frame))

        frame_car.run_async()
        frame_ped.run_async()
        gfx_frame.run_main()

        frame.loop()
Exemple #16
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(time_step=1000)
        frame_car.attach_app(TrafficSimulation(frame_car))

        frame_ped = frame(time_step=1000)
        #frame_ped.attach_app(PedestrianSimulation(frame_ped))

        con_frame = frame(time_step=500)
        #con_frame.attach_app(ConsoleSimulation(con_frame))

        frame_car.run_async()
        #frame_ped.run_async()
        #con_frame.run_async()

        frame.loop()
Exemple #17
0
    def __init__(self):
        '''
        Constructor
        '''
        # framenode = frame(time_step=200)
        # framenode.attach_app(NodeSimulation(framenode))
        # http://127.0.0.1:12000 ,  http://ucigridb.nacs.uci.edu:12000
        frame_car = frame(time_step=600,
                          address='http://ucigridb.nacs.uci.edu:12000')
        frame_car.attach_app(TrafficSimulationArchit(frame_car))

        # frame_ped = frame(time_step = 1000)
        # frame_ped.attach_app(PedestrianSimulation(frame_ped))

        # gfx_frame = frame(time_step = 500)
        # gfx_frame.attach_app(GFXSimulation(gfx_frame))

        # framenode.run_async()
        frame_car.run_async()

        frame.loop()
Exemple #18
0
def Controller(settings):
    """
    Controller is the main entry point for driving the simulation.

    Arguments:
    settings -- nested dictionary with variables for configuring the connectors
    """

    laysettings = LayoutSettings.LayoutSettings(settings)
    # laysettings = None
    # load the world
    infofile = settings["General"].get("WorldInfoFile", "info.js")
    logger.info('loading world data from %s', infofile)
    world = WorldInfo.WorldInfo.LoadFromFile(infofile)
    # world = None

    cnames = settings["General"].get("Connectors",
                                     ['sumo', 'opensim', 'social', 'stats'])
    instrument = settings["General"].get("Instrument", False)
    profiling = settings["General"].get("Profiling", False)
    store_type = settings["General"].get("Store", "SimpleStore")
    process = settings["General"].get("MultiProcessing", False)
    timer = settings["General"].get("Timer", None)
    autostart = settings["General"].get("AutoStart", False)
    if timer:
        seconds = 0
        minutes = 0
        hours = 0
        if "Seconds" in timer:
            seconds = timer["Seconds"]
        if "Minutes" in timer:
            minutes = timer["Minutes"]
        if "Hours" in timer:
            hours = timer["Hours"]
        timer = datetime.timedelta(seconds=seconds,
                                   minutes=minutes,
                                   hours=hours)

    connectors = []
    for cname in cnames:
        if cname not in _SimulationControllers:
            logger.warn('skipping unknown simulation connector; %s' % (cname))
            continue

        cframe = frame(time_step=200,
                       instrument=instrument,
                       profiling=profiling)
        connector = _SimulationControllers[cname](settings, world, laysettings,
                                                  cname, cframe)
        cframe.attach_app(connector)
        connectors.append(cframe)

    if instrument:
        si.setup_instruments(connectors)

    for f in connectors:
        f.run_async()

    frame.loop()
    print "closing down controller"
    sys.exit(0)