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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

set p [new Applic<strong>at</strong>ion/Traffic/Pareto]$p set packetSize_ 210$p set burst_time_ 500ms$p set idle_time_ 500ms$p set r<strong>at</strong>e_ 200k$p set shape_ 1.5CBR A CBR object is embodied in the OTcl class Applic<strong>at</strong>ion/Traffic/CBR. <strong>The</strong> member variables th<strong>at</strong> parameterize thisobject are:r<strong>at</strong>e_ the sending r<strong>at</strong>einterval_ (Optional) interval between packetspacketSize_ the co<strong>ns</strong>tant size of the packets gener<strong>at</strong>edr<strong>and</strong>om_ flag indic<strong>at</strong>ing whether or not to introduce r<strong>and</strong>om “noise” in the scheduled departure times (default isoff)maxpkts_ the maximum number of packets to send (default is (2 2 8)Hence a new CBR traffic gener<strong>at</strong>or can be cre<strong>at</strong>ed <strong>and</strong> parameterized as follows:set e [new Applic<strong>at</strong>ion/Traffic/CBR]$e set packetSize_ 48$e set r<strong>at</strong>e_ 64Kb$e set r<strong>and</strong>om_ 1<strong>The</strong> setting of a CBR object’s r<strong>at</strong>e_ <strong>and</strong> interval_ are mutually exclusive (the interval between packets is maintainedas an interval variable in C++, <strong>and</strong> some example <strong>ns</strong> scripts specify an interval r<strong>at</strong>her than a r<strong>at</strong>e). In a simul<strong>at</strong>ion, either ar<strong>at</strong>e or an interval (but not both) should be specified for a CBR object.Traffic Trace A Traffic Trace object is i<strong>ns</strong>tanti<strong>at</strong>ed by the OTcl class Applic<strong>at</strong>ion/Traffic/Trace. <strong>The</strong> associ<strong>at</strong>ed class Tracefileis used to enable multiple Traffic/Trace objects to be associ<strong>at</strong>ed with a single trace file. <strong>The</strong> Traffic/Trace class usesthe method <strong>at</strong>tach-tracefile to associ<strong>at</strong>e a Traffic/Trace object with a particular Tracefile object. <strong>The</strong> method filename ofthe Tracefile class associ<strong>at</strong>es a trace file with the Tracefile object. <strong>The</strong> following example shows how to cre<strong>at</strong>e two Applic<strong>at</strong>ion/Traffic/Traceobjects, each associ<strong>at</strong>ed with the same trace file (called "example-trace" in this example). To avoidsynchroniz<strong>at</strong>ion of the traffic gener<strong>at</strong>ed, r<strong>and</strong>om starting places within the trace file are chosen for each Traffic/Trace object.set tfile [new Tracefile]$tfile filename example-traceset t1 [new Applic<strong>at</strong>ion/Traffic/Trace]$t1 <strong>at</strong>tach-tracefile $tfileset t2 [new Applic<strong>at</strong>ion/Traffic/Trace]$t2 <strong>at</strong>tach-tracefile $tfile38.3.1 An example<strong>The</strong> following code illustr<strong>at</strong>es the basic steps to configure an Exponential traffic source over a UDP agent, for traffic flowingfrom node s1 to node k1:337

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

Saved successfully!

Ooh no, something went wrong!