Sumo生成数据

1.生成input_net.net.xml文件

参数解释:http://www.sumo.dlr.de/userdoc/NETGENERATE.html#Grid_Network

1).生成grid network

F:/Tools/sumo-0.24.0/bin/netgenerate --grid --grid.number=5 --grid.length=1000 -L 5 --output-file=input_net.net.xml --no-internal-links true -j traffic_light -S 20

  该命令生成了各方向均有5个节点的网络,其中每一段路的长度为1000m,有5个车道,默认车速为20m/s,路的交汇处有交通信号灯。

F:/Tools/sumo-0.24.0/bin/netgenerate --grid --grid.x-number=5 --grid.y-number=6 --grid.y-length=1000 --grid.x-length=800 -L 4 -S 12 --output-file=input_net.net.xml    

  该命令生成了x方向有5个节点,每段路的长度为800m;y方向有6个节点,每段路的长度为1000m。每段路有4个车道,默认车速为12m/s。

2).生成random network

F:/Tools/sumo-0.24.0/bin/netgenerate --rand -o input_net.net.xml --rand.iterations=200

 

2.生成旅行信息trips.trips.xml

参数解释:http://www.sumo.dlr.de/userdoc/Tools/Trip.html#randomTrips.py

python F:/Tools/sumo-0.24.0/tools/randomTrips.py -n input_net.net.xml -e 10 -p 0.01

  该命令表示,旅行信息在0-10秒内生成,每0.01秒生成一个轨迹。

python F:/Tools/sumo-0.24.0/tools/randomTrips.py -n input_net.net.xml -e 10 -p 0.2 --trip-attributes="departLane=\"best\""

  该命令表示,旅行信息在0-10秒内生成,每0.2秒生成一个轨迹,且开始的车道为“best”

  关于departLane等参数的具体解释:http://www.sumo.dlr.de/userdoc/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html

 

3.生成路径信息routes.rou.xml

官方解释:http://www.sumo.dlr.de/userdoc/DUAROUTER.html

F:/Tools/sumo-0.24.0/bin/duarouter --trip-files=trips.trips.xml --net-file=input_net.net.xml --begin=0 --end=12000 --output-file=routes.rou.xml 

F:/Tools/sumo-0.24.0/bin/duarouter --trip-files=trips.trips.xml --net-file=input_net.net.xml --additional-files=type.add.xml --begin=0 --end=600 --output-file=routes.rou.xml

 

4.生成仿真轨迹信息fcdoutput.xml
F:/Tools/sumo-0.24.0/bin/sumo -c cfg.sumocfg --fcd-output fcdoutput.xml

cfg.sumocfg:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 
 3 <configuration>
 4 
 5     <input>
 6         <net-file value="input_net.net.xml"/>
 7         <route-files value="routes.rou.xml"/>
 8     </input>
 9 
10     <time>
11         <begin value="0"/>
12         <end value="600"/>
13     </time>
14 
15 </configuration>

 

5.osm文件转换成net.xml

F:/Tools/sumo-0.24.0/bin/netconvert --osm-files map.osm.xml -o map.net.xml

在将osm文件转换为net.xml文件的过程中,有可能会遇到大量相邻的交点,可采用--junctions.join true进行合并。

对于某些速度较低的路段,可以使用--keep-edges.min-speed <FLOAT> 去除这些路段。

posted @ 2017-07-03 19:22  Sindyang  阅读(3284)  评论(4编辑  收藏  举报