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

📄 node38.html

📁 相关搜索: ns2仿真结果分析 all-awk ns2 ns2 无限网络中awk文件 ... [2.tcl.rar] - 在ns2平台上实现对AODV协议的模拟
💻 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>4.3 Other Methods</TITLE><META NAME="description" CONTENT="4.3 Other Methods"><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="previous" HREF="node32.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node32.html"><LINK REL="up" HREF="node30.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node30.html"><LINK REL="next" HREF="node39.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node39.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html1895"  HREF="node39.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node39.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html1889"  HREF="node30.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node30.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html1885"  HREF="node37.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node37.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html1891"  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="tex2html1893"  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="tex2html1896"  HREF="node39.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node39.html">5. Nodes and Packet</A><B> Up:</B> <A NAME="tex2html1890"  HREF="node30.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node30.html">4. The Class Simulator</A><B> Previous:</B> <A NAME="tex2html1886"  HREF="node37.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node37.html">4.2.5 Precision of the</A> &nbsp <B>  <A NAME="tex2html1892"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html1894"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION03130000000000000000"></A><A NAME="sec:other"></A><BR>4.3 Other Methods</H1><P>The <TT>Simulator</TT> class provides a number of methods usedto set up the simulation.They generally fall into three categories:methods to create and manage the topology (which in turn consists ofmanaging the nodesChapterchap:nodes andmanaging the linksChapterchap:links),methods to perform tracingChapterchap:trace,and helper functions to deal with the scheduler.The following is a list of the non-topology related simulator methods:<PRE>Simulator instproc now {} # return scheduler's notion of current time;Simulator instproc at args # schedule execution of code at specified time;Simulator instproc cancel args # cancel event;Simulator instproc run args # start scheduler;Simulator instproc halt {} # stop (pause) the scheduler;Simulator instproc flush-trace {} # flush all trace object write buffers;Simulator instproc create-trace { type files src dst } # create trace object;Simulator instproc create_packetformat # set up the simulator's packet format;\clearpage\section{Commands at a glance}\label{sec:simcommand}\begin{flushleft}Synopsis:{\tt ns \\&lt;otclfile\\&gt; \\&lt;arg\\&gt; \\&lt;arg\\&gt;..}\\Description:Basic command to run a simulation script in ns.The simulator (ns) is invoked  via the ns interpreter, an extension of thevanilla otclsh command shell. A simulation is defined by a OTcl script(file). Several examples of OTcl scripts can be found under \ns/tcl/exdirectory.The following is a list of simulator commands commonly used in simulationscripts:{\tt set ns\_ [new Simulator]}\\This command creates an instance of the simulator object.{\tt set now [\$ns\_ now]}\\The scheduler keeps track of time in a simulation. This returns scheduler'snotion of current time.{\tt \$ns\_ halt}\\This stops or pauses the scheduler.{\tt \$ns\_ run}\\This starts the scheduler.{\tt \$ns\_ at \\&lt;time\\&gt; \\&lt;event\\&gt;}\\This schedules an \&lt;event\&gt; (which is normally a piece of code) to be executedat the specified \&lt;time\&gt;.e.g $ns_ at $opt(stop) "puts \"NS EXITING..\" ; $ns_ halt"or, $ns_ at 10.0 "$ftp start"{\tt \$ns\_ cancel \\&lt;event\\&gt;}\\Cancels the event. In effect, event is removed from scheduler's list of ready to run events.{\tt \$ns\_ create-trace \\&lt;type\\&gt; \\&lt;file\\&gt; \\&lt;src\\&gt; \\&lt;dst\\&gt; \\&lt;optional arg: op\\&gt;}\\This creates a trace-object of type \&lt;type\&gt; between \&lt;src\&gt; and \&lt;dst\&gt; objectsand attaches trace-object to \&lt;file\&gt; for writing trace-outputs. If op is definedas "nam", this creates nam tracefiles; otherwise if op is not defined, nstracefiles are created on default.{\tt \$ns\_  flush-trace}\\Flushes all trace object write buffers.{\tt \$ns\_ gen-map}\\This dumps information like nodes, node components, links etc created for agiven simulation. This may be broken for some scenarios (like wireless).{\tt \$ns\_ at-now \\&lt;args\\&gt;}\\This is in effect like command "$ns_ at $now $args". Note that this functionmay not work because of tcl's string number resolution.These are additional simulator (internal) helper functions (normally usedfor developing/changing the ns core code) :{\tt \$ns\_ use-scheduler \\&lt;type\\&gt;}\\Used to specify the type of scheduler to be used for simulation. The differenttypes of scheduler available are List, Calendar, Heap and RealTime. CurrentlyCalendar is used as default.{\tt \$ns\_ after \\&lt;delay\\&gt; \\&lt;event\\&gt;}\\Scheduling an \&lt;event\&gt; to be executed after the lapse of time \&lt;delay\&gt;.{\tt \$ns\_ clearMemTrace}\\Used for memory debugging purposes.{\tt \$ns\_ is-started}\\This returns true if simulator has started to run and false if not.{\tt \$ns\_ dumpq}\\Command for dumping events queued in scheduler while scheduler is halted.{\tt \$ns\_ create\_packetformat}\\This sets up simulator's packet format.\end{flushleft}</PRE><BR><HR><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

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