[Tinyos-2-commits]
CVS: tinyos-2.x/tos/lib/net/le LinkEstimatorP.nc, 1.1.2.4, 1.1.2.5
Omprakash Gnawali
gnawali at users.sourceforge.net
Thu Oct 19 20:02:16 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/le
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28639
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
LinkEstimatorP.nc
Log Message:
compute beacon estimation per node; earlier we used to compute beacon estimate for all the nodes at the same time - bad
Index: LinkEstimatorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/le/Attic/LinkEstimatorP.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** LinkEstimatorP.nc 16 Oct 2006 02:28:22 -0000 1.1.2.4
--- LinkEstimatorP.nc 20 Oct 2006 03:02:13 -0000 1.1.2.5
***************
*** 261,294 ****
}
- // we received seq from the neighbor in idx
- // update the last seen seq, receive and fail count
- // refresh the age
- void updateNeighborEntryIdx(uint8_t idx, uint8_t seq) {
- uint8_t packetGap;
-
- if (NeighborTable[idx].flags & INIT_ENTRY) {
- dbg("LI", "Init entry update\n");
- NeighborTable[idx].lastseq = seq;
- NeighborTable[idx].flags &= ~INIT_ENTRY;
- }
-
- packetGap = seq - NeighborTable[idx].lastseq;
- dbg("LI", "updateNeighborEntryIdx: prevseq %d, curseq %d, gap %d\n",
- NeighborTable[idx].lastseq, seq, packetGap);
- NeighborTable[idx].lastseq = seq;
- NeighborTable[idx].rcvcnt++;
- NeighborTable[idx].inage = MAX_AGE;
- if (packetGap > 0) {
- NeighborTable[idx].failcnt += packetGap - 1;
- }
- if (packetGap > MAX_PKT_GAP) {
- NeighborTable[idx].failcnt = 0;
- NeighborTable[idx].rcvcnt = 1;
- NeighborTable[idx].outage = 0;
- NeighborTable[idx].outquality = 0;
- NeighborTable[idx].inquality = 0;
- }
- }
-
// update the EETX estimator
// called when new beacon estimate is done
--- 261,264 ----
***************
*** 351,355 ****
// update the inbound link quality by
// munging receive, fail count since last update
! void updateNeighborTableEst() {
uint8_t i, totalPkt;
neighbor_table_entry_t *ne;
--- 321,325 ----
// update the inbound link quality by
// munging receive, fail count since last update
! void updateNeighborTableEst(am_addr_t n) {
uint8_t i, totalPkt;
neighbor_table_entry_t *ne;
***************
*** 362,400 ****
for (i = 0; i < NEIGHBOR_TABLE_SIZE; i++) {
ne = &NeighborTable[i];
! if (ne->flags & VALID_ENTRY) {
! if (ne->inage > 0)
! ne->inage--;
! if (ne->outage > 0)
! ne->outage--;
!
! if ((ne->inage == 0) && (ne->outage == 0)) {
! ne->flags ^= VALID_ENTRY;
! ne->inquality = ne->outquality = 0;
! } else {
! dbg("LI", "Making link: %d mature\n", i);
! ne->flags |= MATURE_ENTRY;
! totalPkt = ne->rcvcnt + ne->failcnt;
! dbg("LI", "MinPkt: %d, totalPkt: %d\n", minPkt, totalPkt);
! if (totalPkt < minPkt) {
! totalPkt = minPkt;
! }
! if (totalPkt == 0) {
! ne->inquality = (ALPHA * ne->inquality) / 10;
} else {
! newEst = (255 * ne->rcvcnt) / totalPkt;
! dbg("LI,LITest", " %hu: %hhu -> %hhu", ne->ll_addr, ne->inquality, (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10);
! ne->inquality = (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10;
}
! ne->rcvcnt = 0;
! ne->failcnt = 0;
}
- updateEETX(ne, computeBidirEETX(ne->inquality, ne->outquality));
- }
- else {
- dbg("LI", " - entry %i is invalid.\n", (int)i);
}
}
}
// print the neighbor table. for debugging.
void print_neighbor_table() {
--- 332,410 ----
for (i = 0; i < NEIGHBOR_TABLE_SIZE; i++) {
ne = &NeighborTable[i];
! if (ne->ll_addr == n) {
! if (ne->flags & VALID_ENTRY) {
! if (ne->inage > 0)
! ne->inage--;
! if (ne->outage > 0)
! ne->outage--;
!
! if ((ne->inage == 0) && (ne->outage == 0)) {
! ne->flags ^= VALID_ENTRY;
! ne->inquality = ne->outquality = 0;
} else {
! dbg("LI", "Making link: %d mature\n", i);
! ne->flags |= MATURE_ENTRY;
! totalPkt = ne->rcvcnt + ne->failcnt;
! dbg("LI", "MinPkt: %d, totalPkt: %d\n", minPkt, totalPkt);
! if (totalPkt < minPkt) {
! totalPkt = minPkt;
! }
! if (totalPkt == 0) {
! ne->inquality = (ALPHA * ne->inquality) / 10;
! } else {
! newEst = (255 * ne->rcvcnt) / totalPkt;
! dbg("LI,LITest", " %hu: %hhu -> %hhu", ne->ll_addr, ne->inquality, (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10);
! ne->inquality = (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10;
! }
! ne->rcvcnt = 0;
! ne->failcnt = 0;
}
! updateEETX(ne, computeBidirEETX(ne->inquality, ne->outquality));
! }
! else {
! dbg("LI", " - entry %i is invalid.\n", (int)i);
}
}
}
}
+
+ // we received seq from the neighbor in idx
+ // update the last seen seq, receive and fail count
+ // refresh the age
+ void updateNeighborEntryIdx(uint8_t idx, uint8_t seq) {
+ uint8_t packetGap;
+
+ if (NeighborTable[idx].flags & INIT_ENTRY) {
+ dbg("LI", "Init entry update\n");
+ NeighborTable[idx].lastseq = seq;
+ NeighborTable[idx].flags &= ~INIT_ENTRY;
+ }
+
+ packetGap = seq - NeighborTable[idx].lastseq;
+ dbg("LI", "updateNeighborEntryIdx: prevseq %d, curseq %d, gap %d\n",
+ NeighborTable[idx].lastseq, seq, packetGap);
+ NeighborTable[idx].lastseq = seq;
+ NeighborTable[idx].rcvcnt++;
+ NeighborTable[idx].inage = MAX_AGE;
+ if (packetGap > 0) {
+ NeighborTable[idx].failcnt += packetGap - 1;
+ }
+ if (packetGap > MAX_PKT_GAP) {
+ NeighborTable[idx].failcnt = 0;
+ NeighborTable[idx].rcvcnt = 1;
+ NeighborTable[idx].outage = 0;
+ NeighborTable[idx].outquality = 0;
+ NeighborTable[idx].inquality = 0;
+ }
+
+ if (NeighborTable[idx].rcvcnt >= BLQ_PKT_WINDOW) {
+ updateNeighborTableEst(NeighborTable[idx].ll_addr);
+ }
+
+ }
+
+
+
// print the neighbor table. for debugging.
void print_neighbor_table() {
***************
*** 481,485 ****
dbg("LI", "updating neighbor table\n");
print_neighbor_table();
! updateNeighborTableEst();
print_neighbor_table();
}
--- 491,495 ----
dbg("LI", "updating neighbor table\n");
print_neighbor_table();
! updateNeighborTableEst(0);
print_neighbor_table();
}
***************
*** 685,692 ****
// update the beacon-driven link quality estimators if we have
// received BLQ_PKT_WINDOW number of beacons
! curEstInterval = (curEstInterval + 1) % BLQ_PKT_WINDOW;
! if (curEstInterval == 0) {
! updateNeighborTableEst();
! }
if (call SubAMPacket.destination(msg) == AM_BROADCAST_ADDR) {
--- 695,702 ----
// update the beacon-driven link quality estimators if we have
// received BLQ_PKT_WINDOW number of beacons
! // curEstInterval = (curEstInterval + 1) % BLQ_PKT_WINDOW;
! // if (curEstInterval == 0) {
! // updateNeighborTableEst();
! // }
if (call SubAMPacket.destination(msg) == AM_BROADCAST_ADDR) {
More information about the Tinyos-2-commits
mailing list