#include <devAP.h>
Inherits DEDevice.
Inheritance diagram for DevAP:
Public Member Functions | |
void | Initialize () |
Initialize function. | |
DevAP (DESystem *_System) | |
Contructor. | |
virtual const char * | Type () const |
This will allow the events and such to print debugging informations in a meaningful way. | |
void | HEv_AP_Packet_Arrival (DevPkt *sender) |
Handler for the Ev_AP_Packet_Arrival event. | |
void | HEv_AP_SelfCheck () |
Handler for the Ev_AP_SelfCheck event. | |
Static Public Member Functions | |
void | setup (ParamManager *Param, GlobalProbeManager *Results) |
Setup function, where the parameters are defined. | |
Protected Attributes | |
DETime | halfSlot |
DETime creation is slow, better to mem it and keep. | |
list< DevPkt * > | queue |
the list of the packets recived in a given slot. | |
DETime | RoundTripDelay |
the time needed to send back the answer to the DevPkt. | |
ProbeBand * | theBandProbe |
probe for the long term throughput. Dynamically created. | |
ProbeBandSlice * | theBandSliceProbe |
probe for the short term throughput. Dynamically created. |
This class will detect the collisions and will send the acknowledgment to the sender.
Note that it is impossible to 'see' how many events of a given type are in the NePSing scheduling queus for a given time, as they will be executed sequentially even if they have the same execution time. Hence, in order to detect a collision you must first collect the data about how many packets have been sent in a given slot and then process tham at a later time (usually half slot later).
A special note about the timings: NePSing events have an execution time (i.e., when they will be executed), but no duration. Hence, any event is executed instantaneously. To simulate a duration, a special care must be taken and the solution have to be tailored to your particular needs. See the DEEvent documentation for meore about this.
Definition at line 35 of file devAP.h.
|
Contructor. Remember to clear variables for initialization in Initialize(). Do NOT initialize variables here unless they are constants. Definition at line 17 of file devAP.cpp. References halfSlot, theBandProbe, theBandSliceProbe, and time_int. 00018 : DEDevice(_System) 00019 { 00020 theBandProbe = 0; 00021 theBandSliceProbe = 0; 00022 00023 halfSlot = DETime(time_int(1), time_int(0), time_int(0)) / 2; 00024 00025 };
|
|
Handler for the Ev_AP_Packet_Arrival event. This function is called when a packet arrives. It must store every packet in a list to check later if there was a collision. To do it, the Ev_AP_SelfCheck event is called. Only one Ev_AP_SelfCheck event must be generated, so the event generation is checked against the packet queue. Definition at line 58 of file devAP.cpp. References halfSlot, DEDevice::newEvent(), and queue. 00059 { 00060 if( queue.empty() ) 00061 newEvent(new Ev_AP_SelfCheck(this), halfSlot ); 00062 00063 queue.push_back(sender); 00064 }
|
Here is the call graph for this function:
|
Handler for the Ev_AP_SelfCheck event. This function does the actual collision check. If a collision occurs, a NACK is issued, otherwise an ACK is sent. If the packet is successfully transmitted, it is also measured the network throughput. Definition at line 71 of file devAP.cpp. References DEDevice::newEvent(), ProbeBandSlice::Observe(), ProbeBand::Observe(), queue, RoundTripDelay, theBandProbe, and theBandSliceProbe. 00072 { 00073 if( queue.size() == 1 ) { 00074 // no collision 00075 newEvent(new Ev_Pkt_Feedback(queue.front(), 0), RoundTripDelay ); 00076 theBandProbe->Observe(1.0); 00077 theBandSliceProbe->Observe(1.0); 00078 } 00079 else { 00080 // collisions 00081 list<DevPkt*>::iterator dtListIter; 00082 for( dtListIter=queue.begin(); dtListIter!=queue.end(); dtListIter++) 00083 newEvent(new Ev_Pkt_Feedback(*dtListIter, 1), RoundTripDelay ); 00084 } 00085 queue.clear(); 00086 }
|
Here is the call graph for this function:
|
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. Reimplemented from DEDevice. Definition at line 37 of file devAP.cpp. References queue, RoundTripDelay, theBandProbe, and theBandSliceProbe. Referenced by SysSAloha::Initialize(). 00038 { 00039 00040 RoundTripDelay = get<DETimeParameter,DETime>(Param, "RoundTripDelay", "SAloha", ""); 00041 00042 queue.clear(); 00043 00044 if( theBandProbe ) 00045 delete( theBandProbe ); 00046 theBandProbe = new ProbeBand( "theBand" ); 00047 00048 if( theBandSliceProbe ) 00049 delete( theBandSliceProbe ); 00050 theBandSliceProbe = new ProbeBandSlice( "theBandSlice" ); 00051 }
|