文章目录
sumo环境变量设置
sumo1.7默认安装在c盘eclipse目录下。
用户变量添加SUMO_HOME。官网说明

注意事项
- 速度默认单位为m/s。 (recall that SUMO always uses m/s as the unit for speed, 36.11m/s ~ 130km/h)http://sumo.sourceforge.net/userdoc/Tutorials/Autobahn.html
路网配置
sumo仿真需要两个基本文件net.xml和rou.xml,即路网文件和车辆行为文件,在sumocfg配置文件中指定要用的net.xml文件和rou.xml文件即可运行仿真。路网net.xml文件生成有几种方法:
- OSM导出。在OSM官网下载需要仿真的路段,下载为osm格式,修改文件后缀名为xml,之后打开sumo命令行输入netconvert转换语句。
--ramps.guess猜测匝道。
netconvert --osm-files D:\sumo\3.osm.xml --ramps.guess -o D:\sumo\3.net.xml
- 编写nod.xml节点文件和edg.xml边文件,然后通过netconvert工具去将这两个文件结合成net.xml文件。
JOSM对地图进行清洗
交通需求建模
rou文件即交通需求建模,具体有几种方法。
route & trip
trip是车辆从一地到另一地,通过设定起始边edge、终止边edge和驶离时间。而route可以看作扩大的trip,不值包含车辆经过的第一条边和最后一条,而是包括车辆经过的所有边。route2trips.py可以将route拆分成trip。
输入数据方法
- 使用trip定义。每个trip包括the starting edge、 the ending edge and the departure time。
- 使用flow定义。与trip基本相同,但是可将有相同到达和离开边的车辆作为一个流处理。注意:如果使用每小时交通量来控制车辆数,最终仿真生成的结果会基本接近设定的每小时交通量。
- randomTrip,根据net.xml文件随机生成交通流,但是结果不一定真实。
-o是使用randomtrip脚本生成的是trip文件,参数添加-r则调用duarouter根据trip转为rou文件。
randomTrips.py -n D:\sumo\3.net.xml -o D:\sumo\3.trips.xml -e 3600 --trip-attributes="departLane=\"best\" departSpeed=\"max\" departPos=\"random\"" -r D:\sumo\3.rou.xml
流量路由分配
- OD2Tripseg
导入OD矩阵转为单个车辆行程trip。 - JTRrouter
基于交通流量和交叉口转向率计算路径。 - DUArouter
基于最短路径算法计算车辆路径。使用动态用户分配算法DUA达到用户均衡状态DUE。
duarouter将flow转rou - DFrouter
基于线圈数据计算车辆路径route。 - MArouter
计算宏观用户分配,可使用incremental、user equilibrium、stochastic user equilibrium三个选择。
检测线圈
<additional>
<inductionLoop id="myLoop1" lane="foo_0" pos="42" freq="900" file="out.xml"/>
<inductionLoop id="myLoop2" lane="foo_2" pos="42" freq="900" file="out.xml"

本文介绍SUMO交通仿真的环境变量设置、路网配置、交通需求建模等关键步骤,并详细讲解了不同仿真设置方法,包括路线文件生成、车辆属性设置、仿真运行配置等。
最低0.47元/天 解锁文章
674





