38.2 The Packet Pair Source Generator

This section describes the Packet Pair source generator; the relevant files are: ~ns/plm/cbr-traffic-PP.cc, ~ns/tcl/lib/ns-default.tcl. The OTcl class name of the PP source is: Application/Traffic/CBR_PP. The Packet Pair (PP) source generator is in the file ~ns/plm/cbr-traffic-PP.cc. This source generator is a variation of the CBR source generator in ~ns/cbr_traffic.cc. We just describe the salient differences between the code of the CBR source and the code of the PP source. The default values in ~ns/tcl/lib/ns-default.tcl for the PP source generator are the same than for the CBR source. We need for the PP source generator a new parameter PBM_:
Application/Traffic/CBR_PP set PBM_ 2 #Default value;

The OTcl instvar bounded variable PBM_ (same name in C++ and in OTcl) specifies the number of back-to-back packets to be sent. For PBM_=1 we have a CBR source, for PBM_=2 we have a Packet Pair source (a source which sends two packets back-to-back), etc. The mean rate of the PP source is rate_, but the packets are sent in burst of PBM_ packets. Note that we also use the terminology Packet Pair source and Packet Pair burst for PBM_$>$2. We compute the next_interval as:

double CBR_PP_Traffic::next_interval(int& size)
{
/*(PP_ - 1) is the  number of packets in the current burst.*/
        if (PP_ \>= (PBM_ - 1)){         
                interval_ = PBM_*(double)(size_ \<\< 3)/(double)rate_;
                PP_ = 0;
        }
        else {
                interval_ = 1e-100; //zero
                PP_ += 1 ;
        }
...
}

The timeout method puts the NEW_BURST flag in the first packet of a burst. This is useful for the PLM protocol to identify the beginning of a PP burst.

  void CBR_PP_Traffic::timeout()
  {
    ...
    if (PP_ == 0) 
      agent_-\>sendmsg(size_, "NEW_BURST");
    else 
      agent_-\>sendmsg(size_);
    
    ...
    }

Tom Henderson 2011-11-05