Esempio n. 1
0
    def __init__(self, detached):
        # simmode
        self.mode = self.init

        self.simt = 0.0  # Runtime
        self.tprev = 0.0
        self.syst0 = 0.0
        self.simdt = 0.0
        self.syst = 0.0  # system time

        # Simulated UTC clock time
        self.utc = datetime.datetime.utcnow().replace(hour=0,
                                                      minute=0,
                                                      second=0,
                                                      microsecond=0)

        # Directories
        self.datadir = "./data/"
        self.dts = []

        # Fixed dt mode for fast forward
        self.ffmode = False  # Default FF off
        self.fixdt = 0.1  # Default time step
        self.ffstop = -1.  # Indefinitely

        # Simulation objects
        print("Setting up Traffic simulation")
        self.metric = Metric()

        # Additional modules
        self.telnet_in = StackTelnetServer()
Esempio n. 2
0
    def __init__(self):
        # simmode
        self.mode = self.init

        self.simt = 0.0  # Runtime
        self.tprev = 0.0
        self.syst0 = 0.0
        self.simdt = 0.0
        self.syst = 0.0  # system time

        self.deltclock = 0.0  # SImulated clock time at simt=0.
        self.simtclock = 0.0

        # Directories
        self.datadir = "./data/"
        self.dts = []

        # Fixed dt mode for fast forward
        self.ffmode = False  # Default FF off
        self.fixdt = 0.1  # Default time step
        self.ffstop = -1.  # Indefinitely

        # Simulation objects
        print("Setting up Traffic simulation")
        self.metric = Metric()

        # Additional modules
        self.telnet_in = StackTelnetServer()
Esempio n. 3
0
def MainLoop():
    if node_only:
        runNode()

    else:
        # ======================================================================
        # Create gui and simulation objects
        # ======================================================================
        global navdb, manager, gui
        manager   = MainManager()
        gui       = Gui()
        navdb     = Navdatabase('global')  # Read database from specified folder
        telnet_in = StackTelnetServer()
        sim 	  = Simulation(manager)

        # Initialize the gui (loading graphics data, etc.)
        gui.init(navdb)

        # Start the node manager
        manager.start()

        # Start the telnet input server for stack commands
        telnet_in.listen(port=settings.telnet_port)

        # Start the gui
        gui.start()

        print 'Stopping telnet server.'
        telnet_in.close()

        # Close the manager, stop all nodes
        manager.stop()
        sim.quit()
        # ======================================================================
        # Clean up before exit. Comment this out when debugging for checking
        # variables in the shell.
        # ======================================================================
        del gui
        print 'BlueSky normal end.'
Esempio n. 4
0
def MainLoop():
    if settings.node_only:
        from bluesky.sim.qtgl import nodemanager as manager
        manager.run()

    else:
        # ======================================================================
        # Create gui and simulation objects
        # ======================================================================
        global gui
        manager = MainManager()
        gui = Gui()
        telnet_in = StackTelnetServer()

        # Initialize the gui (loading graphics data, etc.)
        gui.init()

        # Connect gui stack command to telnet_in
        telnet_in.connect(gui.win.console.stack)

        # Start the node manager
        manager.start()

        # Start the telnet input server for stack commands
        telnet_in.listen(port=settings.telnet_port)

        # Start the gui
        gui.start()

        print('Stopping telnet server.')
        telnet_in.close()

        # Close the manager, stop all nodes
        manager.stop()

        # ======================================================================
        # Clean up before exit. Comment this out when debugging for checking
        # variables in the shell.
        # ======================================================================
        del gui
        print('BlueSky normal end.')
Esempio n. 5
0
def MainLoop():
    if settings.node_only:
        from bluesky.sim.qtgl import nodemanager as manager
        manager.run()

    else:
        # ======================================================================
        # Create gui and simulation objects
        # ======================================================================
        global gui
        manager   = MainManager()
        gui       = Gui()
        telnet_in = StackTelnetServer()

        # Initialize the gui (loading graphics data, etc.)
        gui.init()

        # Connect gui stack command to telnet_in
        telnet_in.connect(gui.win.console.stack)

        # Start the node manager
        manager.start()

        # Start the telnet input server for stack commands
        telnet_in.listen(port=settings.telnet_port)

        # Start the gui
        gui.start()

        print('Stopping telnet server.')
        telnet_in.close()

        # Close the manager, stop all nodes
        manager.stop()

        # ======================================================================
        # Clean up before exit. Comment this out when debugging for checking
        # variables in the shell.
        # ======================================================================
        del gui
        print('BlueSky normal end.')
Esempio n. 6
0
def start():
    """
    Start BlueSky: Create gui and simulation objects
    """
    global gui
    telnet_in = StackTelnetServer()
    manager = MainManager(telnet_in)
    gui = Gui()

    # Initialize the gui (loading graphics data, etc.)
    gui.init()

    # Connect gui stack command to telnet_in
    telnet_in.connect(gui.win.console.stack)

    # Start the node manager
    manager.start()

    # Start the telnet input server for stack commands
    telnet_in.listen(port=bs.settings.telnet_port)

    return telnet_in, manager
Esempio n. 7
0
def MainLoop():
    if node_only:
        runNode()

    else:
        # ======================================================================
        # Create gui and simulation objects
        # ======================================================================
        global navdb, manager, gui
        manager   = MainManager()
        gui       = Gui()
        navdb     = Navdatabase('global')  # Read database from specified folder
        telnet_in = StackTelnetServer()

        # Initialize the gui (loading graphics data, etc.)
        gui.init(navdb)

        # Start the node manager
        manager.start()

        # Start the telnet input server for stack commands
        telnet_in.listen(port=settings.telnet_port)

        # Start the gui
        gui.start()

        print 'Stopping telnet server.'
        telnet_in.close()

        # Close the manager, stop all nodes
        manager.stop()

        # ======================================================================
        # Clean up before exit. Comment this out when debugging for checking
        # variables in the shell.
        # ======================================================================
        del gui
        print 'BlueSky normal end.'