1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-22 11:36:29 +00:00
sumo-emissions/sumo_project/config.py
2018-12-06 21:49:01 +01:00

62 lines
1.9 KiB
Python

"""
Global configuration for the simulation
"""
import os
import sys
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("please declare environment variable 'SUMO_HOME'")
_SUMOCMD = 'sumo' # use 'sumo-gui' cmd for UI
_SUMOCFG = "mulhouse_simulation/osm.sumocfg"
CELLS_NUMBER = 10
EMISSIONS_THRESHOLD = 500000
n_steps = 200
#Limit the speed into areas when the threshold is exceeded
limited_speed = 30
limit_speed_mode = False
#Decrease all traffic lights duration into the area when the threshold is exceeded
rf_trafficLights_duration = 1.4
adjust_traffic_light_mode = False
#Immediately delete all vehicles in the simulation area
remove_vehicles_mode = False
#Vehicles are routed according to the less polluted route (HEAVY)
weight_routing_mode = True
#Lock the area when the threshold is exceeded (NOT FIXED)
lock_area_mode = False
#Weight routing mode cannot be combinated with other actions
if weight_routing_mode:
limit_speed_mode = False
adjust_traffic_light_mode = False
sumo_binary = os.path.join(os.environ['SUMO_HOME'], 'bin', _SUMOCMD)
sumo_cmd = [sumo_binary, "-c", _SUMOCFG]
# Total of emissions of all pollutants in mg for n steps of simulation without locking areas
total_emissions200 = 43970763.15084749
total_emissions300 = 87382632.08217141
def get_basics_emissions():
if n_steps == 200:
return total_emissions200
if n_steps == 300:
return total_emissions300
def showConfig():
return (str(f'Grid : {CELLS_NUMBER}x{CELLS_NUMBER}\n')
+ str(f'step number = {n_steps}\n')
+ str(f'weight routing mode= {weight_routing_mode}\n')
+ str(f'limit speed mode = {limit_speed_mode}, limited speed to {limited_speed}\n')
+ str(f'adjust traffic light mode = {adjust_traffic_light_mode} , RF = {rf_trafficLights_duration}\n'))