4/26/2007

NS-2.27+LEACH on Ubuntu 7.04 installation guide

Step 1: Download NS-2.27 allinone package, extract it
tar zxvf ns-allinone-2.27.tar.gz

Step 2: You need to apply a patch to ns-2.27 to make it works with gcc4.1. You can get the patch here
To apply the patch, type patch -p0 <ns-2.27-gcc410.patch in bash

Step 3 : Download LEACH code, extract it under ~ns-2.27/ directory.
tar zxvf mit.tar.gz

Step 4: Add the following line in ~ns2.27/mac/wireless-phy.cc, line 59, that is, after the line #define max(a,b) (((a)<(b))?(b):(a))
#define min(a,b) (((a)>(b))?(b):(a))

Step 5 : Install the LEACH code by following instructions below:
Step 5.1: Edit the Makefile as follows:
Add DMIT_uAMPS to the DEFINE list
Add -I./mit/rca -I./mit/uAMPS to the INCLUDE list
Add the following just prior to the line gaf/gaf.o \
mit/rca/energy.o mit/rca/rcagent.o \
mit/rca/rca-ll.o mit/rca/resource.o \

mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o \
Step 5.2
: Add the environmental variables to /etc/profile
export RCA_LIBRARY=$NS_HOME/ns-2.27/mit/rca
export uAMPS_LIBRARY=$NS_HOME/ns-2.27/mit/uAMPS

Step 5.3: source /etc/profile and clean up previous build
source /etc/profile
make clean

Step 5.4: Rebuild ns2, redirecting output
nohup make 2>error.log >make.log &

Step 6: Test default wireless demo and LEACH
./test

Step 7: Validate the full installation, redirect the output
nohup ./validate-full 2> validate.error >validate.log &

DONE, Enjoy!

没有评论: