SimpleNodeEntry Class Reference

#include <SimpleNodeEntry.h>

List of all members.


Detailed Description

representation of a single node in the BootstrapOracle

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.
simtime_t getAccessDelay ()
float getBandwith ()
float getErrorRate ()

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
00036 {
00037     ingate = node->submodule("udp")->gate("network_in");
00038 
00039     x = uniform(0, fieldSize);
00040     y = uniform(0, fieldSize);
00041 
00042     cBasicChannel* temp = dynamic_cast<cBasicChannel*>(type->create("temp"));
00043 
00044     bandwidth = temp->datarate();
00045     errorRate = temp->error();
00046     accessDelay = temp->delay();
00047 
00048     txMaxQueueTime = ((float)sendQueueLength * 8) / bandwidth;
00049     txFinished = simulation.simTime(); // 0?
00050 
00051     delete temp;
00052 }


Member Function Documentation

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

Getter for SimpleUDP ingate.

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

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     };

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
00060 {
00061     if (uniform(0, 1) < errorRate || uniform(0, 1) < dest.errorRate)
00062         return SimpleDelay(0, false);
00063 
00064     simtime_t now = simulation.simTime();
00065     simtime_t bandwidthDelay= ((msg.byteLength() * 8) / bandwidth);
00066     simtime_t newTxFinished = fmax(txFinished, now) + bandwidthDelay;
00067     
00068 
00069     // send queue
00070     if((newTxFinished > now + txMaxQueueTime) && (txMaxQueueTime != 0)) {
00071         EV << "[SimpleNodeEntry::calcDelay()]\n"
00072            << "    Send queue overrun"
00073            << "\n    newTxFinished = fmax(txFinished, now) + bandwidthDelay"
00074            << "\n    newTxFinished = " << newTxFinished
00075            << "\n    txFinished = " << txFinished
00076            << "\n    now = " << now
00077            << "\n    bandwidthDelay = " << bandwidthDelay
00078            << "\n    (newTxFinished > now + txMaxQueueTime) == true"
00079            << "\n    txMaxQueueTime = " << txMaxQueueTime
00080            << endl;
00081         return SimpleDelay(0, false);
00082     }
00083 
00084     txFinished = newTxFinished;
00085 
00086     simtime_t destBandwidthDelay = (msg.byteLength() * 8) / dest.bandwidth;
00087     simtime_t coordDelay = 0.001 * (*this - dest);
00088 
00089     return SimpleDelay(txFinished - now
00090                        + accessDelay
00091                        + coordDelay
00092                        + destBandwidthDelay + dest.accessDelay, true);
00093 }

std::string SimpleNodeEntry::info (  )  const

OMNeT++ info method.

Returns:
infostring
00096 {
00097     std::ostringstream str;
00098     str << *this;
00099     return str.str();
00100 }

simtime_t SimpleNodeEntry::getAccessDelay (  )  [inline]

00107 { return accessDelay; };

float SimpleNodeEntry::getBandwith (  )  [inline]

00109 { return bandwidth; };

float SimpleNodeEntry::getErrorRate (  )  [inline]

00111 { return errorRate; };    

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

Calculates eulklidean distance between two terminals.

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


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
00103 {
00104     out << "(x:" << entry.x << ", y:" << entry.y
00105     << ")\nbandwidth = " << entry.bandwidth
00106     << ",\ndelay = " << entry.accessDelay
00107     << ",\ntxMaxQueueTime = " << entry.txMaxQueueTime
00108     << ",\ntxFinished = " << entry.txFinished;
00109 
00110     return out;
00111 }


Member Data Documentation

cGate* SimpleNodeEntry::ingate [protected]

ingate of the SimpleUDP module of this terminal

float SimpleNodeEntry::x [protected]

x-coordinate

float SimpleNodeEntry::y [protected]

y-coordinate

simtime_t SimpleNodeEntry::txFinished [protected]

send queue finished

simtime_t SimpleNodeEntry::txMaxQueueTime [protected]

maximum time for packets to be queued

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

uint SimpleNodeEntry::sendQueueLength [static, protected]

maximum send queue length of overlay terminals in bytes


The documentation for this class was generated from the following files:
Generated on Wed Sep 26 12:13:02 2007 for ITM OverSim by  doxygen 1.5.1