一、PyViz安装
1.安装依赖包
sudo apt-get install python-dev python-pygraphviz python-kiwi python-pygoocanvas
注意: ‘python-gnomedesktop’安装包问题 将命令python-gnomedesktop换为 python-gnome2-desktop-dev
2.安装交互python使得GUI上有控制台按钮
sudo apt-get install ipython
3.PyViz测试
python脚本
/waf --pyrun src/flow-monitor/examples/wifi-olsr-flowmon.py --visualize
C++脚本
对于src/olsr/examples/simple-point-to-point-olsr.cc脚本,要出现GUI界面,使用下面的命名是无法成功的
./waf --run src/olsr/examples/simple-point-to-point-olsr --vis
需要修改wscript文件
obj=bld.create_ns3_program(‘simple-point-to-point-olsr‘, [‘point-to-point‘, ‘internet‘, ‘olsr‘, ‘applications‘, ‘wifi‘])
修改成
obj=bld.create_ns3_program(‘simple-point-to-point-olsr‘, [‘point-to-point‘, ‘internet‘, ‘olsr‘, ‘applications‘, ‘wifi‘, ‘visualizer‘])
二、安装NetAnim
安装依赖包并下载
sudo apt-get install mercurial
sudo apt-get install qt4-dev-tools
hg clone http://code.nsnam.org/jabraham3/netanim
安装NetAnim
cd netanim
make clean
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)
make
运行实例产生.xml文件供NetAnim解析
./waf --run "dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"
./waf --run "grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"
这两个命令需要进入到目录src/netanim/examples,若出现"权限不够"问题,cd到ns-3.*目录执行下面命令
./waf --run "src/netanim/examples/dumbbell-animation --nLeftLeaf=5 --nRightLeaf=5 --animFile=dumbbell.xml"
./waf --run "src/netanim/examples/grid-animation --xSize=5 --ySize=5 --animFile=grid.xml"
参考:
1. https://blog.csdn.net/mars_nudt/article/details/7464088
2. https://blog.csdn.net/tttabcgy/article/details/77675853
原文:https://www.cnblogs.com/Xylona/p/10658767.html