欢迎来到天天文库
浏览记录
ID:27192239
大小:76.50 KB
页数:5页
时间:2018-12-01
《有线无线网络混合模拟.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、#有线无线网络混合模拟#无线节点参数setval(chan)Channel/WirelessChannel;#channeltype信道类型:无线信道setval(prop)Propagation/TwoRayGround;#radio-propagationmodel信道模型:TwoRayGroundsetval(netif)Phy/WirelessPhy;#networkinterfacetype无线物理层setval(mac)Mac/802_11;#MACtypeMAC层协议setval(ifq)
2、Queue/DropTail/PriQueue;#interfacequeuetypesetval(ll)LL;#linklayertypesetval(ant)Antenna/OmniAntenna;#antennamodelsetval(ifqlen)50;#maxpacketinifqsetval(rp)DSDV;#路由协议setval(nn)4;#节点数目setval(x)600;setval(y)600;setval(stop)10.0;#timeofsimulationend#建立一个sim
3、ulator实例setns[newSimulator]#设定分层路由地址$nsnode-config-addressTypehierarchicalAddrParamssetdomain_num_2;#2个网络lappendcluster_num11;#每个网络一个子网AddrParamssetcluster_num_$cluster_numlappendeilastlevel13;#2个子网的节点数目为1和3AddrParamssetnodes_num_$eilastlevelputs"Configu
4、rationofhierarchicaladdressingdone"#$nsuse-newtrace#设置tracesettracefd[openwired_wireless2.trw]setnamtrace[openwired_wireless2.namw]$nstrace-all$tracefd$nsnamtrace-all-wireless$namtrace$val(x)$val(y)#建立topology对象settopo[newTopography]$topoload_flatgrid$va
5、l(x)$val(y)#创建godcreate-god$val(nn)setsinkNode[$nsnode0.0.0]$sinkNodesetX_500$sinkNodesetY_300$sinkNodesetZ_0$nsinitial_node_pos$sinkNode60setchan_1_[new$val(chan)]#无线节点配置$nsnode-config-wiredRoutingON-adhocRouting$val(rp)-llType$val(ll)-macType$val(ma
6、c)-ifqType$val(ifq)-ifqLen$val(ifqlen)-antType$val(ant)-propType$val(prop)-phyType$val(netif)-channel$chan_1_-topoInstance$topo-agentTraceON-routerTraceON-macTraceON-movementTraceOFF#新建BS节点setbs(0)[$nsnode1.0.0]$bs(0)random-motion0#节点标签与初始位置设定
7、$bs(0)setX_200.0$bs(0)setY_300.0$bs(0)setZ_0.0$nsinitial_node_pos$bs(0)60#定义节点间的链路$nsduplex-link$sinkNode$bs(0)10Mb1msDropTail$nsduplex-link-op$sinkNode$bs(0)orientleft#定义链路的队列长度#$nsqueue-limit$bs(0)$sinkNode10#监视链路的队列#$nsduplex-link-op$bs(0)$sinkNodeque
8、uePos0.5$nsnode-config-wiredRoutingOFF-macTypeMac/802_11#新建SS节点setss(0)[$nsnode1.0.1]$ss(0)base-station[AddrParamsaddr2id[$bs(0)node-addr]]$ss(0)setX_50.0$ss(0)setY_450.0$ss(0)setZ_0.0$nsinitial_node_pos$ss(0)60setss(1)[$
此文档下载收益归作者所有