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

📄 applications.tex

📁 柯老师网站上找到的
💻 TEX
📖 第 1 页 / 共 2 页
字号:
\code{packetSize\_} & the constant size of the packets generated\\\code{burst\_time\_} & the average ``on'' time for the generator\\\code{idle\_time\_} & the average ``off'' time for the generator\\\code{rate\_} & the sending rate during ``on'' times\\\end{alist}Hence a new Exponential On/Off traffic generator can be created and parameterized as follows:\begin{program}        set e [new Application/Traffic/Exponential]        $e set packetSize_ 210        $e set burst_time_ 500ms        $e set idle_time_ 500ms        $e set rate_ 100k\end{program}\paragraph{Pareto On/Off}A Pareto On/Off object is embodied in the OTcl class Application/Traffic/Pareto.The member variables that parameterize this object are:\begin{alist}\code{packetSize\_} & the constant size of the packets generated\\\code{burst\_time\_} & the average "on" time for the generator\\\code{idle\_time\_} & the average "off" time for the generator\\\code{rate\_} & the sending rate during "on" times\\\code{shape\_} & the "shape" parameter used by the pareto distribution\\\end{alist}A new Pareto On/Off traffic generator can be created as follows:\begin{program}        set p [new Application/Traffic/Pareto]        $p set packetSize_ 210        $p set burst_time_ 500ms        $p set idle_time_ 500ms        $p set rate_ 200k        $p set shape_ 1.5\end{program}\paragraph{CBR}A CBR  object is embodied in the OTcl classApplication/Traffic/CBR.  The member variables that parameterize thisobject are:  \begin{alist}\code{rate\_} & the sending rate \\\code{interval\_} & (Optional) interval between packets \\\code{packetSize\_} & the constant size of the packets generated\\\code{random\_} & flag indicating whether or not to introduce random ``noise'' in the scheduled departure times (default is off)\\\code{maxpkts\_} & the maximum number of packets to send (default is (\(2^28\))\\\end{alist}Hence a new CBR traffic generator can be created and parameterizedas follows:\begin{program}        set e [new Application/Traffic/CBR]        $e set packetSize_ 48        $e set rate_ 64Kb        $e set random_ 1\end{program}The setting of a CBR object's \code{rate_} and \code{interval_} are mutuallyexclusive (the interval between packets is maintained as an interval variable in C++,and some example \ns~scripts specify an interval rather than a rate).  Ina simulation, either a rate or an interval (but not both) should be specified for a CBR object.  \paragraph{Traffic Trace}A Traffic Trace object is instantiated by the OTcl class Application/Traffic/Trace.The associated class Tracefile is used to enable multiple Traffic/Trace objects to be associated with a single trace file.The Traffic/Trace class uses the method attach-tracefile to associatea Traffic/Trace object with a particular Tracefile object.The method filename of the Tracefile class associates a trace filewith the Tracefile object.The following example shows how to create two Application/Traffic/Trace objects,each associated with the same trace file(called "example-trace" in this example).To avoid synchronization of the traffic generated,random starting places within the trace file are chosen foreach Traffic/Trace object.\begin{program}        set tfile [new Tracefile]        $tfile filename example-trace        set t1 [new Application/Traffic/Trace]        $t1 attach-tracefile $tfile        set t2 [new Application/Traffic/Trace]        $t2 attach-tracefile $tfile\end{program}\subsection{An example}The following code illustrates the basic steps to configure an Exponentialtraffic source over a UDP agent, for traffic flowing from node \code{s1} to node \code{k1}:\begin{program}        set src [new Agent/UDP]        set sink [new Agent/UDP]        $ns_ attach-agent $node_(s1) $src        $ns_ attach-agent $node_(k1) $sink        $ns_ connect $src $sink	        set e [new Application/Traffic/Exponential]        $e attach-agent $src        $e set packetSize_ 210        $e set burst_time_ 500ms        $e set idle_time_ 500ms        $e set rate_ 100k        $ns_ at 0.0 "$e start"\end{program}\section{Simulated applications:  Telnet and FTP}\label{sec:simapps} There are currently two ``simulate application'' classes derived from Application:Application/FTP and Application/Telnet.  These classes work by advancing thecount of packets available to be sent by a TCP transport agent.The actual transmission of available packets is still controlled by TCP's flow and congestion control algorithm. \paragraph{Application/FTP} Application/FTP, implemented in OTcl, simulates bulk data transfer.  The following are methods of the Application/FTP class:\begin{alist}\code{attach-agent} & attaches an Application/FTP object to an agent.\\ \code{start} & start the Application/FTP by calling the TCP agent's \code{send(-1)} function, which causes TCP to behave as if the application were continuously sending new data.\\\code{stop} & stop sending.\\ \code{produce n} &  set the counter of packets to be sent to $n$.\\ \code{producemore n} &  increase the counter of packets to be sent by $n$. \\\code{send n} & similar to \code{producemore}, but sends $n$ bytes instead ofpackets.  \end{alist} \paragraph{Application/Telnet} Application/Telnet objects generate packets in one of two ways.If the member variable \code{interval_} is non-zero,then inter-packet times are chosenfrom an exponential distribution with average equal to \code{interval_}.If \code{interval_} is zero, then inter-arrival times are chosenaccording to the tcplib distribution (see tcplib-telnet.cc).The start method starts the packet generation process.\section{Applications objects} \label{sec:appobjects} An application object may be of two types, a traffic generator or asimulated application. Traffic generator objects generate traffic and canbe of four types, namely, exponential, pareto, CBR and traffic trace. \begin{description} \item[Application/Traffic/Exponential objects]Exponential traffic objects generate On/Off traffic. During "on" periods,packets are generated at a constant burst rate. During "off" periods, notraffic is generated. Burst times and idle times are taken fromexponential distributions. Configuration parameters are:  \begin{description} \item[PacketSize\_] constant size of packets generated.\item[burst\_time\_] average on time for generator. \item[idle\_time\_] average off time for generator.  \item[rate\_] sending rate during on time.  \end{description}\item[Application/Traffic/Pareto] Application/Traffic/Pareto objects generate On/Off traffic with bursttimes and idle times taken from pareto distributions. Configurationparameters are:\begin{description}\item[PacketSize\_] constant size of packets generated.\item[burst\_time\_] average on time for generator.\item[idle\_time\_] average off time for generator.\item[rate\_] sending rate during on time.\item[shape\_] the shape parameter used by pareto distribution.\end{description}\item[Application/Traffic/CBR]CBR objects generate packets at a constant bit rate. \code{$cbr start}\\Causes the source to start generating packets. \code{$cbr stop}\\Causes the source to stop generating packets. Configuration parameters are:\begin{description}\item[PacketSize\_] constant size of packets generated. \item[rate\_] sending rate.\item[interval\_] (optional) interval between packets.\item[random\_] whether or not to introduce random noise in the scheduleddeparture times. defualt is off.\item[maxpkts\_] maximum number of packets to send.\end{description}\item[Application/Traffic/Trace]Application/Traffic/Trace objects are used to generate traffic from atrace file. \code{$trace attach-tracefile tfile}\\Attach the Tracefile object tfile to this trace. The Tracefile objectspecifies the trace file from which the traffic data is to be read.Multiple Application/Traffic/Trace objects can be attachedto the same Tracefile object. A random starting place within the Tracefileis chosen for each Application/Traffic/Trace object. \\There are no configuration parameters for this object. \end{description}A simulated application object can be of two types, Telnet and FTP.\begin{description}\item[Application/Telnet]TELNET objects produce individual packets with inter-arrival times asfollows. If interval\_ is non-zero, then inter-arrival times are chosenfrom an exponential distribution with average interval\_. If interval\_ iszero, then inter-arrival times are chosen using the "tcplib" telnetdistribution. \code{$telnet start}\\Causes the Application/Telnet object to start producing packets. \code{$telnet stop}\\Causes the Application/Telnet object to stop producing packets. \code{$telnet attach <agent>}\\Attaches a Telnet object to agent. Configuration Parameters are:\begin{description}\item[interval\_]The average inter-arrival time in seconds for packets generated by theTelnet object. \end{description}\item[Application FTP]FTP objects produce bulk data for a TCP object to send. \code{$ftp start}\\Causes the source to produce maxpkts\_ packets. \code{$ftp produce <n>}\\Causes the FTP object to produce n packets instantaneously. \code{$ftp stop}\\Causes the attached TCP object to stop sending data. \code{$ftp attach agent}\\Attaches a Application/FTP object to agent. \code{$ftp producemore <count>}\\Causes the Application/FTP object to produce count more packets. Configuration Parameters are:\begin{description}\item[maxpkts] The maximum number of packets generated by the source. \end{description}\end{description}\textsc{Tracefile objects}Tracefile objects are used to specify the trace file that is to be usedfor generating traffic (see Application/Traffic/Trace objectsdescribed earlier in this section). \code{$tracefile} is an instance ofthe Tracefile Object. \code{$tracefile filename <trace-input>}\\Set the filename from which the traffic trace data is to be read totrace-input. There are no configuration parameters for this object. A trace fileconsists of any number of fixed length records. Each record consists of 232 bit fields. The first indicates the interval until the next packet isgenerated in microseconds. The second indicates the length of the nextpacket in bytes. \section{Commands at a glance}\label{sec:appscommand}Following are some transport agent and application related commandscommonly used in simulation scripts:\begin{flushleft}\begin{program}set tcp1 [new Agent/TCP]$ns_ attach-agent $node_(src) $tcp1set sink1 [new Agent/TCPSink]$ns_ attach-agent $node_(snk) $sink1$ns_ connect $tcp1 $sink1\end{program}This creates a source tcp agent and a destination sink agent. Both the transportagents are attached to their resoective nodes. Finally an end-to-end connectionis setup between the src and sink.\begin{program}set ftp1 [new Application/FTP]$ftp1 attach-agent $agent\end{program}or\code{set ftp1 [$agent attach-app FTP]}Both the above commands achieve the same. An application (ftp in this example)is created and attached to the source agent. An application can be of twotypes, a traffic generator or a simulated application.Types of Traffic generators currently present are: Application/Traffic/Exponential, Application/Traffic/Pareto,Application/Traffic/CBR, and Application/Traffic/Trace. See section \ref{sec:trafgenclass}for details.Types of simulated applications currently implemented are:Application/FTP and Application/Telnet. See  section \ref{sec:simapps} fordetails.\end{flushleft}\endinput

⌨️ 快捷键说明

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