📄 node174.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>16.1.2 Creating Node movements</TITLE><META NAME="description" CONTENT="16.1.2 Creating Node movements"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html"><LINK REL="previous" HREF="node173.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html"><LINK REL="up" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><LINK REL="next" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html3972" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3966" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3960" HREF="node173.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3968" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3970" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3973" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html">16.1.3 Network Components in</A><B> Up:</B> <A NAME="tex2html3967" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html3961" HREF="node173.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html">16.1.1 Mobilenode: creating wireless</A>   <B> <A NAME="tex2html3969" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3971" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H2><A NAME="SECTION031312000000000000000"></A><A NAME="sec:mobilenode-movements"></A><BR>16.1.2 Creating Node movements</H2><P>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. <P>The start-position and future destinations for a mobilenode may be setby using the following APIs:<PRE>$node set X_ \<x1\>$node set Y_ \<y1\>$node set Z_ \<z1\>$ns at $time $node setdest \<x2\> \<y2\> \<speed\></PRE>At $time sec, the node would start moving from its initial position of (x1,y1) towards a destination (x2,y2) at the defined speed.<P>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.<P>An example of a movement scenario file using the above APIs, can befound in 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 underindep-utils/cmu-scen-gen/setdest. See subsection <A HREF="node187.html#sec:mobile-scen-generator" tppabs="http://www.isi.edu/nsnam/ns/doc/node187.html#sec:mobile-scen-generator">16.1.8</A> for details on generationof node movement scenarios. <P>The second method employs random movement of the node. The primitiveto be used is:<PRE>$mobilenode start</PRE> 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 inmobilenode.{cc.h} for the implementational details.<P>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:<PRE> set topo [new Topography]$topo load_flatgrid $opt(x) $opt(y)</PRE> where opt(x) and opt(y) are the boundaries used in simulation.<P>The movement of mobilenodes may be logged by using a procedure likethe following:<P><PRE>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}</PRE> In this case, mobilenode positions would be logged every 0.1 sec.<P><HR><!--Navigation Panel--><A NAME="tex2html3972" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3966" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3960" HREF="node173.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3968" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3970" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3973" HREF="node175.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node175.html">16.1.3 Network Components in</A><B> Up:</B> <A NAME="tex2html3967" HREF="node172.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node172.html">16.1 The basic wireless</A><B> Previous:</B> <A NAME="tex2html3961" HREF="node173.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node173.html">16.1.1 Mobilenode: creating wireless</A>   <B> <A NAME="tex2html3969" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3971" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -