


全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
# wrls1.tcl# A 3-node example for ad-hoc simulation with DSDV# Define optionsset val(chan) Channel/WirelessChannel ;# channel typeset val(prop) Propagation/TwoRayGround ;# radio-propagation modelset val(netif) Phy/WirelessPhy ;# network interface typeset val(mac) Mac/802_11 ;# MAC typeset val(ifq) CMUPriQueue ; # interface queue typeset val(ll) LL ;# link layer typeset val(ant) Antenna/OmniAntenna ;# antenna modelset val(ifqlen) 50 ;# max packet in ifqset val(nn) 3 ;# number of mobilenodesset val(rp) DSR ;# routing protocolset val(x) 500 ;# X dimension of topographyset val(y) 400 ;# Y dimension of topography set val(stop) 150 ;# time of simulation endset ns new Simulatorset tracefd open simple.tr wset windowVsTime2 open win.tr w set namtrace open simwrls.nam w $ns trace-all $tracefd$ns namtrace-all-wireless $namtrace $val(x) $val(y)# set up topography objectset topo new Topography$topo load_flatgrid $val(x) $val(y)create-god $val(nn)# Create nn mobilenodes $val(nn) and attach them to the channel. # configure the nodes $ns node-config -adhocRouting $val(rp) -llType $val(ll) -macType $val(mac) -ifqType $val(ifq) -ifqLen $val(ifqlen) -antType $val(ant) -propType $val(prop) -phyType $val(netif) -channelType $val(chan) -topoInstance $topo -agentTrace ON -routerTrace ON -macTrace OFF -movementTrace ON for set i 0 $i $val(nn) incr i set node_($i) $ns node# Provide initial location of mobilenodes$node_(0) set X_ 5.0$node_(0) set Y_ 5.0$node_(0) set Z_ 0.0$node_(1) set X_ 490.0$node_(1) set Y_ 285.0$node_(1) set Z_ 0.0$node_(2) set X_ 150.0$node_(2) set Y_ 240.0$node_(2) set Z_ 0.0# Generation of movements$ns at 10.0 $node_(0) setdest 250.0 250.0 3.0$ns at 15.0 $node_(1) setdest 45.0 285.0 5.0$ns at 110.0 $node_(0) setdest 480.0 300.0 5.0 # Set a TCP connection between node_(0) and node_(1)set tcp new Agent/TCP/Newreno$tcp set class_ 2set sink new Agent/TCPSink$ns attach-agent $node_(0) $tcp$ns attach-agent $node_(1) $sink$ns connect $tcp $sinkset ftp new Application/FTP$ftp attach-agent $tcp$ns at 10.0 $ftp start # Printing the window sizeproc plotWindow tcpSource file global nsset time 0.01set now $ns nowset cwnd $tcpSource set cwnd_puts $file $now $cwnd$ns at expr $now+$time plotWindow $tcpSource $file $ns at 10.1 plotWindow $tcp $windowVsTime2 # Define node initial position in namfor set i 0 $i $val(nn) incr i # 30 defines the node size for nam$ns initial_node_pos $node_($i) 30# Telling nodes when the simulation endsfor set i 0 $i $val(nn) incr i $ns at $val(stop) $node_($i) reset;# ending nam and the simulation $ns at $val(stop) $ns nam-end-wireless $val(stop)$ns at $val(stop) s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年教育精准扶贫政策实施中的教育资源共享与平台建设研究报告
- 资料员之资料员基础知识过关检测试卷【夺冠系列】附答案详解
- 重难点自考专业(小学教育)测试卷附答案(培优A卷)
- 中级银行从业资格之中级银行业法律法规与综合能力通关模拟卷完整答案详解
- 自考专业(人力资源管理)试题及完整答案详解【有一套】
- 娱乐行业在线票务与影音内容管理方案
- 环保公司电商客服管理细则
- 中考数学总复习《概率初步》通关题库及参考答案详解(综合卷)
- 智慧校园安全与校园安全风险评估报告
- 环保公司物流管理办法
- 人民调解员培训课件
- 血液透析学习汇报
- 2025重庆机场集团有限公司社会招聘202人考前自测高频考点模拟试题及完整答案详解1套
- 安徽省江南十校2025年物理高一下期末检测模拟试题含解析
- 培训钉钉课件
- 新建洞室储气库压缩空气储能系统的经济性及成本分析
- 砖厂职业危害管理制度
- 肝功能障碍患者的麻醉管理要点
- 2025年粮油仓储管理员(高级)职业技能鉴定考试练习题库(含答案)
- 【课件】新高三启动主题班会:启航高三逐梦未来
- 历史 2024-2025学年部编版七年级历史下学期期末问答式复习提纲
评论
0/150
提交评论