Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

DevPkt Class Reference

The Packet Device class. More...

#include <devPkt.h>

Inherits DEDevice.

Inheritance diagram for DevPkt:

Inheritance graph
[legend]
Collaboration diagram for DevPkt:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Initialize ()
 Initialize function.
 DevPkt (DESystem *_System, DevPktGen *_thePktGen, DevAP *_theAP, int _ID)
 Contructor.
virtual const char * Type () const
 This will allow the events and such to print debugging informations in a meaningful way.
void HEv_Pkt_Feedback (int type)
 Handler for the Ev_Pkt_Feedback event.

Static Public Member Functions

void setup (ParamManager *Param, GlobalProbeManager *Results)
 Setup function, where the parameters are defined.

Protected Attributes

int ID
 ID of the device, useful for debugging purposes.
DevAP * theAP
 The Access Point.
DevPktGen * thePktGen
 The DevPkt generator.
double meanWaitingSlots
 Mean waiting time (in slots) before a retransmission.
DETime generationTime
 The packet generation time.
int attempt_counter
 The number of transmission attemts.
ProbeHistogram * theTxTimeProbeHist
 Probe for the time of transmission of a packet.
ProbeHistogram * theTxAttemptsProbeHist
 Probe for the transmission attemts.

Detailed Description

The Packet Device class.

This class send a packet to the DevAP, wait for the ACK/NACK and eventually send it again.

Definition at line 31 of file devPkt.h.


Constructor & Destructor Documentation

DevPkt::DevPkt (  DESystem *  _System,
DevPktGen *  _thePktGen,
DevAP *  _theAP,
int  _ID
) 
 

Contructor.

Remember to clear variables for initialization in Initialize().

Do NOT initialize variables here unless they are constants.

Definition at line 20 of file devPkt.cpp.

References theTxAttemptsProbeHist, and theTxTimeProbeHist.

00025 : DEDevice(_System), thePktGen(_thePktGen), theAP(_theAP), ID(_ID),
00026   attempt_counter(1)
00027 {
00028   theTxTimeProbeHist = 0;
00029   theTxAttemptsProbeHist = 0;
00030 };


Member Function Documentation

void DevPkt::HEv_Pkt_Feedback (  int  type  ) 
 

Handler for the Ev_Pkt_Feedback event.

The feedback (ACK/NACK) is received here.

If we get an ACK, some measures are done and the instance is deleted. Otherwise the packet is rescheduled for another transmission attempt at the right time (again, a synchronization is due).

Definition at line 73 of file devPkt.cpp.

References DevPktGen::AddBacklogged(), attempt_counter, meanWaitingSlots, DEDevice::newEvent(), ProbeHistogram::Observe(), DevPktGen::RemoveTerminal(), rndGeometric0(), theAP, thePktGen, theTxAttemptsProbeHist, theTxTimeProbeHist, time_int, and DETime::ToBeginOfTheNextUsefulStep().

00074 {
00075   if( type == 0 ) {
00076     double foo = *T-generationTime;
00077     theTxTimeProbeHist->Observe(foo);
00078     theTxAttemptsProbeHist->Observe(attempt_counter);
00079     
00080     thePktGen->RemoveTerminal(this);
00081     delete this;
00082   }
00083   else {
00084     thePktGen->AddBacklogged();
00085     attempt_counter++;
00086     DETime foo = DETime( time_int(rndGeometric0(meanWaitingSlots)), time_int(0), time_int(0));
00087     newEvent(new Ev_AP_Packet_Arrival(theAP, this), foo + T->ToBeginOfTheNextUsefulStep() );  
00088   }
00089 }

Here is the call graph for this function:

void DevPkt::Initialize (   )  [virtual]
 

Initialize function.

Here is where the parameters are read and the real initialization takes place.

Note (again) that this function can be called multiple times; hence, you must clear previous instances.

Here we send the packet to the Access Pointer the first time. Since we cannot be sure to be at the start of a slot, we send it with a delay corresponding to this difference. I.e., we do a small synchronization.

About the theTxTimeProbeHist, we set its bin to a nonstandard value to allow a meaningful measure.

Reimplemented from DEDevice.

Definition at line 48 of file devPkt.cpp.

References DETime::BeginOfTheNextUsefulStep(), generationTime, meanWaitingSlots, DEDevice::newEvent(), theAP, theTxAttemptsProbeHist, theTxTimeProbeHist, and time_int.

Referenced by DevPktGen::HEv_PktGen_Generation(), and DevPktGen::Initialize().

00049 {
00050   meanWaitingSlots = get<DoubleParameter,double>(Param, "meanWaitingSlots", "Dev_Test_Pkt", "");
00051   
00052   DETime oneSlot = DETime(time_int(1), time_int(0), time_int(0));
00053   if( theTxTimeProbeHist )
00054     delete( theTxTimeProbeHist );
00055   theTxTimeProbeHist = Results->getGlobalProbeHistogram("TxTime", double(oneSlot));
00056   
00057   if( theTxAttemptsProbeHist )
00058     delete( theTxAttemptsProbeHist );
00059   theTxAttemptsProbeHist = Results->getGlobalProbeHistogram("TxAttempts");
00060 
00061   generationTime = T->BeginOfTheNextUsefulStep();
00062   
00063   newEvent(new Ev_AP_Packet_Arrival(theAP, this), T->ToBeginOfTheNextUsefulStep());
00064 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Dec 22 23:26:52 2004 for NePSing Slotted Aloha example by doxygen 1.3.9.1 ---- Hosted by SourceForge.net Logo