zoukankan      html  css  js  c++  java
  • ns3_sumo环境搭建与学习1:sumo 安装与入门

    一、安装sumo

    安装用apt-get就行:

    sudo apt-get install sumo sumo-tools sumo-doc

    测试

    输入sumo:出现sumo版本信息

    输入sumo-gui:出现sumo的运行界面

    二、使用sumo

    http://blog.csdn.net/sxsj333/article/details/22855555

    参考这个博客下的2和3

    1.产生地图:MySUMONet.net.xml

    用nod和edg文件(描述点和边的文件)生成地图MySUMONet.net.xml,用sumo-gui (ctr+N)打开就是地图了

    netconvert --node-files=ex_NODE.nod.xml --edge-files=ex_EDGE.edg.xml --output-file=MySUMONet.net.xml

    2.产生车辆移动模型:ex_ROU.rou.xml 

    2.1.指定起止点duarouter 

    用flow文件和前面生成的net文件产生车辆移动模型 ex_ROU.rou.xml 

    duarouter -n MySUMONet.net.xml -f ex_FLOW.flow.xml -o ex_ROU.rou.xml 

    ex_FLOW.flow.xml:重要的参数,end=10000,number=100 表示在10000个时间单位内,流出100辆车,也就是每隔100个时间单位流出一辆车

    由于速度太快,需要设置Delay才能够观察到结果

    <flows>   
    <flow id="flow0" from="edgeD-2-0" to="edgeD-0-2" begin="0" end="10000"   
    number="100" />   
    </flows>  

     2.2.指定路口转弯概率jtrrouter

    sudo jtrrouter --sinks="edgeD-0-2" --flows=ex_FLOW.flow.xml --turn-defaults 65,30,5 --net=MySUMONet.net.xml --output-file=1.rou.xml -b ${begin} -e ${end}
    --turn-defaults 65,30,5 表示三个后继街道的情况下选择最右街道的概率是65%,

    3.配置:ex_SUMO.sumo.cfg

    将以上文件整合到一起的是配置文件,然后(ctr+O)打开就可以进行仿真了

    这里10000是整个仿真的总时间

    <configuration>  
      
        <input>  
          <net-file value="/home/song/sumoworkspace/move/MySUMONet.net.xml"/>  
          <route-files value="/home/song/sumoworkspace/move/ex_ROU.rou.xml"/>  
          <additional-files value=""/>  
          <junction-files value=""/>  
        </input>  
      
        <output>  
          <netstate-dump value="/home/song/sumoworkspace/move/ex_sumo.sumo.tr"/>  
          <tripinfo-output value="output-tripinfos.xml"/>  
          <emissions-output value="output-emissions.xml"/>  
          <vehroute-output value="output-vehroutes.xml"/>  
        </output>  
      
        <time>  
          <begin value="0"/>  
          <end value="10000"/>  
          <time-to-teleport value="-1"/>  
          <srand value="23423"/>  
          <route-steps value="-1"/>  
        </time>  
      
        <reports>  
           <print-options value="false"/>  
        </reports>  
      
    </configuration>  
  • 相关阅读:
    树莓派安装aria2轻松下载小资源
    利用树莓派3搭建可以发射无线局域网的微型服务器
    Vue语法
    redis-cluster集群
    分布式锁
    Redis--消息队列
    设计模式---享元模式
    设计模式(单例模式+原型模式)+ c#的内存分配机制
    MVC的ActionFilter
    MVC异常处理的7大场景 + MVC的异常处理的过滤器 + 全局异常
  • 原文地址:https://www.cnblogs.com/cyf1995/p/6595457.html
Copyright © 2011-2022 走看看