This section contains material for download, such as the simulator or documents.

Complete simulator

The simplest way to run the application is to download the whole ns-3 simulator (version 3.9) containing the code of the modified mobility simulator, building it and run the included example (bzip2 compressed archive).

To run the simulation you have to extract the archive, configure and build ns-3 and finally run the simulation:

tar xjf ns-3.9-vanet.tar.bz2
cd ns-3.9-vanet
CXXFLAGS="-Wno-error" ./waf -d optimized --disable-examples \
    --disable-python configure
./waf build

These five commands build and run a simulation example. The build step could take a few minutes, since the ns-3 simulator is quite big. Notice that the simulator is not installed anywhere: the binaries remains in the original folder.

The example emulates an emergency brake on a highway and manages potential crashes (without any kind of wireless communication, to speed up the simulation). The results will be written inside the "result" folder in which, at the end of the simulation, you will find the following files:

  • crashes_test.log: contains the traces of position, speed and acceleration of each vehicle recorded during the simulation;
  • crashes_test.distances: contains the distances between vehicles at the end of the simulation;
  • crashes_test.deceleration: contains the maximum deceleration reached by each vehicle;
  • crashes_test.crashes: contains the number of pile-ups and the number of vehicles involved in each pile-up;
  • crashes_test.crashinfo: contains more detailed information about crashes;
  • crashes_test.packets: contains the list of packet sent and received during the whole simulation (in this case it will be empty);
  • crashes_test.*msgcount: originally thought for some kind of network statistics, but they are running obsolete.

You can use this files to retrieve you statistics: the output format is described in ANOTHER section. I do not provide my own processing scripts since they are several and it would take too much to explain how to use them.

Once terminated this procedure, you are ready to start more complex simulations, or modify the source code to introduce your features. More details about simulation parameters are described in the Simulator usage section.

Simulator extension only

If you have the ns-3.9 simulator already built on your machine (I have not tested ns-3.10 yet), you probably would like to download and compile only the vehicular simulation application. I have posted the whole simulator because I have applied some minor patches in order to account for some little details that are not still included in ns-3 (e.g., considering processing delay at the MAC layer before passing the message at the upper level). Anyhow, these modifications SHOULD not make great differences w.r.t. the original simulator, but I cannot ensure it.

To compile only the application, download the sources and copy it inside your ns-3.9 folder. Type

cd path/to/ns-3.9/folder
tar xjf vanetyans-src.tar.bz2

to extract the sources and the script to run a simple example. Then modify your wscript file to tell ns-3.9 about the new application. Locate the bld.add_subdirs('utils') command and add bld.add_subdirs('vanetyans') below it. Finally, build and run the example application:

./waf build

Output files are described in the Complete simulator section.

VANET visualizer

Imagining what is happening during the simulation by looking at log traces is not very easy: I did it in this way at the beginning. Tired to read thousands of lines to understand what went wrong, I built a simple Java visualizer which shows the lanes and the vehicles moving in the highway (once the simulation is terminated).

New C version

I re-implemented the visualizer using C and OpenGL. Now, it is faster and less resource-consuming w.r.t. the old Java version. To build it, you need gcc and make tools, as well as OpenGL and GLUT libraries installed. Up to now it has been developed and tested on MacOS X 10.7 (Lion), but it should compile on every platform. For any issue, just write me an email.

To download the tarball archive, click here. Then, to build the source code, extract the files and type the make command:

tar xjf glvisualizer.tar.bz2
cd glvisualizer

Then to run the visualizer just type

./glvisualizer <log file>

The only parameter up to now is the log file. Starting the program can take a while if the log is big, but you will see the loading percentage in the command line before the application window opens. Then you can use the following keys to command the visualizer:

Key Description
6 and 5 Forward and reverse play at 1x
7 and 4 Forward and reverse play at 2x
8 and 3 Forward and reverse play at 5x
9 and 2 Forward and reverse play at 10x
0 and 1 Forward and reverse play at 20x
p Pause playing
+ and - Move ahead/backward of 1 second

Old Java version

I provide you the jar file (vanet.jar), if you simply want to run the visualizer, and the source code (vanetvisualizer.tar.bz2) if you want to modify it (forgive me if the code is not well documented). The jar file should work on every OS (somebody say that Java is multiplatform): if not you can build it from sources either by using the provided shell script

tar xjf vanetvisualizer.tar.bz2
cd vanetvisualizer

or manually

tar xjf vanetvisualizer.tar.bz2
cd vanetvisualizer
javac -d bin src/vanet/
jar cvfm vanet.jar MANIFEST.MF -C bin vanet

To run the visualizer just type

java -jar vanet.jar <log file> <start meters> <time multiplier>

The first parameter is the log file (use crashes_test.log, for example), the second one is the position (in meters) you want the visualizer to start to display (if you use 4000, the visualizer will show you the portion of the highway from km 4 to the furthest position reached) while the third is the time multiplier (if you set 2, every second of the simulation will last half a second in the visualizer).