ns-2 code for Span

5/15/2005: I no longer work on Span and have not used the code in the past few years. But I received the following tar ball from Jim Lindeman (lindj at us dot ibm dot com). It is the Span code, plus 802.11 Power Saving Mode code, ported to ns 2.28, on a PC using Cygwin. I have not tested it.

Stuff posted before 2002

Unfortunately I don't have an exact snapshot of the code for the Mobicom 01 paper. But here are the versions that I do have:

1/16/2002

12/11/2001
11/15/2001, WINET paper snapshot

I have compiled and used the code on Linux and FreeBSD. You need to configure the ns distribution with tcl8.3.2, tk8.3.2, tclcl 1.0b10, and octl-1.0a6. To configure and build the distribution, do:

tar -xzvf ns.tar.gz
cd our-ns
autoheader
autoconf
./configure  --with-tcl=../tcl8.3.2 --with-tk=../tk8.3.2 --with-tclcl=../tclcl-1.0b10 --with-otcl=../otcl-1.0a6 --disable-static
gmake
You should of course replace paths to the Tcl, Tk, TclCl, and OTcl to those on your system. The compile should go smoothly on Linux and FreeBSD. Afterward, you should change cmu/span/sim/run{-span,-psm,}.pl scripts to have them point to the right ns binary. Then, the following command runs a simple scenario with span turned on:

cmu/span/sim/run-span.pl cmu/span/sim/scen/1000-1000-n120-0-t600-m1-p60-e0-r10.scen
Three output files should appear in /tmp

/tmp/cmu/span/sim/scen/1000-1000-n120-0-t600-m1-p60-e0-r10.scen-span.{out,stdout,tr}
The .tr file is the trace file. The .out contains all stderr outputs. And .stdout contains all stdout outputs. If you look at the .out file, you should be able to see nodes announce and withdraw themselves as coordinators.

The source files are in our-ns/cmu/span. spanagent.cc contains code for coordinator election, periodic broadcasts, sending and receiving packets, etc. The gfrt.cc file just implement geographic forwarding. The neibtab.{hh,cc} files contain the neighbor table implementation. The sim directory, cmu/span/sim contains a README file that descripts all the perl scripts in that directory.

We also modified cmu/mac-802_11.{cc,hh} to implement 802.11 PSM, along with some optimizations described in the Mobicom and WINET papers. In the run-2Mb.tcl file, called by run-span.pl, run-psm.pl, and run.pl, there are several variables that you can play with: usepsm turns on/off psm mode; usespan turns on/off span election; spanopt turns on/off the 802.11 PSM optimizations described in our papers. run-span.pl automatically turns on usepsm, usespan, and spanopt. run-psm.pl turns on usepsm, but leaves usespan and spanopt off. run.pl leaves all three off. In general, if you call

cmu/span/sim/run{-span,-psm,}.pl scen_file
then output files (.tr, .out, and .stdout) are dumped to
/tmp/scen_file.{tr,out,stdout}
For comparison, below are simulation results from running the 4 scenario files in cmu/span/sim/scen under 802.11, Span with 802.11 PSM, and just 802.11 PSM. In each simulation there were 120 nodes. 20 nodes were sender and receivers. these nodes were placed at random along two edges of the simulation area, and are inmobile. The rest of the 100 nodes were initially randomly placed in the simulation area. They move throughout the simulation at a maximum speed of 20 m/s and pause time of 60 seconds. Each simulation lasted 600 seconds. 20 CBR flows run across the simulation area, from a sender on one edge to a receiver on the other edge. Senders and receivers are coordinators automatically, while the rest of the 100 nodes go through the Span coordinator election process.
mode             scen     loss     lat  hops  power(mW)
-------------------------------------------------------
802.11 1150-1150-n120    0.013    24.8   6.2        885
psm    1150-1150-n120    0.016  1193.0   6.3        721
span   1150-1150-n120    0.006   139.4   7.2        421

802.11 1000-1000-n120    0.019    21.2   5.2        885
psm    1000-1000-n120    0.020   984.3   5.2        743
span   1000-1000-n120    0.008   121.8   6.1        393

802.11   750-750-n120    0.008    14.4   3.9        887
psm      750-750-n120    0.007   710.1   4.0        806
span     750-750-n120    0.002    63.8   4.6        350

802.11   600-600-n120    0.002     8.9   3.0        883
psm      600-600-n120    0.003   520.0   3.0        834
span     600-600-n120    0.001    40.9   3.6        333
If you have any questions, send email to benjie@lcs.mit.edu.