- 论坛徽章:
- 0
|
最近搞WSN, 为选择合适的仿真工具头疼不已. 后来看了OMNeT++的相关资料, 也许它就是我要的. 试试先!
安装OMNeT++
下面我在Linux系统中安装(Ubuntu 6.06), 可参考:
http://www.omnetpp.org/pmwiki/index.php?n=Main.InstallingOnUnix
1, 下载
omnetpp-3.4b2-src.tgz
, 将其解压到home目录 $ tar -C ~/ -xvzf omnetpp-3.4b2-src.tgz
这样, 在home目录就多出一个名为omnetpp-3.4b2的目录.
2, 进入omnetpp-3.4b2目录, 编辑configure.user进行配置(可选, 我使用默认配置).
3, 运行 $ ./configure
由于OMNeT++需要用到其他的程序, 第一次configure往往会因为你的系统未安装某个程序而出现error. 即便configure没有error, 也要仔细检查configure的输出, 排除warning. 这就需要安装Ubuntu未默认安装, 但OMNeT++又需要的: bison byacc flex imagemagick tk8.4-dev doxygen giftrans blt-dev libxml2-dev...
另外, 推荐装上blt-demo doxygen-doc doxygen-gui html2ps tcl8.4-doc tk8.4-doc bison-doc
Scroll up to see the warning messages (use shift+PgUp key), and see
config.log for more details. While you can use OMNeT++/OMNEST in the
current configuration, please be aware that some functionality may be
unavailable or incomplete.
目前Akaroa, MPI(needed for parallel simulation) 尚未安装!
4, 设置环境变量, 编辑~/.bashrc, 加入:
export PATH=$PATH:~/omnetpp-3.4b2/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/omnetpp-3.4b2/libexport TCL_LIBRARY=/usr/lib/tcl8.4
需要设置PATH, LD_LIBRARY_PATH还需要设置TCL_LIBRARY, 让OMNEST/OMNeT++ GUI 程序能够找到BLT库.
实际上, 在第三步的./configure结束后, 会检测环境变量是否设置. 若未设置(或设置后未log out, log in), 它会提示你设置.
5, 运行make进行安装(我使用4.03, 3.4.6版的gcc均编译成功)
gcc版本不能过低, 在include/defs.h中:
/* gcc 2.9x.x had broken exception handling */
#ifdef __GNUC__
# if __GNUC__
注意, 这里的makefile不保证能使用-j2的多任务选项, 我使用make -j2, 结果ld出现error.
For additional information, please visit the "Common installation problems" page on www.omnetpp.org.
老版本的OMNeT++安装
3.4b2版的OMNeT++安装非常简单, 如果使用比较老的版本(有的model只能用相应的老版本), 就要注意一些问题了. 我也安装过2.3p1, 安装过程如下:
1. OMNeT++ 2.3p1 (使用gcc-3.4.6)
(1) Follow doc/Readme.Unix. (这里假设已经安装上了所需的包, 见上述安装3.4b2)
(2) Run "./configure", fail to autodetect tcl/tk setting:
...checking for Tcl/Tk with CFLAGS="-I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/lib -ltk8.4 -ltcl8.4"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk84 -ltcl84"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk8.4 -ltcl8.4"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk83 -ltcl83"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk8.3 -ltcl8.3"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk82 -ltcl82"... nochecking for Tcl/Tk with CFLAGS=" -I/usr/include/tcl8.4 -fwritable-strings" LIBS="-L/usr/X11R6/lib -lX11 -ltk8.2 -ltcl8.2"... noconfigure: error: Tcl/Tk not found, needed for all GUI parts; version 8.2+ needed
是tcl/tk库无法自动设置, 只有手动解决:
$ locate tcl.h tk.h
查找tcl8.4头文件, 找到它们在系统中的位置, 并添加到configure.user:
TK_CFLAGS="-I/usr/include/tcl8.4 -fwritable-strings"TK_LIBS="-L/usr/lib -ltk8.4 -ltcl8.4"
(3) 执行make. 用gcc-4.0失败, gcc-3.4编译成功.
2. OMNeT++ 3.1
和安装2.3p1相同, 但gcc版本换成4.0.3, 用3.4.6会编译失败, 奇怪的问题
![]()
3. OMNeT++-3.2pre3
和3.4b2的相同, 只是BLT库出现问题.
在新立得中查找blt, 看properties-installed files, 发现BLT库的名字是libBLT.so, 而非libBLT24.so
$ locate libBLT.so
/usr/lib/libBLT.so
只需修改configure.user:
将 BLT_LIBS="lBLT24" 改为 BLT_LIBS="lBLT"
编译的gcc版本还是要注意: 4.1.1有问题, 用3.4.6 or 4.0.1
使用OMNeT++
安装完成后, 可以运行示例程序感受一下:
$ cd ~/omnetpp-3.4b2/samples/dyna
$ ./dyna
截图如下:
![]()
可结合step-by-step tutorial (
TicToc
)学习简单的用法. TicToc也在OMNet++源代码的doc目录中(tictoc-tutorial)
Reference[color="#0080ff"]
1, 官方网站
http://www.omnetpp.org
2, Tutorial(WINDOWS下安装的)
http://personal.stevens.edu/~hli5/TutorialofOMNET.htm
3, OMNet++ wiki:
http://www.omnetpp.org/pmwiki/
5.
http://ctieware.eng.monash.edu.au/twiki/bin/view/Simulation/Tutorials
5,[color="#0000ff"]
http://www.home.cs.utwente.nl/~dulman/codesign/code.html
一份tutorial:
[color="#0000ff"]simulator.pdf
, 还有一些example代码:
[color="#0000ff"]Omnet++examples.zip
![]()
文件:
OMNeT++ Examples.zip
大小:
569KB
下载:
下载
6, 中科院计算所WSN论坛, OMNeT板:
http://www.wsn.net.cn/bbs/list.asp?boardid=16
[/url]
本文来自ChinaUnix博客,如果查看原文请点:[url]http://blog.chinaunix.net/u/13991/showart_230186.html |
|