int Ieee80211Etx::getEtt(const MACAddress &add, double &val) | |
{ | |
if (ettInterval <= 0 || ettSize1 <= 0 || ettSize2 <= 0) | |
return -1; | |
val = 1e300; | |
int interface = -1; | |
for (unsigned int i = 0; i < neighbors.size(); i++) | |
{ | |
NeighborsMap::iterator it = neighbors[i].find(add); | |
MacEtxNeighbor *neig; | |
if (it == neighbors[i].end()) | |
{ | |
continue; | |
} | |
else | |
{ | |
neig = &(it->second); | |
if (neig->timeETT.empty()) | |
continue; | |
int expectedPk = etxMeasureInterval / etxInterval; | |
int pkRec = neig->timeVector.size(); | |
double pr = (double) pkRec / (double)expectedPk; | |
double ps = (double) neig->getPackets() / (double) expectedPk; | |
if (pr > 1) | |
pr = 1; | |
if (ps>1) | |
ps = 1; | |
double result; | |
if (ps == 0 || pr == 0) | |
result = 1e100; | |
else | |
{ | |
double etx = 1 / (ps * pr); | |
simtime_t minTime = 100.0; | |
for (unsigned int i = 0; i < neig->timeETT.size(); i++) | |
if (minTime > neig->timeETT[i].delay) | |
minTime = neig->timeETT[i].delay; | |
double bw = (double) ettSize2 / SIMTIME_DBL(minTime); | |
result = etx * (etxSize / bw); | |
} | |
if (result<val) | |
{ | |
val = result; | |
interface = (int)i; | |
} | |
} | |
} | |
return interface; | |
} | |
These method compute the ETT based in the values stored in a vector.
Periodically the module sends two packets to every neighbor, a short packet a and big packet, and the neighbor resends the packets and the node compute the ETT using the delay between both packets, the node stored the latest 10 values and uses like ETT the best of the 10 values.
If you want shared the value between the different nodes the value must be global, in other case the value must be local. If you want to model the problem of transmit the values in the network, in this case the value mas be local and it is necessary to include a protocol that allows to transmit the value to the different nodes. But if you don’t have interest in this problem now, it is better to use a global value, because it avoids the necessity of implements a protocol that could transmit the values to the different nodes.
--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...