The home directory of NS-2.34 is “/home/ns2/ns-allinone-2.34″
1. Download the package “ns-234-leach.tar.gz” into the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
2. Download the bash file “leach-setup.sh” into the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
If the home directory of your “NS-2.34″ is other than “/home/ns2/ns-allinone-2.34″, then you need to find “ns-allinone-2.34″ and replace with “yourpath/ns-allinone-2.34″ for the file “leach-setup.sh”.
3. Move to the directory “/home/ns2/ns-allinone-2.34/ns-2.34″ and patch the file “leach-setup.sh” by run this command :
ns2@ubuntu-10.04:~$ cd /home/ns2/ns-allinone-2.34/ns-2.34/
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
If the home directory of your “ns-2.34″ is other than “/home/ns2/ns-allinone-2.34″, then you need to find “…/ns-allinone-2.34″ and replace with “yourpath/ns-allinone-2.34″ for the following two files:
”Makefile” : found in the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
“Makefile.in” : found in the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
4. Edit both “Makefile” & “Makefile.in” as following:
CC = gcc-4.3
CPP = g++-4.3
5. Run the following commands
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ ./configure
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ make clean
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ make
If you have a problem while ‘make’ and shown error message like this : “trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’: trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope trace/cmu-trace.cc: At global scope: trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’ make: *** [trace/cmu-trace.o] Error 1″
Then you need to add this lines into your cmu-trace.h:
// start from line 165
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’
#endif
and also add this line into ns-default.tcl (line 765):
# ——————————————————
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013e-12
Phy/WirelessPhy set EXcvr_ 50e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1
Phy/WirelessPhy set dist_ 0
# ——————————————————
After that you need to re-make.
If the previous commands passed successfully then you are ready to test your “Leach” by running ./test:
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ ./test
Check the file “leach.err”, if no error reported then go to “leach.out” for results.
1. Download the package “ns-234-leach.tar.gz” into the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
2. Download the bash file “leach-setup.sh” into the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
If the home directory of your “NS-2.34″ is other than “/home/ns2/ns-allinone-2.34″, then you need to find “ns-allinone-2.34″ and replace with “yourpath/ns-allinone-2.34″ for the file “leach-setup.sh”.
3. Move to the directory “/home/ns2/ns-allinone-2.34/ns-2.34″ and patch the file “leach-setup.sh” by run this command :
ns2@ubuntu-10.04:~$ cd /home/ns2/ns-allinone-2.34/ns-2.34/
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
If the home directory of your “ns-2.34″ is other than “/home/ns2/ns-allinone-2.34″, then you need to find “…/ns-allinone-2.34″ and replace with “yourpath/ns-allinone-2.34″ for the following two files:
”Makefile” : found in the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
“Makefile.in” : found in the directory “/home/ns2/ns-allinone-2.34/ns-2.34″.
4. Edit both “Makefile” & “Makefile.in” as following:
CC = gcc-4.3
CPP = g++-4.3
5. Run the following commands
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ ./configure
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ make clean
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ make
If you have a problem while ‘make’ and shown error message like this : “trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’: trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope trace/cmu-trace.cc: At global scope: trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’ make: *** [trace/cmu-trace.o] Error 1″
Then you need to add this lines into your cmu-trace.h:
// start from line 165
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’
#endif
and also add this line into ns-default.tcl (line 765):
# ——————————————————
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013e-12
Phy/WirelessPhy set EXcvr_ 50e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1
Phy/WirelessPhy set dist_ 0
# ——————————————————
After that you need to re-make.
If the previous commands passed successfully then you are ready to test your “Leach” by running ./test:
ns2@ubuntu-10.04:/home/ns2/ns-allinone-2.34/ns-2.34$ ./test
Check the file “leach.err”, if no error reported then go to “leach.out” for results.
No comments:
Post a Comment