next up previous contents index
Next: 30.3 Architecture of the Up: 30. PLM Previous: 30.1.0.0.1 Creating a simple

30.2 The Packet Pair Source Generator

This section describes the Packet Pair source generator; the relevant files are: plm/cbr-traffic-PP.cc, 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 plm/cbr-traffic-PP.cc. This source generator is a variation of the CBR source generator in 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 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\_);
    
    ...
    }


next up previous contents index
Next: 30.3 Architecture of the Up: 30. PLM Previous: 30.1.0.0.1 Creating a simple

2000-08-24