- 16
- 0
- 约1.63万字
- 约 63页
- 2016-12-06 发布于江苏
- 举报
NS Tutorial: mobile and wireless network simulation Chuda Liu XJTU April 10th, 2004 Outlines 1. 引言:NS中的基本无线模型 2. 对CMU的无线模型的扩展 3. 应用举例 1. 引言:NS中的基本无线模型 1.1 创建无线拓扑 1.2 创建MN的移动 1.3 MN中的网络组件 1.4 MAC协议 1.5 Ad hoc 路由协议 1.6 Trace支持 1.7 对无线Trance格式的修改 1.8 产生节点移动和业务连接的场景文件 1. 引言:NS中的基本无线模型 引言 无线模型=MobileNode+支持Adhoc WLAN特征 1.1 创建无线拓扑 MN从Node派生,其移动特征包括: -节点移动 -周期性位置更新 -维护拓扑边缘 MN中的网络组件 -分类器 -dmux -LL -MAC -Channel 1.1 创建无线拓扑 创建MN前先要配置节点,经过以下API: # Define how a mobile node is configured $ns_ node-config -adhocRouting $opt(adhocRouting) ;# 创建adhoc ragent -llType $opt(ll) -macType $opt(mac) -ifqType $opt(ifq) -ifqLen $opt(ifqlen) -antType $opt(ant) -propInstance [new $opt(prop)] -phyType $opt(netif) -channel [new $opt(chan)] -topoInstance $topo -wiredRouting OFF -agentTrace ON -routerTrace OFF -macTrace OFF 1.1 创建无线拓扑 创建MN: for { set j 0 } { $j \ $opt(nn)} {incr j} { set node_($j) [ $ns_ node ] $node_($i) random-motion 0 ;# disable random motion } Mobilenode示意图 Mobilenode示意图 Mobilenode示意图 Mobilenode示意图 1.2 创建MN的移动 MN被设计成在一个三维拓扑中移动,但Z轴未用(Z=0); MN的坐标随MN的移动而改变; 有2种机制引入MN的移动: -指定MN的起始和终点位置 -随机移动模式 创建MN前需要定义拓扑 set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) 1.3 MN中的网络组件 MN的网络栈有以下组件: -LL -ARP -MAC -IFQ -netIF -Channel 它们在MN中的add-interface()方法创建 # The following setups up link layer, mac layer, network # interface , physical layer structures for the mobile node. Node/MobileNode instproc add-interface { channel pmodel lltype mactype qtype qlen iftype anttype } { $self instvar arptable_ nifs_ $self instvar netif_ mac_ ifq_ ll_ global ns_ MacTrace opt set t $nifs_ incr nifs_ set netif_($t) [new $iftype] ;# net-interface set mac_($t) [new $mactype] ;# mac layer set ifq_($t) [new $qty
原创力文档

文档评论(0)