[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/ctp CtpP.nc, 1.4, 1.5 CtpRoutingEngineP.nc, 1.8, 1.9

Omprakash Gnawali gnawali at users.sourceforge.net
Fri Sep 21 16:50:30 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv11980

Modified Files:
	CtpP.nc CtpRoutingEngineP.nc 
Log Message:
changes for 4b estimator

Index: CtpP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CtpP.nc	9 Feb 2007 07:54:39 -0000	1.4
--- CtpP.nc	21 Sep 2007 23:50:28 -0000	1.5
***************
*** 131,136 ****
    components new AMReceiverC(AM_CTP_DATA);
    components new AMSnooperC(AM_CTP_DATA);
!   
!   components new CtpRoutingEngineP(TREE_ROUTING_TABLE_SIZE, 1, 1024) as Router;
    StdControl = Router;
    StdControl = Estimator;
--- 131,136 ----
    components new AMReceiverC(AM_CTP_DATA);
    components new AMSnooperC(AM_CTP_DATA);
! 
!   components new CtpRoutingEngineP(TREE_ROUTING_TABLE_SIZE, 10, 1024) as Router;
    StdControl = Router;
    StdControl = Estimator;
***************
*** 140,143 ****
--- 140,146 ----
    Router.BeaconReceive -> Estimator.Receive;
    Router.LinkEstimator -> Estimator.LinkEstimator;
+ 
+   Router.CompareBit -> Estimator.CompareBit;
+ 
    Router.AMPacket -> ActiveMessageC;
    Router.RadioControl -> ActiveMessageC;
***************
*** 150,153 ****
--- 153,160 ----
    CtpInfo = Router;
  
+   components CC2420ActiveMessageC;
+   components CC2420PacketC as CC2420;
+   Router.CC2420Packet -> CC2420;
+   
    components new TimerMilliC() as RetxmitTimer;
    Forwarder.RetxmitTimer -> RetxmitTimer;
***************
*** 177,184 ****
--- 184,195 ----
    LinkEstimator = Estimator;
    
+   Estimator.Random -> RandomC;
+ 
    Estimator.AMSend -> SendControl;
    Estimator.SubReceive -> ReceiveControl;
    Estimator.SubPacket -> SendControl;
    Estimator.SubAMPacket -> SendControl;
+   Estimator.LinkPacketMetadata -> CC2420ActiveMessageC;
+   //  Estimator.LinkPacketMetadata -> ActiveMessageC;
    MainC.SoftwareInit -> Estimator;
  }

Index: CtpRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** CtpRoutingEngineP.nc	13 Sep 2007 23:10:18 -0000	1.8
--- CtpRoutingEngineP.nc	21 Sep 2007 23:50:28 -0000	1.9
***************
*** 114,117 ****
--- 114,121 ----
          interface CollectionDebug;
          interface CtpCongestion;
+ 
+ 	interface CompareBit;
+ 	interface CC2420Packet;
+ 
      }
  }
***************
*** 435,439 ****
      event void RouteTimer.fired() {
        if (radioOn && running) {
! 	post updateRouteTask();
        }
      }
--- 439,443 ----
      event void RouteTimer.fired() {
        if (radioOn && running) {
!          post updateRouteTask();
        }
      }
***************
*** 465,468 ****
--- 469,473 ----
          ctp_routing_header_t* rcvBeacon;
          bool congested;
+         uint8_t lqi = call CC2420Packet.getLqi(msg);
  
          // Received a beacon, but it's not from us.
***************
*** 485,489 ****
              __FUNCTION__, from, 
              rcvBeacon->parent, rcvBeacon->etx);
!         //call CollectionDebug.logEventRoute(NET_C_TREE_RCV_BEACON, rcvBeacon->parent, 0, rcvBeacon->etx);
  
          //update neighbor table
--- 490,494 ----
              __FUNCTION__, from, 
              rcvBeacon->parent, rcvBeacon->etx);
!         call CollectionDebug.logEventRoute(NET_C_TREE_RCV_BEACON, from, lqi, rcvBeacon->etx);
  
          //update neighbor table
***************
*** 510,513 ****
--- 515,524 ----
      }
  
+ 
+   //event void LinkEstimator.newNeighbor(am_addr_t neighbor, uint8_t lqi) {
+   //  call CollectionDebug.logEventRoute(NET_C_TREE_RCV_BEACON, neighbor, lqi, 0);
+   //}
+ 
+ 
      /* Signals that a neighbor is no longer reachable. need special care if
       * that neighbor is our parent */
***************
*** 641,644 ****
--- 652,710 ----
  
  
+   /* This should see if the node should be inserted in the table.
+    * If the white_bit is set, this means the LL believes this is a good
+    * first hop link. 
+    * The link will be recommended for insertion if it is better* than some
+    * link in the routing table that is not our parent.
+    * We are comparing the path quality up to the node, and ignoring the link
+    * quality from us to the node. This is because of a couple of things:
+    *   1. because of the white bit, we assume that the 1-hop to the candidate
+    *      link is good (say, etx=1)
+    *   2. we are being optimistic to the nodes in the table, by ignoring the
+    *      1-hop quality to them (which means we are assuming it's 1 as well)
+    *      This actually sets the bar a little higher for replacement
+    *   3. this is faster
+    *   4. it doesn't require the link estimator to have stabilized on a link
+    */
+     event bool CompareBit.shouldInsert(message_t *msg, void* payload, uint8_t len, bool white_bit) {
+         
+         bool found = FALSE;
+         uint16_t pathEtx;
+         //uint16_t linkEtx = evaluateEtx(0);
+         uint16_t neighEtx;
+         int i;
+         routing_table_entry* entry;
+         ctp_routing_header_t* rcvBeacon;
+ 
+         if ((call AMPacket.type(msg) != AM_CTP_ROUTING) ||
+             (len != sizeof(ctp_routing_header_t))) 
+             return FALSE;
+ 
+         /* 1.determine this packet's path quality */
+         rcvBeacon = (ctp_routing_header_t*)payload;
+ 
+         if (rcvBeacon->parent == INVALID_ADDR)
+             return FALSE;
+         /* the node is a root, recommend insertion! */
+         if (rcvBeacon->etx == 0) {
+             return TRUE;
+         }
+     
+         pathEtx = rcvBeacon->etx; // + linkEtx;
+ 
+         /* 2. see if we find some neighbor that is worse */
+         for (i = 0; i < routingTableActive && !found; i++) {
+             entry = &routingTable[i];
+             //ignore parent, since we can't replace it
+             if (entry->neighbor == routeInfo.parent)
+                 continue;
+             neighEtx = entry->info.etx;
+             //neighEtx = evaluateEtx(call LinkEstimator.getLinkQuality(entry->neighbor));
+             found |= (pathEtx < neighEtx); 
+         }
+         return found;
+     }
+ 
+ 
      /************************************************************/
      /* Routing Table Functions                                  */



More information about the Tinyos-2-commits mailing list