The SWAN
simulator environment requires the ns-2
simulater version 2.1b9a. The ns-2 simulator runs under UNIX (e.g., Linux,
FreeBSD, SunOS, Solaris) and Window
environments. Simple scenarios run on any reasonable machine, but
very large scenarios benefit from large amounts of memory.
To install
the ns-2 simulator, you need a computer and a C++ compiler.
2.2 Download
SWAN ( ns-swan.tar.gz
) and place it in the 'ns-2 home directory' (e.g., for version
2.1b9a, ns-allinone-2.1b9a/ns-2.1b9a is the ns-2 home directory) and
unpack :
tarxvfz ns-swan.tar.gz
The
following files should be visible:
<ns-2 home directory>/common/ip.h
<ns-2 home directory>/common/packet.h
<ns-2 home directory>/mac/ll.cc
<ns-2 home directory>/mac/ll.h
<ns-2 home directory>/mac/mac-802_11.cc
<ns-2 home directory>/mac/mac-802_11.h
<ns-2 home directory>/swan/run
<ns-2 home directory>/swan/swan.tcl
<ns-2 home directory>/swan/mobility.tcl
<ns-2 home directory>/swan/traffic.tcl
<ns-2 home directory>/swan/swan_ac.cc
<ns-2 home directory>/swan/swan_ac.h
<ns-2 home directory>/swan/swan_rc.cc
<ns-2 home directory>/swan/swan_rc.h
<ns-2 home directory>/tcl/lib/ns-default.tcl
<ns-2 home directory>/tcl/lib/ns-mobilenode.tcl
<ns-2 home directory>/tcl/lib/ns-packet.tcl
<ns-2 home directory>/trace/cmu-trace.cc
2.3 Modify
Makefile in ns-2 home directory
Add object
files swan_ac.o and
swan_rc.o to the list of object files as
follows :
OBJ_CC = \
tools/random.o
tools/rng.o ....
...
swan/swan_ac.o
swan/swan_rc.o \
...
2.4 Compile SWAN Simulator
make clean; make
3. Running SWAN Simulator
To run SWAN
simulator, go to swan directory ( <ns-2
home directory>/swan/ ) and type
run
Then a
simple simulation example described below will be run.
This example
script runs ns-2 using AODV routing protocol (-rp)
for scenario (-sc) 670m (-x) by 670m (-y) simulation network size
with communication pattern (-cp). This example simulation will run
for 100 seconds (-stop) and produces output trace files
AODV.tr (-tr)
and AODV.nam (-nam).
SWAN output result files are produced under ./result
directory (-dir). The delay* files records the
measured packet delays. The first column represents the time (in the simulation) that the delay is measured. The second column represents the measured packet delay.
The rate* files records the shaping
rate and the actual transmission rate to show how the SWAN rate
controller works. The first column represents the time (in the simulation). The second column represents the shaping rate. The third column represents the actual transmission rate.
The util* files
records the measured real-time traffic rate to show how the SWAN
admission controller works. The first column represents the time (in the simulation). The second column represents the real-time traffic rate. The numbers in the file names represent the node id. For example, delay3 represents the packet delays measured in node 3.
To change
the parameters for SWAN, see <ns-2 home
directory>/swan/swan.tcl
4. Source code at a glance
File
Name
Description
run
executable file that runs SWAN simulator
swan.tcl
main tcl
file for SWAN
mobility.tcl
scenario
file that indicates location and mobility of mobile nodes
traffic.tcl
communication pattern file that specifies network traffic