⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mobility.tex

📁 对IEEE 802.11e里的分布式信道接入算法EDCA进行改进
💻 TEX
📖 第 1 页 / 共 4 页
字号:
%\documentstyle[11pt,fullpage]{article}%\setlength{\parindent}{0 in}%\setlength{\parskip}{.1in}%\setlength{\topmargin}{-0.5in}%\setlength{\textheight}{8.5in}%\begin{document}\chapter{Mobile Networking in ns}\label{chap:mobility}This chapter describes the wireless model that was originally ported as CMU's Monarch group's mobility extension to \ns. This chapter consists of two sections and several subsections. Thefirst section covers the original mobility model ported fromCMU/Monarch group. In this section, we cover the internals of amobilenode, routing mechanisms and network components that are used toconstruct the network stack for a mobilenode. The components that arecovered briefly are Channel, Network-interface, Radio propagationmodel, MAC protocols, Interface Queue, Link layer and Addressresolution protocol model (ARP). CMU trace support and Generation ofnode movement and traffic scenario files are also covered in thissection. The original CMU model allows simulation of pure wireless LANs ormultihop ad-hoc networks. Further extensions were made to this modelto allow combined simulation of wired and wireless networks. MobileIPwas also extended to the wireless model. These arediscussed in the second section of this chapter.                \section{The basic wireless model in ns}\label{sec:basic-model}The wireless model essentially consists of the MobileNode at the core,withadditional supporting features that allows simulations of multi-hop ad-hocnetworks, wireless LANs etc. The MobileNode object is a split object. TheC++ \clsref{MobileNode}{../ns-2/mobilenode.h} is derived from parent\clsref{Node}{../ns-2/node.h}. Refer to Chapter~\ref{chap:nodes} fordetails on \code{Node}. A \code{MobileNode} thus is the basic \code{Node}object with added functionalities of a wireless and mobile node likeability to move within a given topology, ability to receive and transmitsignals to and from a wireless channel etc. A major difference betweenthem, though, is that a \code{MobileNode} is not connected by means of\code{Links} to other nodes or mobilenodes. In this section we shalldescribe the internals of \code{MobileNode}, its routing mechanisms, therouting protocols dsdv, aodv, tora and dsr, creation of network stackallowing channelaccess in \code{MobileNode}, brief description of each stack component,trace support and movement/traffic scenario generation for wirelesssimulations. \subsection{Mobilenode: creating wireless topology}\label{sec:mobilenode-creation}\code{MobileNode} is the basic \ns \code{Node} object with addedfunctionalities like movement, ability to transmit and receive on achannel that allows it to be used to create mobile, wireless simulationenvironments. The class MobileNode is derived from the base class Node.\code{MobileNode} is a split object. The mobility features including nodemovement, periodic position updates, maintaining topology boundary etc areimplemented in C++ while plumbing of network components within\code{MobileNode} itself (like classifiers, dmux , LL, Mac, Channel etc)have been implemented in Otcl. The functions and procedures described inthis subsection can be found in \nsf{mobilenode.\{cc,h\}},\nsf{tcl/lib/ns-mobilenode.tcl}, \nsf{tcl/mobility/dsdv.tcl},\nsf{tcl/mobility/dsr.tcl}, \nsf{tcl/mobility/tora.tcl}. Example scriptscan be found in\nsf{tcl/ex/wireless-test.tcl} and \nsf{tcl/ex/wireless.tcl}. While thefirst example uses a small topology of 3 nodes, the second example runsover a topology of 50 nodes. These scripts can be run simply by typing\begin{program}$ns tcl/ex/wireless.tcl (or /wireless-test.tcl)\end{program} %$The four ad-hoc routing protocols that are currently supported are Destination Sequence Distance Vector (DSDV), Dynamic Source Routing(DSR), Temporally ordered Routing Algorithm (TORA) and Adhoc On-demandDistance Vector (AODV). The APIs for creating a mobilenode depends onwhich routing protocol it would be using. Hence the primitive to    create a mobilenode is\begin{program}        set mnode [$opt(rp)-create-mobile-node $id] \end{program}where \$opt(rp) defines "dsdv", "aodv", "tora" or "dsr" and id is theindex for the mobilenode.The above procedure creates a mobilenode (split)object, creates a routingagent as specified, creates the network stack consisting of a link layer,interface queue, mac layer, and a network interface with an antenna,interconnects these components and con   nects the stack to the channel. The mobilenode now looks like theschematic in Figure~\ref{fig:mobilenode-dsdv}.  \begin{figure}    \centerline{\includegraphics{dsdv}}    \caption{Schematic of a mobilenode under the CMU monarch's      wireless extensions to \ns}     \label{fig:mobilenode-dsdv} \end{figure}The mobilenode structure used for DSR routing is slightly different fromthe mobilenode described above. The class SRNode is derived from classMobileNode. SRNode doesnot use address demux or classifiers and allpackets received by the node are handed dow   n to the DSR routing agent by default. The DSR routing agent eitherreceives pkts for itself by handing it over to the port dmux or forwardspkts as per source routes in the pkt hdr or sends out route requests androute replies for fresh packets. Details    on DSR routing agent may be found in section~\ref{sec:dsr}. The schematicmodel for a SRNode is shown in Figure~\ref{fig:mobilenode-dsr}. \begin{figure}[tb]    \centerline{\includegraphics{dsr}}    \caption{Schematic of a SRNode under the CMU monarch's wireless      extensions to \ns}     \label{fig:mobilenode-dsr}\end{figure}\subsection{Creating Node movements}\label{sec:mobilenode-movements}The mobilenode is designed to move in a three dimensional topology. However the third dimension (Z) is not used. That is the mobilenode is assumed to move always on a flat terrain with Z always equal to 0.Thus the mobilenode has X, Y, Z(=0) co-ordinates that is continually adjusted as the node moves. There are two mechanisms to induce movement in mobilenodes. In the first method, starting position of the node and its future destinations may be set explicitly. These directives are normally included in a separate movement scenario file. The start-position and future destinations for a mobilenode may be setby using the following APIs:\begin{program}$node set X_ <x1>$node set Y_ <y1>$node set Z_ <z1>$ns at $time $node setdest <x2> <y2> <speed> \end{program}At \$time sec, the node would start moving from its initial position of (x1,y1) towards a destination (x2,y2) at the defined speed.In this method the node-movement-updates are triggered whenever theposition of the node at a given time is required to be known. Thismay be triggered by a query from a neighbouring node seeking to knowthe distance between them, or the setdest directivedescribed above that changes the direction and speed of the node.An example of a movement scenario file using the above APIs, can befound in \nsf{tcl/mobility/scene/scen-670x670-50-600-20-0}. Here670x670 defines the length and width of the topology with 50 nodesmoving at a maximum speed of 20m/s with average pause time of600s. These node movement files may be generated using CMU's scenariogenerator to be found under\nsf{indep-utils/cmu-scen-gen/setdest}. See subsection~\ref{sec:mobile-scen-generator} for details on generationof node movement scenarios. The second method employs random movement of the node. The primitiveto be used is:\begin{program}$mobilenode start\end{program} %$which starts the mobilenode with a random position and have routinedupdates to change the direction and speed of the node. The destinationand speed values are generated in a random fashion. We have not usedthe second method and leave it to the user to explore the details. The mobilenode movement is implemented in C++. See methods in\nsf{mobilenode.\{cc.h\}} for the implementational details.Irrespective of the methods used to generate node movement,the topography for mobilenodes needs to be defined. It should bedefined before creating mobilenodes. Normally flat topology is createdby specifying the length and width of the topography using thefollowing primitive:\begin{program}    set topo        [new Topography]$topo load_flatgrid $opt(x) $opt(y)\end{program} %$where opt(x) and opt(y) are the boundaries used in simulation.The movement of mobilenodes may be logged by using a procedure likethe following:\begin{program}proc log-movement \{\} \{    global logtimer ns_ ns    set ns $ns_    source ../mobility/timer.tcl    Class LogTimer -superclass Timer    LogTimer instproc timeout \{\} \{        global opt node_;        for \{set i 0\} \{$i < $opt(nn)\} \{incr i\} \{            $node_($i) log-movement        \}        $self sched 0.1    \}    set logtimer [new LogTimer]    $logtimer sched 0.1\}\end{program} %$In this case, mobilenode positions would be logged every 0.1 sec.\subsection{Network Components in a mobilenode}\label{sec:mobilenode-components}The network stack for a mobilenode consists of a link layer(LL), anARP module connected to LL, an interface priority queue(IFq), a maclayer(MAC), a network interface(netIF), all connected to the channel. These network components are created and plumbed together in OTcl. The relevant MobileNode method add-interface() in\nsf{tcl/lib/ns-mobilenode.tcl} is shown below:\begin{program}##  The following setups up link layer, mac layer, network interface#  and 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 $qtype]            ;# interface queue        set ll_($t)     [new $lltype]           ;# link layer        set ant_($t)    [new $anttype]        #        # Local Variables        #        set nullAgent_ [$ns_ set nullAgent_]        set netif $netif_($t)        set mac $mac_($t)        set ifq $ifq_($t)        set ll $ll_($t)        #        # Initialize ARP table only once.        #        if \{ $arptable_ == "" \} \{            set arptable_ [new ARPTable $self $mac]            set drpT [cmu-trace Drop "IFQ" $self]            $arptable_ drop-target $drpT        \}        #        # Link Layer        #        $ll arptable $arptable_        $ll mac $mac        $ll up-target [$self entry]        $ll down-target $ifq        #        # Interface Queue        #        $ifq target $mac        $ifq set qlim_ $qlen        set drpT [cmu-trace Drop "IFQ" $self]        $ifq drop-target $drpT        #        # Mac Layer        #        $mac netif $netif        $mac up-target $ll        $mac down-target $netif        $mac nodes $opt(nn)        #        # Network Interface        #        $netif channel $channel        $netif up-target $mac        $netif propagation $pmodel      ;# Propagation Model        $netif node $self               ;# Bind node <---> interface        $netif antenna $ant_($t)        ;# attach antenna        #        # Physical Channel        #        $channel addif $netif           ;# add to list of interfaces        # ============================================================        # Setting up trace objects                if \{ $MacTrace == "ON" \} \{            #            # Trace RTS/CTS/ACK Packets            #            set rcvT [cmu-trace Recv "MAC" $self]            $mac log-target $rcvT            #            # Trace Sent Packets            #            set sndT [cmu-trace Send "MAC" $self]            $sndT target [$mac sendtarget]            $mac sendtarget $sndT            #            # Trace Received Packets            #            set rcvT [cmu-trace Recv "MAC" $self]            $rcvT target [$mac recvtarget]            $mac recvtarget $rcvT            #            # Trace Dropped Packets            #            set drpT [cmu-trace Drop "MAC" $self]            $mac drop-target $drpT        \} else \{            $mac log-target [$ns_ set nullAgent_]            $mac drop-target [$ns_ set nullAgent_]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -