其他分享
首页 > 其他分享> > SUMO简单使用

SUMO简单使用

作者:互联网

这里写自定义目录标题

学习目标:SUMO基础文件的生成

(1)新建一个文件夹,存放仿真文件

SUMO仿真至少需要rou.xml文件和net.xml文件,且必须保存在同一文件夹下。.sumocfg文件是SUMO可视文件,作用是将rou.xml和net.xml文件联系在一起。

在sumo安装目录下,新建一个project目录city,用于存放相关文件。

(2)在OpenStreetMap上导出想要仿真的地图

外部网址访问:https://www.openstreetmap.org/

搜索想要获取城市,点击导出按钮

然后点击“手动选择不同的区域”,可在地图上截取需要的区域

最后,点击蓝色的导出按键,即可得到map.osm文件

(3)W+R打开cmd模型,进入到文件夹city

输入命令:cd c:\sumo\project\city

cd c:\sumo\project\city

(4)将osm地图转换为.net.xml道路文件

输入命令:

C:\sumo\bin\netconvert --osm-files map.osm -o map.net.xml

C:\sumo\bin\netconvert --osm-files map.osm -o map.net.xml

(5)生成.trip文件

输入命令:

C:\sumo\tools\trip\randomTrips.py -n map.net.xml -l -e 600 -o map.trips.xml

python C:\sumo\tools\trip\randomTrips.py -n map.net.xml -l -e 600 -o map.trips.xml

(6)生成.roul文件

输入命令:

C:\sumo\bin\duarouter -n map.net.xml -t map.trips.xml -o map.rou.xml --ignore-errors

C:\sumo\bin\duarouter -n map.net.xml -t map.trips.xml -o map.rou.xml --ignore-errors

(7)生成.sumocfg文件

操作步骤:新建txt文件打开,复制一下代码到该文本文件中,然后另存为 map.sumocfg


<?xml version="1.0" encoding="UTF-8"?>
 
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.sf.net/xsd/sumoConfiguration.xsd">
 
    <input>
        <net-file value="map.net.xml"/>
        <route-files value="map.rou.xml"/>
    </input>
 
    <time>
        <begin value="0"/>
        <end value="10000"/>
    </time>
 
    <processing>
        <time-to-teleport value="-1"/>
    </processing>
    
</configuration>


标签:xml,map,文件,简单,SUMO,osm,使用,sumo,net
来源: https://blog.csdn.net/weixin_43544145/article/details/116949232