1.使用python接口调用SUMO
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'")
sumoBinary = 'sumo-gui'
sumoConfig = [sumoBinary, '-c', 'netFile2/net_fixed2.sumocfg', "--tripinfo-output", "tripinfo.xml"]
traci.start(sumoConfig)
while traci.simulation.getMinExpectedNumber() > 0 :
traci.simulationStep()
traci.close()
SUMO config配置文件
- 自动每次sumo 仿真界面关闭
<gui_only>
<start value="true"/>
<quit-on-end value="true"/> # 这句话
</gui_only>
- 配置的路网文件和路由文件
<input>
<net-file value="net_fixed2.net.xml"/>
<route-files value="net_fixed2.rou.xml"/>
</input>
三级目录