SimpleNodeEntry Class Reference

#include <SimpleNodeEntry.h>

List of all members.


Detailed Description

representation of a single node in the GlobalRoutingHashMap

Author:
Bernhard Heep


Public Types

typedef std::pair< simtime_t,
bool > 
SimpleDelay
 type for return value of calcDelay()

Public Member Functions

 SimpleNodeEntry (cModule *node, cChannelType *type)
 Constructor.
cGate * getGate () const
 Getter for SimpleUDP ingate.
SimpleDelay calcDelay (const SimpleUDPPacket &msg, const SimpleNodeEntry &dest)
 Calculates delay between two nodes.
std::string info () const
 OMNeT++ info method.

Static Public Member Functions

static void setFieldSize (uint size)
 Setter for maximum coordinate.
static void setSendQueueLength (uint length)
 Setter for send queue length.

Protected Member Functions

float operator- (const SimpleNodeEntry &entry) const
 Calculates eulklidean distance between two terminals.

Protected Attributes

cGate * ingate
 ingate of the SimpleUDP module of this terminal
float x
 x-coordinate
float y
 y-coordinate
simtime_t txFinished
 send queue finished
simtime_t txMaxQueueTime
 maximum time for packets to be queued
simtime_t accessDelay
 first hop delay
float bandwidth
 bandwidth in access net
float errorRate
 packet loss rate

Static Protected Attributes

static uint fieldSize
 maximum coordinates
static uint sendQueueLength
 maximum send queue length of overlay terminals in bytes

Friends

std::ostream & operator<< (std::ostream &out, const SimpleNodeEntry &entry)
 Stream output.


Member Typedef Documentation

typedef std::pair<simtime_t, bool> SimpleNodeEntry::SimpleDelay

type for return value of calcDelay()


Constructor & Destructor Documentation

SimpleNodeEntry::SimpleNodeEntry ( cModule *  node,
cChannelType *  type 
)

Constructor.

Parameters:
node pointer to new terminal
type access channel of new terminal
00035 {
00036     ingate = node->submodule("udp")->gate("network_in");
00037 
00038     x = uniform(0, fieldSize);
00039     y = uniform(0, fieldSize);
00040 
00041     cBasicChannel* temp = dynamic_cast<cBasicChannel*>(type->create("temp"));
00042 
00043     bandwidth = temp->datarate();
00044     errorRate = temp->error();
00045     accessDelay = temp->delay();
00046 
00047     txMaxQueueTime = ((float)sendQueueLength * 8) / bandwidth;
00048     txFinished = simulation.simTime(); // 0?
00049 
00050     delete temp;
00051 }


Member Function Documentation

SimpleNodeEntry::SimpleDelay SimpleNodeEntry::calcDelay ( const SimpleUDPPacket msg,
const SimpleNodeEntry dest 
)

Calculates delay between two nodes.

Parameters:
msg reference to message to get its length for delay calculation,
dest destination terminal
Returns:
delay in s and boolean value that is false if message should be deleted
00059 {
00060     if (uniform(0, 1) < errorRate || uniform(0, 1) < dest.errorRate)
00061         return SimpleDelay(0, false);
00062 
00063     simtime_t now = simulation.simTime();
00064     simtime_t bandwidthDelay= ((msg.byteLength() * 8) / bandwidth);
00065     simtime_t newTxFinished = fmax(txFinished, now) + bandwidthDelay;
00066 
00067     // send queue
00068     if((newTxFinished > now + txMaxQueueTime) && (txMaxQueueTime != 0)) {
00069         EV << "(SimpleNodeEntry::calcDelay()) send queue overrun!\n"
00070         << "                  newTxFinished = fmax(txFinished, now) + bandwidthDelay\n"
00071         << "                  newTxFinished = " << newTxFinished
00072         << "\n                  txFinished = " << txFinished
00073         << "\n                  now = " << now
00074         << "\n                  bandwidthDelay = " << bandwidthDelay
00075         << "\n                  (newTxFinished > now + txMaxQueueTime) == true"
00076         << "\n                  txMaxQueueTime = " << txMaxQueueTime << endl;
00077 
00078         return SimpleDelay(0, false);
00079     }
00080 
00081     txFinished = newTxFinished;
00082 
00083     simtime_t destBandwidthDelay = (msg.byteLength() * 8) / dest.bandwidth;
00084     simtime_t coordDelay = 0.001 * (*this - dest);
00085 
00086     return SimpleDelay(txFinished + coordDelay + destBandwidthDelay - now, true);
00087 }

cGate* SimpleNodeEntry::getGate (  )  const [inline]

Getter for SimpleUDP ingate.

Returns:
the ingate
00057     {
00058         return ingate;
00059     };

std::string SimpleNodeEntry::info (  )  const

OMNeT++ info method.

Returns:
infostring
00090 {
00091     std::ostringstream str;
00092     str << *this;
00093     return str.str();
00094 }

float SimpleNodeEntry::operator- ( const SimpleNodeEntry entry  )  const [protected]

Calculates eulklidean distance between two terminals.

Parameters:
entry destination entry
Returns:
the euklidean distance
00054 {
00055     return sqrt(pow(x - entry.x, 2) + pow(y - entry.y, 2));
00056 }

static void SimpleNodeEntry::setFieldSize ( uint  size  )  [inline, static]

Setter for maximum coordinate.

Parameters:
size maximum coordinate
00067     {
00068         fieldSize = size;
00069     };

static void SimpleNodeEntry::setSendQueueLength ( uint  length  )  [inline, static]

Setter for send queue length.

Parameters:
length send queue length
00077     {
00078         sendQueueLength = length;
00079     };


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const SimpleNodeEntry entry 
) [friend]

Stream output.

Parameters:
out output stream
entry the terminal
Returns:
reference to stream out
00097 {
00098     out << "(x:" << entry.x << ", y:" << entry.y
00099     << ")\nbandwidth = " << entry.bandwidth
00100     << ",\ndelay = " << entry.accessDelay
00101     << ",\ntxMaxQueueTime = " << entry.txMaxQueueTime
00102     << ",\ntxFinished = " << entry.txFinished;
00103 
00104     return out;
00105 }


Member Data Documentation

simtime_t SimpleNodeEntry::accessDelay [protected]

first hop delay

float SimpleNodeEntry::bandwidth [protected]

bandwidth in access net

float SimpleNodeEntry::errorRate [protected]

packet loss rate

uint SimpleNodeEntry::fieldSize [static, protected]

maximum coordinates

cGate* SimpleNodeEntry::ingate [protected]

ingate of the SimpleUDP module of this terminal

uint SimpleNodeEntry::sendQueueLength [static, protected]

maximum send queue length of overlay terminals in bytes

simtime_t SimpleNodeEntry::txFinished [protected]

send queue finished

simtime_t SimpleNodeEntry::txMaxQueueTime [protected]

maximum time for packets to be queued

float SimpleNodeEntry::x [protected]

x-coordinate

float SimpleNodeEntry::y [protected]

y-coordinate


The documentation for this class was generated from the following files:
Generated on Fri May 11 14:52:40 2007 for ITM OverSim by  doxygen 1.4.7