2018-11-23 12:53:20 +00:00
|
|
|
"""
|
|
|
|
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
|
|
|
|
|
2018-12-03 20:05:01 +00:00
|
|
|
#Vehicles are routed according to the less polluted route
|
2018-11-23 18:40:14 +00:00
|
|
|
weight_routing_mode = False
|
2018-12-03 20:17:19 +00:00
|
|
|
|
|
|
|
#Limit the speed into areas when the threshold is exceeded
|
|
|
|
limited_speed = 30
|
|
|
|
limit_speed_mode = True
|
|
|
|
|
2018-12-03 20:05:01 +00:00
|
|
|
#Decrease all traffic lights duration into the area when the threshold is exceeded
|
|
|
|
rf_trafficLights_duration = 0.2
|
2018-11-23 18:40:14 +00:00
|
|
|
adjust_traffic_light_mode = True
|
2018-11-23 12:53:20 +00:00
|
|
|
|
2018-12-03 20:05:01 +00:00
|
|
|
#Weight routing mode cannot be combinated with other actions
|
|
|
|
if weight_routing_mode:
|
|
|
|
limit_speed_mode = False
|
|
|
|
adjust_traffic_light_mode = False
|
|
|
|
|
2018-11-23 12:53:20 +00:00
|
|
|
sumo_binary = os.path.join(os.environ['SUMO_HOME'], 'bin', _SUMOCMD)
|
|
|
|
sumo_cmd = [sumo_binary, "-c", _SUMOCFG]
|
|
|
|
|
|
|
|
def showConfig():
|
|
|
|
return (str(f'Grid : {CELLS_NUMBER}x{CELLS_NUMBER}\n')
|
|
|
|
+ str(f'step number = {n_steps}\n')
|
2018-11-23 18:40:14 +00:00
|
|
|
+ str(f'limit speed mode = {limit_speed_mode}\n')
|
|
|
|
+ str(f'weight routing mode= {weight_routing_mode}\n')
|
2018-12-03 20:05:01 +00:00
|
|
|
+ str(f'adjust traffic light mode = {adjust_traffic_light_mode} , RF = {rf_trafficLights_duration}\n'))
|
2018-11-23 12:53:20 +00:00
|
|
|
|