Download OMNeT++
Transcript
OMNeT++ Manual – Simple Modules
pointer once, and cache it. When the network topology changes, the cached channel pointer
needs to be updated; section 4.14.3 describes the mechanism that can be used to get notifications about topology changes.
Receiving a Packet
As a result of error modeling in the channel, the packet may arrive with the bit error flag set
(hasBitError() method. It is the receiver module’s responsibility to examine this flag and
take appropriate action (i.e. discard the packet).
Normally the packet object gets delivered to the destination module at the simulation time
that corresponds to finishing the reception of the message (ie. the arrival of its last bit).
However, the receiver module may change this by “reprogramming” the receiver gate with the
setDeliverOnReceptionStart() method:
gate("in")->setDeliverOnReceptionStart(true);
This method may only be called on simple module input gates, and it instructs the simulation
kernel to deliver packets arriving through that gate at the simulation time that corresponds
to the beginning of the reception process. getDeliverOnReceptionStart() only needs to be
called once, so it is usually done in the initialize() method of the module.
B
A
C
D
delay=1ms
datarate=1Gbps
tA
tB
tC
tD
send()
with deliverOnReceptionStart=true
default
Figure 4.3: Packet transmission
When a packet is delivered to the module, the packet’s isReceptionStart() method can
be called to determine whether it corresponds to the start or end of the reception process
(it should be the same as the getDeliverOnReceptionStart() flag of the input gate), and
getDuration() returns the transmission duration.
The following example code prints the start and end times of a packet reception:
simtime_t startTime, endTime;
if (pkt->isReceptionStart())
{
// gate was reprogrammed with setDeliverOnReceptionStart(true)
startTime = pkt->getArrivalTime(); // or: simTime();
endTime = startTime + pkt->getDuration();
}
else
{
81
Related documents
OMNeT++ - Manual
OMNeT++
OMNeT++
OMNeT++ User Manual
Operating Instructions
OMNeT++ - Fossies
Introduction to Network Simulation Using OMNeT++ Contents 1
Simulating Queueing Networks with OMNeT++
ccnSim user manual - Sites personnels de TELECOM ParisTech
MS_CS_Adam_Cornachione - CS Home
GPS9000NZ
Apéndice C: Instalación y simulado de OMNeT++ C.1 Instalación de