39.1.0.0.1 Creating 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 500                          #Packet size (in bytes);
  set plm_debug_flag 2                        #Debugging output;
  set rates "50e3 50e3 50e3 50e3 50e3"        #Rate of each layer;
  set rates_cum [calc_cum $rates]       #Cumulated rate of the layers (mandatory);
  set level [llength $rates]            #Number of layers (mandatory);
  
  set Queue_sched_ FQ                         #Scheduling of the queues;
  set PP_burst_length 2                       #PP burst length (in packets);
  set PP_estimation_length 3                  #Minimum number of PP required to make an estimate;

  Class Scenario0 -superclass PLMTopology
  Scenario0 instproc init args {
    eval $self next $args
    $self instvar ns node
    
    $self build_link 1 2 100ms 256Kb           #Build a link;
    set addr(1) [$self place_source 1 3]      #Set a PLM source;
    $self place_receiver 2 $addr(1) 5 1       #Set a PLM receiver;
    
#set up the multicast routing
    DM set PruneTimeout 1000                  #A large PruneTimeout value is required;
    set mproto DM
    set mrthandle [$ns mrtproto $mproto {} ]
    }


  set ns [new Simulator -multicast on]            #PLM needs multicast routing;
  $ns multicast
  $ns namtrace-all [open out.nam w]               #Nam output;
  set scn [new Scenario0 $ns]                     #Call of the scenario;
  $ns at 20 "exit 0"
  $ns run

Several variables are introduced in this example. They all need to be set in the simulation script (there is no default value for these 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. For plm_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 bandwidth a layer 1, the second element of rates_cum is the sum of the bandwidth of layer 1 and layer 2, etc. The proc calc_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. PLM requires 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 section [*]).

All the simulations for PLM should be setup using the PLMTopology environment (as in the example script where we define a 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 node does 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 addr which allows to attach receivers to this source.
place_receiver n addr C nb
creates and places a PLM receiver at node n and attached it to the source which return the address addr. The check value for this PLM receiver is C. An optional parameter nb allows to get an instance of the PLM receiver called PLMrcvr($nb). This instance is only useful to get some specific statistics about this receiver (mainly the number of packets received or lost).

Tom Henderson 2014-12-17