#include <SimpleNodeEntry.h>
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. | |
| typedef std::pair<simtime_t, bool> SimpleNodeEntry::SimpleDelay |
type for return value of calcDelay()
| SimpleNodeEntry::SimpleNodeEntry | ( | cModule * | node, | |
| cChannelType * | type | |||
| ) |
Constructor.
| 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 }
| SimpleNodeEntry::SimpleDelay SimpleNodeEntry::calcDelay | ( | const SimpleUDPPacket & | msg, | |
| const SimpleNodeEntry & | dest | |||
| ) |
Calculates delay between two nodes.
| msg | reference to message to get its length for delay calculation, | |
| dest | destination terminal |
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] |
| std::string SimpleNodeEntry::info | ( | ) | const |
| float SimpleNodeEntry::operator- | ( | const SimpleNodeEntry & | entry | ) | const [protected] |
| static void SimpleNodeEntry::setFieldSize | ( | uint | size | ) | [inline, static] |
Setter for maximum coordinate.
| size | maximum coordinate |
00067 { 00068 fieldSize = size; 00069 };
| static void SimpleNodeEntry::setSendQueueLength | ( | uint | length | ) | [inline, static] |
Setter for send queue length.
| length | send queue length |
00077 { 00078 sendQueueLength = length; 00079 };
| std::ostream& operator<< | ( | std::ostream & | out, | |
| const SimpleNodeEntry & | entry | |||
| ) | [friend] |
Stream output.
| out | output stream | |
| entry | the terminal |
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 }
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
1.4.7