# Sink data[(1, 'start_time')] = None data[(1, 'process_time')] = None data[(1, 'process')] = 'Sink' # Simulation Modeling env = simpy.Environment() model = {} # process_dict process_time = {"Process1": [5.0]} # server에 할당할 process time # Monitor filepath = './result/event_log_DD1_1.csv' Monitor = Monitor(filepath) Source = Source(env, 'Source', data, model, Monitor) for i in range(len(process_list) + 1): if i == len(process_list): model['Sink'] = Sink(env, 'Sink', Monitor) else: model['Process{0}'.format(i + 1)] = Process(env, 'Process{0}'.format(i + 1), server_num, model, Monitor, process_time=process_time) start_sim = time.time() env.run(until=run_time) finish_sim = time.time()
Throughput_graph = True save_graph = True if save_graph: save_path = './data/fitting_data' if not os.path.exists(save_path): os.makedirs(save_path) # samp_dist = functools.partial(random.expovariate, 1) samp_dist = 1 m_assy = 334 m_oft = 322 m_pnt = 263 Source = Source(env, "Source", data) Sink = Sink(env, "Sink", rec_lead_time=True, rec_arrivals=True) Assembly = Process(env, "Assembly", m_assy, qlimit=10000) # 조립 공정 작업장 수 = 200 Outfitting = Process(env, "Outfitting", m_oft, qlimit=10000) # 의장 공정 작업장 수 = 185 Painting = Process(env, "Painting", m_pnt, qlimit=10000) # 도장 공정 작업장 수 = 155 Monitor1 = Monitor(env, Assembly, samp_dist) Monitor2 = Monitor(env, Outfitting, samp_dist) Monitor3 = Monitor(env, Painting, samp_dist) Source.out = Assembly Assembly.out = Outfitting Outfitting.out = Painting
parts.append(Part(df.index[i], df.iloc[i])) # Modeling env = simpy.Environment() ## process_list = list(data.drop_duplicates(['process1'])['process1']) process_list += list(data.drop_duplicates(['process2'])['process2']) model = {} server_num = [1 for _ in range(len(process_list))] filepath = '../result/event_log_supply_chain.csv' Monitor = Monitor(filepath) Source = Source(env, parts, model, Monitor) # process modeling for i in range(len(process_list) + 1): if i == len(process_list): model['Sink'] = Sink(env, Monitor) else: model[process_list[i]] = Process(env, process_list[i], server_num[i], model, Monitor, capacity=1) # Simulation start = time.time() # 시뮬레이션 실행 시작 시각 env.run() finish = time.time() # 시뮬레이션 실행 종료 시각 print('#' * 80) print("Results of simulation")
WIP_graph = True Throughput_graph = True save_graph = True if save_graph: save_path = './data/factory physics' if not os.path.exists(save_path): os.makedirs(save_path) # samp_dist = functools.partial(random.expovariate, 1) samp_dist = 1 m_1 = 1 m_2 = 1 Source = Source(env, "Source", data) Sink = Sink(env, "Sink", rec_lead_time=True, rec_arrivals=True) Process1 = Process(env, "Process1", m_1, qlimit=10000) # 조립 공정 작업장 수 = 200 Process2 = Process(env, "Process2", m_2, qlimit=10000) # 의장 공정 작업장 수 = 185 Monitor1 = Monitor(env, Process1, samp_dist) Monitor2 = Monitor(env, Process2, samp_dist) Source.out = Process1 Process1.out = Process2 Process2.out = Sink # Run it start = time.time() env.run() finish = time.time()