ns3 版本 3.36.1

编写脚本

1
2
3
4
5
6
7
8
9
10
  	...
#include "ns3/netanim-module.h"
...
int main(){
...
AnimationInterface anim("xxx.xml"); //生成的xml文件的名字
Simulator::Run ();
Simulator::Destroy ();
return 0;
}

执行脚本

1
~/ns3/ns-allinone-3.36.1/ns-3.36.1 $ ./ns3 run scratch/myfirst.cc

用NetAnim 打开xml文件

1
~/ns3/ns-allinone-3.36.1/netanim-3.108 $ ./NetAnim

打开NetAnim后打开生成的xml文件,就可以看见自己创建的节点了