12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tracking Neighbors Each node keeps a list of its adjacent neighbors in its i<strong>ns</strong>tance variable, neighbor_. <strong>The</strong> procedureadd-neighbor{} adds a neighbor to the list. <strong>The</strong> procedure neighbors{} retur<strong>ns</strong> this list.5.3 Node Configur<strong>at</strong>ion InterfaceNOTE: This API, especially its internal implement<strong>at</strong>ion which is messy <strong>at</strong> this point, is still a moving target. It may undergosignificant changes in the near future. However, we will do our best to maintain the same interface as described in this chapter.In addition, this API currently does not cover all existing nodes in the old form<strong>at</strong>, namely, nodes built using inheritance, <strong>and</strong>parts of mobile IP. It is principally oriented towards wireless <strong>and</strong> s<strong>at</strong>ellite simul<strong>at</strong>ion. [Sep 15, 2000; upd<strong>at</strong>ed June 2001].Simul<strong>at</strong>or::node-config{} accommod<strong>at</strong>es flexible <strong>and</strong> modular co<strong>ns</strong>truction of different node definitio<strong>ns</strong> within thesame base Node class. For i<strong>ns</strong>tance, to cre<strong>at</strong>e a mobile node capable of wireless communic<strong>at</strong>ion, one no longer needs aspecialized node cre<strong>at</strong>ion comm<strong>and</strong>, e.g., dsdv-cre<strong>at</strong>e-mobile-node{}; i<strong>ns</strong>tead, one changes default configur<strong>at</strong>ionparameters, such as$<strong>ns</strong> node-config -adhocRouting dsdvbefore actually cre<strong>at</strong>ing the node with the comm<strong>and</strong>: $<strong>ns</strong> node. Together with routing modules, this allows one to combine“arbitrary” routing functionalities within a single node without resorting to multiple inheritance <strong>and</strong> other fancy objectgimmicks. We will describe this in more detail in Section 5.5. <strong>The</strong> functio<strong>ns</strong> <strong>and</strong> procedures relevant to the new node APIsmay be found in ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-node.tcl.<strong>The</strong> node configur<strong>at</strong>ion interface co<strong>ns</strong>ists of two parts. <strong>The</strong> first part deals with node configur<strong>at</strong>ion, while the second partactually cre<strong>at</strong>es nodes of the specified type. We have already seen the l<strong>at</strong>ter in Section 5.1, in this section we will describe theconfigur<strong>at</strong>ion part.Node configur<strong>at</strong>ion essentially co<strong>ns</strong>ists of defining the different node characteristics before cre<strong>at</strong>ing them. <strong>The</strong>y may co<strong>ns</strong>istof the type of addressing structure used in the simul<strong>at</strong>ion, defining the network components for mobilenodes, turning on oroff the trace optio<strong>ns</strong> <strong>at</strong> Agent/Router/MAC levels, selecting the type of adhoc routing protocol for wireless nodes or definingtheir energy model.As an example, node-configur<strong>at</strong>ion for a wireless, mobile node th<strong>at</strong> ru<strong>ns</strong> AODV as its adhoc routing protocol in a hierarchicaltopology would be as shown below. We decide to turn tracing on <strong>at</strong> the agent <strong>and</strong> router level only. Also we assume a topologyhas been i<strong>ns</strong>tanti<strong>at</strong>ed with "set topo [new Topography]". <strong>The</strong> node-config comm<strong>and</strong> would look like the following:$<strong>ns</strong>_ node-config -addressType hierarchical \-adhocRouting AODV \-llType LL \-macType Mac/802_11 \-ifqType Queue/DropTail/PriQueue \-ifqLen 50 \-antType Antenna/OmniAntenna \-propType Propag<strong>at</strong>ion/TwoRayGround \-phyType Phy/WirelessPhy \-topologyI<strong>ns</strong>tance $topo \-channel Channel/WirelessChannel \-agentTrace ON \-routerTrace ON \-macTrace OFF \-movementTrace OFF49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!