sumo第一篇---文件组成介绍

1、net.xml文件:

  bin文件夹下面有一个netconvert.exe文件,这个东西就是 用来转换net文件的。

  命令行如下:(用管理员身份打开cmd

  netconvert --osm-files myTest_china.osm -o  myTest.net.xml

  netcovert就是可执行文件是可执行文件,也可以说是转换工具

  --osm-files是输入部分,即输入osm类型文件,后面是文件名

  -o myTest.net.xml就是输出部分,-o是output的意思,表示这是输出文件

  执行过后,会发现多了一个文件,即获得了net.xml文件,也就是路网文件

2、rou.xml文件:

  1)、sumo\tools\trip文件夹下。名字叫做radomTrips.py。

  random就是随机的意思,而trip是SUMO中的一个术语,就是表示车 辆从一个条

  公路行驶到另外一条公路的过程。

     randomTrips.py -n myTest.net.xml -l -e 600 -o  myTest.trips.xml

  -n myTest.net.xml表示输入,-n表述输入的类型是net类 型,其实-n等价于--net,

  -n是一种简写的方式,后面的-l -e 600是随 机工具的配置。

  2)、这样的过程生成的是一个旅程随机过程文件,我们需要的 是一个rou.xml文件。

  要用到的工具是bin文件夹下的duarouter.exe

  把随机的旅程和道路信息结合起来就获得了车流文件 (rou.xml)

  duarouter -n myTest.net.xml -t myTest.trips.xml -o myTest.rou.xml --ignore-errors

  两个输入,一个输出

3.配置文件

  1)、写一个仿真的配置文件,可以被sumo-gui使用

  <configuration>
      <input>
          <net-file value="hello.net.xml"/>
          <route-files value="hello.rou.xml"/>
      </input>
      <time>
          <begin value="0"/>
          <end value="10000"/>
      </time>
    </configuration>

  将之前生成的 net.xml和rou.xml文件作为输入

  用sumo-gui打开 sumo.cfg文件之后,点击开始仿真(绿色)箭头,就可以的看到仿真

  效果了

  可能会速度较快无法看清效果,可以延迟时间为200,再局部放大某个道路,可以看清

  车的行驶

  

猜你喜欢

转载自www.cnblogs.com/dxsboke/p/11871781.html