使用 synaptic 安装3个依赖包
qt4-qmake
libqt4-dev (顺便把旁边的也勾了)
libxml2-dev
现在去ns-allinone-3.26下,就会看到 netanim-3.107
接下来的步骤:


是不是迫不及待想试试看了?
在scratch下打开编辑first.cc
在头文件中加上 #include "ns3/netanim-module.h"
在在Simulation::Run(); 前面加入了代码:
AnimationInterface anim ("anim1.xml"); //起名字
anim.SetConstantPosition(nodes.Get(0), 1.0, 2.0) //两个节点的位置
anim.SetConstantPosition(nodes.Get(1), 2.0, 3.0)
保存好后运行first.cc

接着运行刚才的打开NetAnim命令:


点左上角的小绿色三角形,all done

网友评论