norbert_jxl 发表于 2011-12-21 08:43

leach协议安装

<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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>&nbsp;ns227-gcc34.rar&nbsp;</A>&nbsp;&nbsp;</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>&nbsp;leach.rar&nbsp;</A>&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT size=3>windows xp系统</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>2.安装</FONT></DIV>
<DIV><FONT size=3>&nbsp; (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>&nbsp; (2)安装ns-allinone-2.27</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 安装之前需要打补丁,不然会出问题</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 打补丁:将ns-allinone-2.27拷贝到/home/xxx/下面,并解压(tar -zxvf ns-allinone-2.27)。将ns227-gcc34.patch拷贝到/home/xxx/下,并用命令进行打补丁(patch -p0 &lt; ns227-gcc34.patch),完成后就可开始安装ns-allinone-2.27。</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 剩下的安装ns-allinone-2.27的过程跟安装其他ns一致</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;(3)修改.bashrc</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; 加入以下</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; export NS_HOME=/home/xxx/ns-allinone-2.27<BR>&nbsp;&nbsp;&nbsp; export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH<BR>&nbsp;&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp; export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp; (4)测试,可以找个简单的脚本测试一下,在此不介绍了,如果可以运行,则安装基本没问题了</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;(5)安装leach</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;&nbsp;将mit.tar.gz(leach.rar解压开就是)拷贝到ns-2.27下。用命令解压:tar -zxvf mit.tar.gz</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; 在makefile中的DEFINE后面添加-DMIT_uAMPS;在INCLUDES = \后添加-I./mit/rca -I./mit/uAMPS</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;再找到OBJ_CC = \后面也跟了一大串,串的末尾是$(OBJ_STL),在它之上填上</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; mit/rca/energy.o mit/rca/rcagent.o \<BR>&nbsp;&nbsp;&nbsp; mit/rca/rca-ll.o mit/rca/resource.o \<BR>&nbsp;&nbsp;&nbsp; mac/mac-sensor-timers.o mac/mac-sensor.o \<BR>&nbsp;&nbsp;&nbsp; mit/uAMPS/bsagent.o \</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp; 修改.bashrc文件,在最后加入以下内容:</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; export RCA_LIBRARY=`pwd`/ns-allinone-2.27/ns-2.27/mit/rca</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; export uAMPS_LIBRARY=`pwd`/ns-allinone-2.27/ns-2.27/mit/uAMPS</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp; </FONT><FONT color=#f00000 size=4>上面两行很重要,配置错误会造成无法运行</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp; 修改mac/wireless-phy.cc 文件,</FONT><FONT size=3>在文件开头添加下面宏定义:“#define min(a,b) (((a)&gt;(b))?(b):(a))”,如下:<BR>&nbsp;&nbsp;&nbsp; #define MAX(a,b) (((a)&lt;(b))?(b):(a))<BR>&nbsp;&nbsp;&nbsp; #define min(a,b) (((a)&gt;(b))?(b):(a))</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;在命令行中 make clean,然后make</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp;如果编译通过,执行ns-2.27下的./leach_test就可以运行得到结果。</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp; 安装成功后在\cygwin\home\***\ns-allinone-2.27\ns-2.27\mit\leach_sims目录下的 leach.err中会有下面的数据</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; INITIALIZE THE LIST xListHead<BR>&nbsp;&nbsp;&nbsp; channel.cc:sendUp - Calc highestAntennaZ_ and distCST_<BR>&nbsp;&nbsp;&nbsp; highestAntennaZ_ = 1.5, distCST_ = 222.8<BR>&nbsp;&nbsp;&nbsp; SORTING LISTS ...DONE!</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>enjoy!!!</FONT></DIV>
<DIV><FONT size=3>&nbsp;&nbsp;&nbsp; </FONT></DIV>
页: [1]
查看完整版本: leach协议安装