mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-21 19:16:30 +00:00
Changed files structure
This commit is contained in:
parent
8a4e6dca4f
commit
f741e76454
@ -85,7 +85,8 @@ class Config:
|
||||
:param simulation_dir: The path to the simulation directory
|
||||
:return:
|
||||
"""
|
||||
simdir = f'files/simulations/{simulation_dir}/'
|
||||
simdir = os.path.join(os.path.dirname(__file__),f'{simulation_dir}')
|
||||
|
||||
for f in os.listdir(simdir):
|
||||
if f.endswith('.sumocfg'):
|
||||
self._SUMOCFG = os.path.join(simdir, f)
|
||||
|
@ -112,7 +112,7 @@ class Data:
|
||||
:param dump_name: The name of your data dump
|
||||
:return:
|
||||
"""
|
||||
dump_dir = 'files/dump'
|
||||
dump_dir = f'{self.dir}/dump'
|
||||
if not os.path.exists(dump_dir):
|
||||
os.mkdir(dump_dir)
|
||||
|
||||
|
@ -61,12 +61,14 @@ class RunProcess(multiprocessing.Process):
|
||||
"""
|
||||
now = datetime.datetime.now()
|
||||
current_date = now.strftime("%Y_%m_%d_%H_%M_%S")
|
||||
|
||||
if not os.path.exists('files/logs'):
|
||||
os.makedirs('logs')
|
||||
|
||||
logdir = os.path.join(os.path.dirname(__file__), f'{self.data.dir}')
|
||||
|
||||
if not os.path.exists(logdir):
|
||||
os.makedirs(f'logs')
|
||||
|
||||
conf_name = self.config.config_filename.replace('.json', '')
|
||||
log_filename = f'files/logs/{self.data.dump_name}_{conf_name}_{current_date}.log'
|
||||
log_filename = f'{self.data.dir}/logs/{current_date}.log'
|
||||
|
||||
self.logger = logging.getLogger(f'{self.data.dir}_{conf_name}')
|
||||
self.logger.setLevel(logging.INFO)
|
||||
@ -188,7 +190,7 @@ def create_dump(dump_name, simulation_dir, areas_number):
|
||||
|
||||
|
||||
traci.start(sumo_cmd)
|
||||
if not os.path.isfile(f'files/dump/{dump_name}.json'):
|
||||
if not os.path.isfile(f'{simulation_dir}/dump/{dump_name}.json'):
|
||||
start = time.perf_counter()
|
||||
data = Data(dump_name, traci.simulation.getNetBoundary(), areas_number, simulation_dir)
|
||||
data.init_grid()
|
||||
|
Loading…
Reference in New Issue
Block a user