示例#1
0
def test_process_nearest():
    mod = Nearest(_map)
    t = run_with_sim(SimpSim(False, mod),
                     products_todo=products_todo,
                     n_agv=4,
                     flow_lenght=flow_lenght)
    return t
示例#2
0
def test_benchmark():
    modules = [Random(_map), Nearest(_map), Cbsext(_map)]
    durations = np.zeros(len(modules))
    for i_mod in range(len(modules)):
        try:
            durations[i_mod] = run_with_sim(SimpSim(False, modules[i_mod]),
                                            products_todo=3,
                                            n_agv=2,
                                            flow_lenght=flow_lenght)
        except Exception as e:
            logging.error("Exception on simulation level\n" + str(e))
            raise e

    print("RESULT:\n for ..")
    print("modules: " + str(modules))
    print(durations)
示例#3
0
def testing(thread: SimpSim):
    width = 20
    height = 20

    time.sleep(.5)
    thread.start_sim(width, height, 3)

    time.sleep(.5)

    for i in range(4):
        thread.new_job(
            np.array([random.randint(0, width),
                      random.randint(0, height)]),
            np.array([random.randint(0, width),
                      random.randint(0, height)]), random.randint(0, 1000))
        time.sleep(.1)

    time.sleep(20)
    thread.stop_sim()
示例#4
0

if __name__ == '__main__':
    logging.info("__main__.py ...")

    # init switches
    msb = False
    test = False
    vis = False

    # module
    mod = Random()

    # sim
    msb = True
    simThread = SimpSim(msb, mod)
    simThread.start()

    # test
    test = True
    if test:
        threading.Thread(target=testing, args=(simThread, )).start()

    # vis
    vis = True
    if vis:
        app = QtGui.QApplication(sys.argv)
        window = Vis(sim_thread=simThread)
        window.show()
        sys.exit(app.exec_())