• 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>  
  • 相关阅读:
    UVa 1451 Average (斜率优化)
    POJ 1160 Post Office (四边形不等式优化DP)
    HDU 3507 Print Article (斜率DP)
    LightOJ 1427 Substring Frequency (II) (AC自动机)
    UVa 10245 The Closest Pair Problem (分治)
    POJ 1741 Tree (树分治)
    HDU 3487 Play with Chain (Splay)
    POJ 2828 Buy Tickets (线段树)
    HDU 3723 Delta Wave (高精度+calelan数)
    UVa 1625 Color Length (DP)
  • 原文地址:https://www.cnblogs.com/cyf1995/p/6595457.html
Copyright © 2020-2023  润新知