使用Cbrgen和Setdest构造无线仿真环境

NS中节点移动与传输事件的代码,都可以通过工具来完成.

把这些事件写在一个文件里,方便管理与实验,也减少了代码的冗余度.

 

1.传输产生器 Cbrgen.tcl

Cbrgen是一个可以产生数据流的工具,称为传输产生器.在ns-2.34/indep-utils/cmu-scen-gen目录下,可以产生TCP数据流或CBR链接.

使用方法:

ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate]

参数定义如下:-type  定义数据流的种类,tcp or cbr;cbr即使用UDP进行传送

-nn 节点数  

-mc 节点间的最大连接数       

-rate  每个连接间的流的负载数

-seed  指定随机数种子

2.节点移动产生器

.setdest(ns2.34/indep-utils/cmu-scen-gen/setdest/)

setdest有两个版本,可以.setdest直接查看
使用方法如下:
./setdest   -v <1> -n <nodes> -p <pause time> -M <max speed> -t <simulation time> -x <max X> -y <max Y>

./setdest   -v <2> -n <nodes> -s <speed type> -m <min speed> -M <max speed> -t <simulation time> -P <pause type> -p <pause time> -x <max X> -y <max Y>
其中,speed type为uniform/normal,pause type为constant/uniform


以上两个工具产生的文件均可采用source命令加入到tcl文件中,注意产生的文件用到了诸如node_数组变量和god_变量,需要在tcl脚本中预先建立

你可能感兴趣的:(set)