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.

$s<strong>at</strong>routeobject_ compute_routeswhere the call to compute_routes is performed after all of the links <strong>and</strong> nodes in the simul<strong>at</strong>or have been i<strong>ns</strong>tanti<strong>at</strong>ed.Like the Scheduler, there is one i<strong>ns</strong>tance of a S<strong>at</strong>RouteObject in the simul<strong>at</strong>ion, <strong>and</strong> it is accessed by mea<strong>ns</strong> of an i<strong>ns</strong>tancevariable in C++. For example, the call to recompute routes after a topology change is:S<strong>at</strong>RouteObject::i<strong>ns</strong>tance().recompute();Despite the current use of centralized routing, the design of having a routing agent on each node was mainly done withdistributed routing in mind. Routing packets can be sent to port 255 of each node. <strong>The</strong> key to distributed routing workingcorrectly is for the routing agent to be able to determine from which link a packet arrived. This is accomplished by the inclusionof a class NetworkInterface object in each link, which uniquely labels the link on which the packet arrived. Ahelper function NsObject* intf_to_target(int label) can be used to return the head of the link correspondingto a given label. <strong>The</strong> use of routing agents parallels th<strong>at</strong> of the mobility exte<strong>ns</strong>io<strong>ns</strong>, <strong>and</strong> the interested reader can turn to thoseexamples to see how to implement distributed routing protocols in this framework.<strong>The</strong> shortest-p<strong>at</strong>h route comput<strong>at</strong>io<strong>ns</strong> use the current propag<strong>at</strong>ion delay of a link as the cost metric. It is possible to computeroutes using only the hop count <strong>and</strong> not the propag<strong>at</strong>ion delays; in order to do so, set the following default variable to "false":S<strong>at</strong>RouteObject set metric_delay_ "true"Finally, for very large topologies (such as the Teledesic example), the centralized routing code will produce a very slowruntime because it executes an all-pairs shortest p<strong>at</strong>h algorithm upon each topology change even if there is no d<strong>at</strong>a currentlybeing sent. To speed up simul<strong>at</strong>io<strong>ns</strong> in which there is not much d<strong>at</strong>a tra<strong>ns</strong>fer but there are lots of s<strong>at</strong>ellites <strong>and</strong> ISLs, one c<strong>and</strong>isable h<strong>and</strong>off-driven <strong>and</strong> enable d<strong>at</strong>a-driven route comput<strong>at</strong>io<strong>ns</strong>. With d<strong>at</strong>a-driven comput<strong>at</strong>io<strong>ns</strong>, routes are computed onlywhen there is a packet to send, <strong>and</strong> furthermore, a single-source shortest-p<strong>at</strong>h algorithm (only for the node with a packet tosend) is executed i<strong>ns</strong>tead of an all-pairs shortest p<strong>at</strong>h algorithm. <strong>The</strong> following OTcl variable can configure this option (whichis set to "false" by default):S<strong>at</strong>RouteObject set d<strong>at</strong>a_driven_comput<strong>at</strong>ion_ "false"17.2.5 Trace supportTracefiles using s<strong>at</strong>ellite nodes <strong>and</strong> links are very similar to conventional <strong>ns</strong> tracing described in Chapter 26. Special S<strong>at</strong>Traceobjects (class S<strong>at</strong>Trace derives from class Trace) are used to log the geographic l<strong>at</strong>itude <strong>and</strong> longitude of the nodelogging the trace (in the case of a s<strong>at</strong>ellite node, the l<strong>at</strong>itude <strong>and</strong> longitude correspond to the nadir point of the s<strong>at</strong>ellite).For example, a packet on a link from node 66 to node 26 might normally be logged as:+ 1.0000 66 26 cbr 210 ------- 0 66.0 67.0 0 0but in the s<strong>at</strong>ellite simul<strong>at</strong>ion, the position inform<strong>at</strong>ion is appended:+ 1.0000 66 26 cbr 210 ------- 0 66.0 67.0 0 0 37.90 -122.30 48.90 -120.94In this case, node 66 is <strong>at</strong> l<strong>at</strong>itude 37.90 degrees, longitude -122.30 degrees, while node 26 is a LEO s<strong>at</strong>ellite whose subs<strong>at</strong>ellitepoint is <strong>at</strong> 48.90 degrees l<strong>at</strong>itude, -120.94 degrees longitude (neg<strong>at</strong>ive l<strong>at</strong>itude corresponds to south, while neg<strong>at</strong>ive longitudecorresponds to west).178

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

Saved successfully!

Ooh no, something went wrong!