sumo运动文件导入ns3

来源:互联网 发布:怎么查找淘宝店铺 编辑:程序博客网 时间:2024/05/20 10:13

原网站链接:http://sumo.dlr.de/wiki/Tutorials/Trace_File_Generation

Simulation Scenario

For generating vehicular traces, You need a simulation scenario, consisting at least of a road network and routes. You may visit Tutorials/Hello Sumo orTutorials/Quick Start to learn how to get a scenario.

Generating a SUMO-trace

We assume You have the scenario and a configuration file named "myConfig.sumocfg". It may have a different name, of course. You should be able to start SUMO using Your configuration like this:

sumo -c myConfig.sumocfg

Now, we use the simulation to get an fcd output, a trace file in a SUMO-format. This file will be later converted into a trace file for one of the applications supported by Tools/TraceExporter. We generate an fcd output as following:

sumo -c myConfig.sumocfg --fcd-output sumoTrace.xml

And we will obtain the file "sumoTrace.xml".

Converting the Trace

We can now convert the vehicular traces in SUMO format into another format. For now, let's assume You would like to have a ns2 mobility file. We can generate one from the obtained fcd output using:

traceExporter.py --fcd-input sumoTrace.xml --ns2mobility-output ns2mobility.tcl   
这块要注意,生成的tcl和traceExporter.py放在同一目录下可能没有权限,因此应该把tcl放到其他文件,即给tcl文件加上文件路径(你想放文件的路径)

We obtain the file "ns2mobility.tcl", which we can give ns2 as input.

Further Possibilities

Output Options

Tools/TraceExporter generates files for ns2/ns3, OMNET, Shawn, and PHEM. Please visit the Tools/TraceExporter manual page for further information about how to generate these files. Look for "output options".

Different Penetration Rates

Tools/TraceExporter allows to define different equipment / penetration rates using the --penetration<FLOAT><FLOAT> will be the amount of vehicles that are exported, where 1 is equal to 100 %. This means, if You want to have 10 % of vehicles to show up in Your ns2-trace, use:

traceExporter.py --penetration 0.1 \ --fcd-input sumoTrace.xml --ns2-mobilityoutput ns2mobility.tcl

The --seed <FLOAT> allows You to give different random number initialisations for choosing the vehicles to export.


0 0
原创粉丝点击