45 neighborCache->par(
"simpleNcsDelayFaultType").stdstringValue();
61 if(peerInfo == NULL) {
62 throw cRuntimeError(
"No PeerInfo Found");
70 for (uint8_t i = 0; i < entry->
getDim(); i++) {
71 ownCoords->setCoords(i, entry->
getCoords(i));
81 assert(coords.size() > 1);
85 for (i = 0; i < coords.size() - 1; ++i) {
86 info->setCoords(i, coords[i]);
88 info->setAccessDelay(coords[i]);
105 char delaystring[35];
106 sprintf(delaystring,
"%.30f", SIMTIME_DBL(oldDelay));
109 uint8_t hashOverDelays[20];
111 sha1.
Update((uint8_t*)delaystring, 32);
116 uint32_t decimalhash = 0;
117 for (
int i = 0; i < 4; i++) {
118 decimalhash += (
unsigned int) hashOverDelays[i] *
119 (2 << (8 * (3 - i) - 1));
123 double fraction = (double) decimalhash / (uint32_t) ((2 << 31) - 1);
126 char sign = (decimalhash % 2 == 0) ? 1 : -1;
130 double errorRatio = 0;
135 errorRatio = pow((1.0 - pow(fraction, 1.0 / 14.0)), 1.0 / 2.03) + 0.04;
140 errorRatio = pow((1.0 - pow(fraction, 1.0 / 50.0)), 1.0 / 1.95) + 0.105;
145 errorRatio = pow((1.0 - pow(fraction, 1.0 / 23.0)), 1.0 / 1.96) + 0.02;
154 errorRatio = (sign == -1 && errorRatio > 0.6) ? 0.6 : errorRatio;
156 return oldDelay + sign * errorRatio * oldDelay;