import sumolib, math
-import pandas as pd
-import numpy as np
-import os, glob
-from datetime import datetime
-
-### intersections
-intersections_path = os.path.join('daily/S_INT_CONFIG.csv')
-intersections = pd.read_csv(intersections_path)
-intersections_original = intersections.copy()
-
-# demo names
-demo_names = \
-["한솔삼거리(한솔마을3거리)",
-"느티마을4단지",
-"한솔6단지(정자동사무소)",
-"신기4거리",
-"느티마을4거리",
-"느티마을 안촌유치원",
-"상록마을 321동",
-"상록4거리(상록마을입구4거리)",
-"상록마을단일로",
-"상록마을302동 단일로"]
-intersections = intersections[intersections['INT_NAME'].isin(demo_names)]
-demo_node_ids = ["n0", "n1", "n2", "n3", "n4", "n5", "n6", "n7", "n8", "n9"]
-demo_int_nos = list(intersections['INT_NO'])
-
-# SUMO node_id 정보 추가
-name2node_id = dict(zip(demo_names, demo_node_ids))
-intersections['node_ids'] = intersections['INT_NAME'].map(name2node_id)
-
-# SUMO X, Y 좌표 정보 추가
-origin_name = '상록4거리(상록마을입구4거리)'
-ref_lng = intersections[intersections['INT_NAME'] == origin_name]['INT_LNG'].values[0]
-ref_lat = intersections[intersections['INT_NAME'] == origin_name]['INT_LAT'].values[0]
-intersections['X'] = (intersections['INT_LNG'] - ref_lng) * 111000 * math.cos(math.radians(ref_lat))
-intersections['Y'] = (intersections['INT_LAT'] - ref_lat) * 111000
-intersections.reset_index(drop=True, inplace=True)
-
-# n=ways 정보 추가 where "n지교차로"
-name2way = \
-{"한솔삼거리(한솔마을3거리)":3,
-"느티마을4단지":3,
-"한솔6단지(정자동사무소)":4,
-"신기4거리":4,
-"느티마을4거리":4,
-"느티마을 안촌유치원":2,
-"상록마을 321동":2,
-"상록4거리(상록마을입구4거리)":4,
-"상록마을단일로":2,
-"상록마을302동 단일로":2}
-intersections['ways'] = intersections['INT_NAME'].map(name2way)
-
-### phase_config
-phase_config_path = os.path.join('daily/S_INT_PHASE_CONFIG.csv')
-phase_config = pd.read_csv(phase_config_path)
-phase_config_original = phase_config.copy()
-phase_config = phase_config[phase_config['INT_NO'].isin(demo_int_nos)]
-
-# INT_NO, ways 가져옴
-phase_config = pd.merge(phase_config, intersections[['INT_NO', 'ways']], on='INT_NO', how='left')
-cols = phase_config.columns.tolist()
-cols.remove('ways')
-cols.insert(1, 'ways')
-phase_config = phase_config[cols]
-
-# 링번호 변경, 주현시여부, 황색시간, 최소녹색시간, 최대녹색시간 임의 지정
-phase_config['INT_RING'] = phase_config['INT_RING'].replace({0: 'A', 1: 'B'})
-phase_config['INT_MAIN_PHASE'] = np.where(phase_config['INT_PHASE_NO'] == 1, 20, 10)
-null_condition = phase_config['INT_FLOW_NO'] == 17
-phase_config['INT_YELLOW'] = np.where(null_condition, 0, 4)
-np.random.seed(0)
-phase_config['INT_MIN_SPLIT'] = np.where(~null_condition, np.random.randint(12, 41, size=len(phase_config)), phase_config['INT_MIN_SPLIT'])
-phase_config['INT_MAX_SPLIT'] = np.where(~null_condition, phase_config['INT_MIN_SPLIT'] + np.random.randint(5, 20, size=len(phase_config)) ,phase_config['INT_MAX_SPLIT'])
-phase_config.sort_values(by=['INT_NO', 'INT_PHASE_NO','INT_RING'], inplace=True)
-