NS3可視化及動畫工具(PyViz和NetAnim)
一、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"
這兩個命令需要進入到目錄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
NS3可視化及動畫工具(PyViz和NetAnim)