Exemplo n.º 1
0
def test_model_with_tk_process_visualization(until=0.00001,
                                             factor=0.1,
                                             flow_speed=10**10):
    env = RealtimeEnvironment(factor=factor, strict=False)
    model = Model(env)
    canvas = model.initialize_tkinter_process_visualization(
        flow_speed=flow_speed)
    env.run(until=until)
    canvas.tk_gui.destroy()
    assert True
Exemplo n.º 2
0
def test_model_with_tk_tilemap_visualization(until=0.00001, factor=1 / 10**10):
    env = RealtimeEnvironment(factor=factor, strict=False)
    model = Model(env)
    canvas = model.initialize_tkinter_tilemap_visualization()
    env.run(until=until)
    canvas.tk_gui.destroy()
Exemplo n.º 3
0
def test_model_run_1_hour():
    env = Environment()
    model = Model(env)
    env.run(until=3600)
    assert model.T1.overall_count_in > 0
    assert model.movement.overall_count_in > 1
Exemplo n.º 4
0
def test_that_model_intializes():
    env = Environment()
    model = Model(env)
    assert model is not None
Exemplo n.º 5
0
def test_that_T1_receives_some_product():
    env = Environment()
    model = Model(env)
    env.run(until=1000)
    assert model.T1.overall_count_in > 0
Exemplo n.º 6
0
def test_that_model_produces_tuggers():
    env = Environment()
    model = Model(env)
    env.run(until=1)
    assert model.tugger_source.overall_count_in == model.tugger_source.max_entities
Exemplo n.º 7
0
def test_that_model_auto_wires_tugger_sources():
    env = Environment()
    model = Model(env)
    assert len(model.tugger_source.resource_types) == 2
Exemplo n.º 8
0
""" helper for logistics system analysis, calculates weighted average distances """

from simpy import Environment

from tugger_src.gym_env.des_model.blocks.product_station import ProductStation
from tugger_src.gym_env.des_model.blocks.tugger_source import TuggerSource
from tugger_src.gym_env.des_model.model import Model

model = Model(Environment())

coordinates_holder = model.coordinates_holder

location_names_list = [
    coordinates_holder.get_location_name_by_index(i) for i in range(0, 11)
]
print("\nlocations:")
print(location_names_list)
# ['A', 'B', 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9']
print("\ndistance units (px)")

sources = model.blocks_dict[TuggerSource]
sources = sorted(sources, key=lambda b: b.name)

stations = model.blocks_dict[ProductStation]
stations = sorted(stations, key=lambda b: b.name)

# e.g. "T1" : 1.5
station_consumptions = {
    station.name: station.consumed_per_product for station in stations
}
avg_consumption_per_product_per_station = sum(station_consumptions.values()) / len(
Exemplo n.º 9
0
 def setup_sim(self):
     env = self.environment_factory.create_env()
     self.model = Model(env)