leach分析1
来源:互联网 发布:winrar软件破解版 编辑:程序博客网 时间:2024/06/06 06:44
首先对wireless.tcl进行分析,先对默认的脚本选项进行初始化:
set opt(chan)Channel/WirelessChannel
set opt(prop) Propagation/TwoRayGround
set opt(netif)Phy/WirelessPhy
set opt(mac) Mac/802_11
set opt(ifq) Queue/DropTail/PriQueue
set opt(ll) LL
set opt(ant) Antenna/OmniAntenna
set opt(x) 0 ;# X dimension of the topography
set opt(y) 0 ;# Y dimension of the topography
set opt(cp) ""
set opt(sc) "../mobility/scene/scen-670x670-50-600-20-2" ;# scenario file
set opt(ifqlen)50;# max packet in if
set opt(nn) 51 ;# number of nodes
set opt(seed) 0.0
set opt(stop) 10.0 ;# simulation time
set opt(tr) out.tr ;# trace file
set opt(rp) dsdv ;# routing protocol script
set opt(lm) "on" ;# log movement
在这个wireless.tcl中设置了一些全局变量:
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set chan [new $opt(chan)]
set prop [new $opt(prop)]
set topo [new Topography]
set tracefd [open $opt(tr) w]
$topo load_flatgrid $opt(x) $opt(y)
$prop topography $topo
这些初始化将在后面的使用中用到,该文件最重要的是创建leach节点:创建方法如下:
} elseif { [string compare $opt(rp) "leach"] == 0} {
for {set i 0} {$i < $opt(nn) } {incr i} {
leach-create-mobile-node $i
}
如果路由协议是leach协议,则在Uamps.tcl中调用leach-create-mobile-node方法创建leach节点。将在第二小节讲如何创建leach节点。
for {set i 0} {$i < $opt(nn) } {incr i} {
$ns_ at $opt(stop).000000001 "$node_($i) reset"; //完成后,重置节点的应用
}
$ns_ at $opt(stop).00000001 "puts \"NS EXITING...\" ; $ns_ halt"
if { $opt(sc) == "" } {
puts "*** NOTE: no scenario file specified."
set opt(sc) "none"
} else {
puts "Loading scenario file..."
source $opt(sc)
puts "Load complete..."
}
ns在什么时候结束simulation,并告诉ns加载sc场景文件。
最后$ns_ run则ns就开始运行了。
- leach分析1
- ns-leach.tcl 分析1
- Leach协议性能分析(1)
- LEACH&LEACH-C 仿真分析(2)
- LEACH&LEACH-C仿真分析(3)
- LEACH&LEACH-C 仿真分析(2)
- LEACH&LEACH-C仿真分析(3)
- LEACH&LEACH-C 仿真分析(2)
- LEACH&LEACH-C仿真分析(3)
- leach.energy分析仿真
- leach 分析2
- leach 分析3
- leach 分析4
- leach.alive文件分析仿真
- ns-leach.tcl 分析2
- ns-leach.tcl 分析3
- Leach协议性能分析(2)
- 【转】Leach协议学习(3)——Leach协议分析
- C#发送邮件三种方法,Localhost,SMTP,SSL-SMTP
- SQL Server数据库优化的10多种方法
- 用javascript获取屏幕高度和宽度等信息
- 汽车通讯数据处理(CAN)
- pdf资料下载 编程
- leach分析1
- GDAL写PCIDISK(*.PIX)格式,用ERDAS读取出错的问题
- TWebBrowser控件 相关内容
- [应用架构] HQL 查询方式(传统方式和占位方式)
- setsid()
- android手机时间自动同步
- linux下程序前后台切换运行
- javascript正则表达式方法
- 单例模式