leach协议安装
<DIV> <FONT color=#000080 size=5>cygwin+ns-allinone-2.27+leach</FONT></DIV><DIV><FONT color=#000000 size=3>1.准备</FONT></DIV>
<DIV><FONT size=3>cygwin,获取网址:<A href="http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm" target=_blank>http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm</A></FONT></DIV>
<DIV><FONT size=3>ns-allinone-2.27,获取网址:<A href="http://ftp.isi.edu/nsnam/dist/" target=_blank>http://ftp.isi.edu/nsnam/dist/</A></FONT></DIV>
<DIV><FONT size=3>ns227-gcc34.patch,<A href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/attach/24/49/01/3424490134f1f3ceb467c53e73888bb81de821f3c1.rar" target=_blank><IMG src="http://blog.chinaunix.net/blog/image/attachicons/rar.gif" align=absMiddle border=0> ns227-gcc34.rar </A> </FONT></DIV>
<DIV><FONT size=3>leach,<A href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/attach/24/49/01/342449013420ce5c7a979543440c02c7994a2843da.rar" target=_blank><IMG src="http://blog.chinaunix.net/blog/image/attachicons/rar.gif" align=absMiddle border=0> leach.rar </A> </FONT></DIV>
<DIV><FONT size=3>windows xp系统</FONT></DIV>
<DIV><FONT size=3></FONT> </DIV>
<DIV><FONT size=3>2.安装</FONT></DIV>
<DIV><FONT size=3> (1)安装cygwin,安装过程见:<A href="http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm" target=_blank>http://hpds.ee.ncku.edu.tw/~smallko/ns2/ns2.htm</A></FONT></DIV>
<DIV><FONT size=3> (2)安装ns-allinone-2.27</FONT></DIV>
<DIV><FONT size=3> 安装之前需要打补丁,不然会出问题</FONT></DIV>
<DIV><FONT size=3> 打补丁:将ns-allinone-2.27拷贝到/home/xxx/下面,并解压(tar -zxvf ns-allinone-2.27)。将ns227-gcc34.patch拷贝到/home/xxx/下,并用命令进行打补丁(patch -p0 < ns227-gcc34.patch),完成后就可开始安装ns-allinone-2.27。</FONT></DIV>
<DIV><FONT size=3> 剩下的安装ns-allinone-2.27的过程跟安装其他ns一致</FONT></DIV>
<DIV><FONT size=3> (3)修改.bashrc</FONT></DIV>
<DIV><FONT size=3> 加入以下</FONT></DIV>
<DIV><FONT size=3> export NS_HOME=/home/xxx/ns-allinone-2.27<BR> export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH<BR> export=LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-1.8:$NS_HOME/lib:$LD_LIBRARY_PATH<BR> export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library</FONT></DIV>
<DIV><FONT size=3> (4)测试,可以找个简单的脚本测试一下,在此不介绍了,如果可以运行,则安装基本没问题了</FONT></DIV>
<DIV><FONT size=3> (5)安装leach</FONT></DIV>
<DIV><FONT size=3> 将mit.tar.gz(leach.rar解压开就是)拷贝到ns-2.27下。用命令解压:tar -zxvf mit.tar.gz</FONT></DIV>
<DIV><FONT size=3> 在makefile中的DEFINE后面添加-DMIT_uAMPS;在INCLUDES = \后添加-I./mit/rca -I./mit/uAMPS</FONT></DIV>
<DIV><FONT size=3> 再找到OBJ_CC = \后面也跟了一大串,串的末尾是$(OBJ_STL),在它之上填上</FONT></DIV>
<DIV><FONT size=3> mit/rca/energy.o mit/rca/rcagent.o \<BR> mit/rca/rca-ll.o mit/rca/resource.o \<BR> mac/mac-sensor-timers.o mac/mac-sensor.o \<BR> mit/uAMPS/bsagent.o \</FONT></DIV>
<DIV><FONT size=3> 修改.bashrc文件,在最后加入以下内容:</FONT></DIV>
<DIV><FONT size=3> export RCA_LIBRARY=`pwd`/ns-allinone-2.27/ns-2.27/mit/rca</FONT></DIV>
<DIV><FONT size=3> export uAMPS_LIBRARY=`pwd`/ns-allinone-2.27/ns-2.27/mit/uAMPS</FONT></DIV>
<DIV><FONT size=3> </FONT><FONT color=#f00000 size=4>上面两行很重要,配置错误会造成无法运行</FONT></DIV>
<DIV><FONT size=3> 修改mac/wireless-phy.cc 文件,</FONT><FONT size=3>在文件开头添加下面宏定义:“#define min(a,b) (((a)>(b))?(b):(a))”,如下:<BR> #define MAX(a,b) (((a)<(b))?(b):(a))<BR> #define min(a,b) (((a)>(b))?(b):(a))</FONT></DIV>
<DIV><FONT size=3> 在命令行中 make clean,然后make</FONT></DIV>
<DIV><FONT size=3> 如果编译通过,执行ns-2.27下的./leach_test就可以运行得到结果。</FONT></DIV>
<DIV><FONT size=3> 安装成功后在\cygwin\home\***\ns-allinone-2.27\ns-2.27\mit\leach_sims目录下的 leach.err中会有下面的数据</FONT></DIV>
<DIV><FONT size=3> INITIALIZE THE LIST xListHead<BR> channel.cc:sendUp - Calc highestAntennaZ_ and distCST_<BR> highestAntennaZ_ = 1.5, distCST_ = 222.8<BR> SORTING LISTS ...DONE!</FONT></DIV>
<DIV><FONT size=3></FONT> </DIV>
<DIV><FONT size=3>enjoy!!!</FONT></DIV>
<DIV><FONT size=3> </FONT></DIV>
页:
[1]