Tools / Utilities
Several tools are included within the WSNet distribution:
- wsnet-topogen: a topology generator
- wsnet-replay: a useful tool allowing to play offline a simulation
- map2png: a matlab script generating a png picture from a map (e.g., energy map)
- maps2video: a matlab script generating an avi video from a sequence of maps (e.g., sequence of energy maps)
- wsnet-run-simulations: a shell script that runs a batch of simulations from a same scenario or multiple scenarios but with different random seeds and stores the generated log files within a specified directory for analysis
wsnet-topogen: description and usage
Once WSNet is properly installed within the /usr/local/wsnet2.0/ directory, one can run the topogen utility by typing the following command:
$ /usr/local/wsnet-2.0/bin/wsnet-topogen
If the WSNet install directory is already included in the PATH, one can directly type the following command:
$ wsnet-topogen
The purpose of topogen is the generation of random geometric graphs which can be used by the WSNet simulator for scenarios with static node positions. The main options are (type wsnet-topogen --help for a more complete list):
- --topo: topology parameters (shape, size and coverage area)
- --distribution: node distribution (static nbr of nodes, or uniform Poisson point process)
- --effect: to performs effects on the obtained graph (hole, clusters, ...)
- --output: output graph filename
- --outputformat: output graph format (wsnet 1.0, wsnet 2.0, user defined, ...)
- --gpreview: graphical preview of the generated graph
Here are some examples:
Rectangular area of size 500x300 with a uniform node distribution according to a PPP of intensity 0.01 (screenshot 1):
$ wsnet-topogen --topo rect 500 300 20 --distribution uniform 0.01 --output graph.data
Square area of size 400x400 with 2000 nodes distributed uniformly and randomly at the exception of 6 holes of radius 30 (screenshot 2):
$ wsnet-topogen --topo square 400 20 --distribution static 2000 --effect hole 6 30 --output graph.data
Circular area of radius 200 with a uniform node distribution according to a PPP of intensity 0.008 together with 4 clusters of size 50 and a node density of 0.05 (screenshot 3):
$ wsnet-topogen --topo circle 200 20 --distribution uniform 0.008 --effect cluster 4 50 0.05 --output graph.data
Output format:
By default topogen uses the WSNet 2.0 format as follows:
0 148.427 54.330 01 368.821 237.280 0
2 202.109 363.953 0
3 319.671 86.659 0
...
where the columns represent the node id and the (x,y,z) positions, respectively. It is possible to adopt a user-defined format for using the obtained graph with other simulators. For example:
- --outputformat "x#\t#y": will produce a file with two columns representing the (x,y) positions (real numbers)
- --outputformat "xi# #yi# #zi": will produce a file with three columns representing the (x,y,z) positions (integers)
wsnet-replay: description and usage
wsnet-replay is a graphical tool that replays offline a simulation scenario:

Once a simulation scenario is finished, one can replay the simulation by typing the following command:
$ wsnet-replay [log-filename] [zoom]
The log-filename must contain the output generated by WSNet with only the LOG_REPLAY macro defined. Please refer to the FAQ for more details on WSNet logs.
[ Back to Top ]
Matlab scripts
Several matlab scripts are included in the WSNet distribution. They can be used for statistical analysis.

When performing a simulation using WSNet it is possible to use a monitor entity to log periodically the network parameters (e.g., energy consumption, active nodes, ...). The obtained log files can then be analysed using the matlab scripts.
For example: from the log files generated by the nrj monitor entity, one can generate an avi video showing the evolution of energy consumption by running the following command on matlab (view video screenshot):
>> maps2video('./log/','energymap','video.avi', 0, 50000, 1000, 400)
This command generates an avi video showing the evolution of the network energy distribution from 0s to 50s with a period of 1s and an area size of 400x400. Please refer to the FAQ for a detailed description of these scripts usage.
[ Back to Top ]wsnet-run-simulations: description and usage
wsnet-run-simulations is a shell script that runs a batch of simulations from a same scenario or from multiple scenarios but with different random seeds and stores the log files within a specified directory for further analysis. This script can be used as follows:
$ wsnet-run-simulations [option] [config-file/directory] [output-directoy] [simulation-number]
where:
- option: -f for specifying a single scenario, or -d to specify a directory containing a list of scenarios
- config-file/directory: if the -f option is used, this parameter represent the name of the xml config file. Otherwise, if the -d is used, this parameter represent the name of directory containing the xml files.
- output-directory: for storing the generated log files
- simulation-number: number of simulations to run
[ Back to Top ]