📄 node339.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>28.1 The user level API</TITLE><META NAME="description" CONTENT="28.1 The user level API"><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="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html"><LINK REL="previous" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><LINK REL="up" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><LINK REL="next" HREF="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html6539" HREF="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html6533" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html6527" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html6535" 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="tex2html6537" 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="tex2html6540" HREF="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html">28.2 The Internal Architecture</A><B> Up:</B> <A NAME="tex2html6534" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html">28. Network Dynamics</A><B> Previous:</B> <A NAME="tex2html6528" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html">28. Network Dynamics</A>   <B> <A NAME="tex2html6536" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html6538" 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="SECTION05310000000000000000"></A><A NAME="sec:userAPI"></A><BR>28.1 The user level API</H1><P>The user level interface to network dynamics is a collection of instance procedures in the class Simulator,and one procedure to trace and log the dynamics activity.Reflecting a rather poor choice of names,these procedures are<TT>rtmodel</TT>, <TT>rtmodel-delete</TT>, and <TT>rtmodel-at</TT>.There is one other procedure, <TT>rtmodel-configure</TT>,that is used internally by the class Simulator to configurethe rtmodels just prior to simulation start.We describe this method laterSectionsec:nd-internal-arch.<DL COMPACT><DT>--<DD>The instance procedure[]rtmodel../ns-2/dynamics.tclSimulator::rtmodeldefines a model to be applied to the nodes and links in the topology.Some examples of this command as it would be used in a simulation script are:<PRE> $ns rtmodel Exponential {0.8 1.0 1.0} $n1 $ns rtmodel Trace dynamics.trc $n2 $n3 $ns rtmodel Deterministic {20.0 20.0} $node(1) $node(5)</PRE>The procedure requires at least three arguments:<UL><LI>The first two arguments define the model that will be used, and theparameters to configure the model.<P>The currently implemented models in areExponential (On/Off), Deterministic (On/Off), Trace (driven), orManual (one-shot) models.<P></LI><LI>The number, format, and interpretation of the configuration parametersis specific to the particular model.<OL><LI>The exponential on/off model takes four parameters:[start time], up interval, down interval, [finish time].start time defaults to from the start of the simulation,finish time defaults to the end of the simulation.up interval and down interval specifythe mean of the exponential distribution defining the timethat the node or link will be up and down respectively.The default up and down interval values are and respectively.Any of these values can be specified as ``'' to default to theoriginal value.<P>The following are example specifications of parameters to this model:<PRE> 0.8 1.0 1.0 # start at \(0.8s.\), up/down = \(1.0s.\), finish is default; 5.0 0.5 # start is default, up/down = \(5.0s, 0.5s.\), finish is default; - 0.7 # start, up interval are default, down = \(0.7s.\), finish is default; - - - 10 # start, up, down are default, finish at \(10s.\);</PRE><P></LI><LI>The deterministic on/off modelis similar to the exponential model above, and takes four parameters:[start time], up interval, down interval, [finish time].start time defaults to the start of the simulation,finish time defaults to the end of the simulation.Only the interpretation of the up and down interval is different;up interval and down interval specify the exact durationthat the node or link will be up and down respectively.The default values for these parameters are:start time is from start of simulation,up interval is ,down interval is , andfinish time is the duration of the simulation.</LI><LI>The trace driven model takes one parameter:the name of the trace file.The format of the input trace file is identical to that output by the dynamics trace modules, ,<TT>v time link-operation node1 node2</TT>.Lines that do not correspond to the node or link specified are ignored.<PRE> v 0.8123 link-up 3 5 v 3.5124 link-down 3 5</PRE></LI><LI>The manual one-shot model takes two parameters:the operation to be performed, and the time that it is to beperformed.</LI></OL><P></LI><LI>The rest of the arguments to the []rtmodel proceduredefine the node or link that the model will be applied to.If only one node is specified,it is assumed that the node will fail.This is modeled by making the links incident on the node fail.If two nodes are specified, then the command assumes thatthe two are adjacent to each other, and the model is applied to thelink incident on the two nodes.If more than two nodes are specified, only the first is considered,the subsequent arguments are ignored.<P></LI><LI>instance variable, <TT>traceAllFile_</TT> is set.</LI></UL>The command returns the handle to the model that was created in this call.<P>Internally, []rtmodel stores the list of route models createdin the class Simulator instance variable, <TT>rtModel_</TT>.<P><DT>--<DD>The instance procedure[]rtmodel-delete../ns-2/dynamics.tclSimulator::rtmodel-deletetakes the handle of a route model as argument, removes it from the<TT>rtModel_</TT> list, and deletes the route model.<P><DT>--<DD>The instance procedure[]rtmodel-at../ns-2/dynamics.tclSimulator::rtmodel-atis a special interface to the Manual model of network dynamics.<P>The command takes the time, operation, and node or link as arguments,and applies the operation to the node or link at the specified time.Example uses of this command are:<PRE> $ns rtmodel-at 3.5 up $n0 $ns rtmodel-at 3.9 up $n(3) $n(5) $ns rtmodel-at 40 down $n4</PRE></DD></DL><P>Finally, the instance procedure []trace-dynamics of the class rtModelenables tracing of the dynamics effected by this model.It is used as:<PRE> set fh [open "dyn.tr" w] $rtmodel1 trace-dynamics $fh $rtmodel2 trace-dynamics $fh $rtmodel1 trace-dynamics stdout</PRE>In this example, <TT>$rtmodel1</TT> writes out trace entries to bothdyn.tr and stdout; <TT>$rtmodel2</TT> only writes out trace entries to dyn.tr.A typical sequence of trace entries written out by either model might be:<PRE> v 0.8123 link-up 3 5 v 0.8123 link-up 5 3 v 3.5124 link-down 3 5 v 3.5124 link-down 5 3</PRE>These lines above indicate that Link 3, 5 failed at ,and recovered at time <P><HR><!--Navigation Panel--><A NAME="tex2html6539" HREF="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html6533" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html6527" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html6535" 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="tex2html6537" 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="tex2html6540" HREF="node340.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node340.html">28.2 The Internal Architecture</A><B> Up:</B> <A NAME="tex2html6534" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html">28. Network Dynamics</A><B> Previous:</B> <A NAME="tex2html6528" HREF="node338.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node338.html">28. Network Dynamics</A>   <B> <A NAME="tex2html6536" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html6538" 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 + -