16.1.1 Mobilenode: creating wireless topology

MobileNode is the basic ns Node object with added functionalities like movement, ability to transmit and receive on a channel that allows it to be used to create mobile, wireless simulation environments. The class MobileNode is derived from the base class Node. MobileNode is a split object. The mobility features including node movement, periodic position updates, maintaining topology boundary etc are implemented in C++ while plumbing of network components within MobileNode itself (like classifiers, dmux , LL, Mac, Channel etc) have been implemented in Otcl. The functions and procedures described in this subsection can be found in ~ns/mobilenode.{cc,h}, ~ns/tcl/lib/ns-mobilenode.tcl, ~ns/tcl/mobility/dsdv.tcl, ~ns/tcl/mobility/dsr.tcl, ~ns/tcl/mobility/tora.tcl. Example scripts can be found in ~ns/tcl/ex/wireless-test.tcl and ~ns/tcl/ex/wireless.tcl. While the first example uses a small topology of 3 nodes, the second example runs over a topology of 50 nodes. These scripts can be run simply by typing

$ns tcl/ex/wireless.tcl (or /wireless-test.tcl)

The five ad-hoc routing protocols that are currently supported are Destination Sequence Distance Vector (DSDV), Dynamic Source Routing (DSR), Temporally ordered Routing Algorithm (TORA), Adhoc On-demand Distance Vector (AODV) and Protocol for Unified Multicasting Through Announcements (PUMA). The primitive to create a mobilenode is described below. Please note that the old APIs for creating a mobilenode depended on which routing protocol was used, like

 set mnode [$opt(rp)-create-mobile-node $id]
where
 $opt(rp)
defines "dsdv", "aodv", "tora", "dsr" or "puma" and id is the index for the mobilenode. But the old API's use is being deprecated and the new API is described as follows:.

$ns_ node-config -adhocRouting $opt(adhocRouting) 
                 -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

The above API configures for a mobilenode with all the given values of adhoc-routing protocol, network stack, channel,topography, propagation model, with wired routing turned on or off (required for wired-cum-wireless scenarios) and tracing turned on or off at different levels (router, mac, agent). Incase hierarchical addressing is being used, the hier address of the node needs to be passed as well. For more info about this command (part of new node APIs) see chapter titled "Restructuring ns node and new Node APIs" in ns Notes and Documentation.

Next actually create the mobilenodes as follows:

for { set j 0 } { $j \< $opt(nn)} {incr j} {
    set node_($j) [ $ns_ node ]
    $node_($i) random-motion 0		;# disable random motion
}

The above procedure creates a mobilenode (split)object, creates an adhoc-routing routing agent as specified, creates the network stack consisting of a link layer, interface queue, mac layer, and a network interface with an antenna, uses the defined propagation model, interconnects these components and connects the stack to the channel. The mobilenode now looks like the schematic in Figure 16.1.

Figure 16.1: Schematic of a mobilenode under the CMU monarch's wireless extensions to ns
\includegraphics{dsdv}

The mobilenode structure used for DSR routing is slightly different from the mobilenode described above. The class SRNode is derived from class MobileNode. SRNode doesnot use address demux or classifiers and all packets received by the node are handed dow n to the DSR routing agent by default. The DSR routing agent either receives pkts for itself by handing it over to the port dmux or forwards pkts as per source routes in the pkt hdr or sends out route requests and route replies for fresh packets. Details on DSR routing agent may be found in section 16.1.5. The schematic model for a SRNode is shown in Figure 16.2.

Figure 16.2: Schematic of a SRNode under the CMU monarch's wireless extensions to ns
\includegraphics{dsr}

Tom Henderson 2011-11-05