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

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

Chapter 37PLMThis chapter describes the ns implementation of the PLM protocol [19]. The code of the PLM protocol is written in both C++and OTcl. The PLM Packet Pair generator is written in C++ and the PLM core machinery is written in OTcl. The chapterhas simply three parts: the first part shows how to create and configure a PLM session; the second part describes the PacketPair source generator; the third part describes the architecture and internals of the PLM protocol. In this last part, rather thangiving a list of procedures and functions, we introduce the main procedures per functionality (instantiation of a PLM source,instantiation of a PLM receiver, reception of a packet, detection of a loss, etc.).The procedures, functions, and variables described in this chapter can be found in: ~ns/plm/cbr-traffic-PP.cc, ~ns/plm/lossmonitor-plm.cc,~ns/tcl/plm/plm.tcl, ~ns/tcl/plm/plm-ns.tcl, ~ns/tcl/plm/plm-topo.tcl, ~ns/tcl/lib/ns-default.tcl.37.1 ConfigurationCreating a simple scenario with one PLM flow (only one receiver)This simple example can be run as is (several complex scenarios can be found in the file ~ns/tcl/ex/simple-plm.tcl).set packetSize 500set plm_debug_flag 2set rates "50e3 50e3 50e3 50e3 50e3"set rates_cum [calc_cum $rates]set level [llength $rates]set Queue_sched_ FQset PP_burst_length 2set PP_estimation_length 3;#Packet size (in bytes);#Debugging output;#Rate of each layer;#Cumulated rate of the layers (mandatory);#Number of layers (mandatory);#Scheduling of the queues;#PP burst length (in packets);#Minimum number of PP required to make an estimateClass Scenario0 -superclass PLMTopologyScenario0 instproc init args {eval $self next $args$self instvar ns node$self build_link 1 2 100ms 256Kbset addr(1) [$self place_source 1 3]$self place_receiver 2 $addr(1) 5 1;#Build a link;#Set a PLM source;#Set a PLM receiver323

#set up the multicast routingDM set PruneTimeout 1000set mproto DMset mrthandle [$ns mrtproto $mproto {} ]};#A large PruneTimeout value is requiredset ns [new Simulator -multicast on]$ns multicast$ns namtrace-all [open out.nam w]set scn [new Scenario0 $ns]$ns at 20 "exit 0"$ns run;#PLM needs multicast routing;#Nam output;#Call of the scenarioSeveral variables are introduced in this example. They all need to be set in the simulation script (there is no default value forthese variables). In particular the two following lines are mandatory and must not be omitted:set rates_cum [calc_cum $rates]set level [llength $rates]We describe now in detail each variable:packetSize represents the size of the packets in bytes sent by the PLM source.plm_debug_flag represents the verbose level of debugging output: from 0 no output to 3 full output. Forplm_debug_flag set to 3 (full output), long lines output are generated which is not compatible with nam visualization.rates is a list specifying the bandwidth of each layer (this is not the cumulated bandwidth!).rates_cum is a list specifying the cumulated bandwidth of the layers: the first element of rates_cum is the bandwidtha layer 1, the second element of rates_cum is the sum of the bandwidth of layer 1 and layer 2, etc. The proccalc_cum{} computes the cumulated rates.level is the number of layers.Queue_sched_ represents the scheduling of the queues. This is used by the PLMTopology instproc build_link. PLMrequires FQ scheduling or a variation.PP_burst_length represents the size of the Packet Pair bursts in packets.PP_estimation_length represents the minimum number of Packet Pair required to compute an estimate (see section37.3.3).All the simulations for PLM should be setup using the PLMTopology environment (as in the example script where we definea PLMTopology superclass called Scenario0). The user interface is (all the instproc can be found in ~ns/tcl/plm/plm-topo.tcl):build_link a b d bw creates a duplex link between node a and b with a delay d and a bandwidth bw. If either nodedoes not exist, build_link creates it.place_source n t creates and places a PLM source at node n and starts it at time t. place_source returns addrwhich allows to attach receivers to this source.324

#set up the multicast routingDM set PruneTimeout 1000set mproto DMset mrth<strong>and</strong>le [$<strong>ns</strong> mrtproto $mproto {} ]};#A large PruneTimeout value is requiredset <strong>ns</strong> [new Simul<strong>at</strong>or -multicast on]$<strong>ns</strong> multicast$<strong>ns</strong> namtrace-all [open out.nam w]set scn [new Scenario0 $<strong>ns</strong>]$<strong>ns</strong> <strong>at</strong> 20 "exit 0"$<strong>ns</strong> run;#PLM needs multicast routing;#Nam output;#Call of the scenarioSeveral variables are introduced in this example. <strong>The</strong>y all need to be set in the simul<strong>at</strong>ion script (there is no default value forthese variables). In particular the two following lines are m<strong>and</strong><strong>at</strong>ory <strong>and</strong> must not be omitted:set r<strong>at</strong>es_cum [calc_cum $r<strong>at</strong>es]set level [llength $r<strong>at</strong>es]We describe now in detail each variable:packetSize represents the size of the packets in bytes sent by the PLM source.plm_debug_flag represents the verbose level of debugging output: from 0 no output to 3 full output. Forplm_debug_flag set to 3 (full output), long lines output are gener<strong>at</strong>ed which is not comp<strong>at</strong>ible with nam visualiz<strong>at</strong>ion.r<strong>at</strong>es is a list specifying the b<strong>and</strong>width of each layer (this is not the cumul<strong>at</strong>ed b<strong>and</strong>width!).r<strong>at</strong>es_cum is a list specifying the cumul<strong>at</strong>ed b<strong>and</strong>width of the layers: the first element of r<strong>at</strong>es_cum is the b<strong>and</strong>widtha layer 1, the second element of r<strong>at</strong>es_cum is the sum of the b<strong>and</strong>width of layer 1 <strong>and</strong> layer 2, etc. <strong>The</strong> proccalc_cum{} computes the cumul<strong>at</strong>ed r<strong>at</strong>es.level is the number of layers.Queue_sched_ represents the scheduling of the queues. This is used by the PLMTopology i<strong>ns</strong>tproc build_link. PLMrequires FQ scheduling or a vari<strong>at</strong>ion.PP_burst_length represents the size of the Packet Pair bursts in packets.PP_estim<strong>at</strong>ion_length represents the minimum number of Packet Pair required to compute an estim<strong>at</strong>e (see section37.3.3).All the simul<strong>at</strong>io<strong>ns</strong> for PLM should be setup using the PLMTopology environment (as in the example script where we definea PLMTopology superclass called Scenario0). <strong>The</strong> user interface is (all the i<strong>ns</strong>tproc can be found in ~<strong>ns</strong>/tcl/plm/plm-topo.tcl):build_link a b d bw cre<strong>at</strong>es a duplex link between node a <strong>and</strong> b with a delay d <strong>and</strong> a b<strong>and</strong>width bw. If either nodedoes not exist, build_link cre<strong>at</strong>es it.place_source n t cre<strong>at</strong>es <strong>and</strong> places a PLM source <strong>at</strong> node n <strong>and</strong> starts it <strong>at</strong> time t. place_source retur<strong>ns</strong> addrwhich allows to <strong>at</strong>tach receivers to this source.324

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

Saved successfully!

Ooh no, something went wrong!