Hi swetha
I once implemented a routing algorithm that required a routing table. My
routing table was different from the one u specified but it wasn’t static so
I used a setup phase to create it at ever node. Now disadvantage of this is
that it makes the whole system more complicated coz you need to have a code
AND a packet format for setup phase. But advantage that I felt was that I
can load exacty the same code in all nodes and they can create there own
routing table based on their location in the network.
Now since u want to programme nodes with a static tables, you’ll make the
code easier but you’ll have to programme each node with a different code
containing it’s own routing table  (assuming I’ve understood u correctly).
Now coming to your question, I’m not sure if this is the best way to do it
but when I implemented my routing algorithm I used a simple 2 dimensional
array structure to store the routing table. Bellow is a small part of my
code that I used to build the routing table: code is modified "blinktoradio"
so you'll understand wat's going on

if (len == sizeof(BlinkToRadioMsg)) {
   BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
   printf("gat from %u at %u\n",btrpkt->sender,btrpkt->hop);
   if (btrpkt->type==0)  //if messege is type 0, that is setup messege
     {
       uint8_t flag=0;
       uint8_t i,j,k;
if(call Timer0.isRunning())
 call Timer0.stop();
call Timer0.startOneShot(1000);
num+=1;
for(i=0;i<=index;i++)  //checking if the node already exists in routing
table
 {
   if (rout[i][0]==btrpkt->sender)
     {
               flag=1;
       break;
     }
 }
if(flag==0) //if node doesnt exist in routing table it is added at the end
of the table along with hope count n some more algo specific info
 {
   rout[index][0]=btrpkt->sender;
   printf("sender %u \n",rout[index][0]);
           rout[index][1]=btrpkt->hop+1;
   printf("hop %u\n",rout[index][1]);
           dec[index][0]=(float)1/rout[index][1];
   index=index+1;

}
       else if(flag==1) //if node exists i table, it's infomatin might be
updated if needed
 {
   if(rout[i][1]>btrpkt->hop+1)
     {
rout[i][1]=btrpkt->hop+1;
dec[i][0]=(float)1/rout[i][1];
     }
 }
if(hop>btrpkt->hop+1)
 {
   hop=btrpkt->hop+1;
Like i said, i dono if this is "The Perfect" way of making the routing
table, but it worked for me :). wish u all the best!!

Tarun



On Tue, May 12, 2009 at 12:16 AM, Swetha R <[email protected]> wrote:
> I have one more question. If i create a static topology that means i know
> the location of all the nodes in my network and the topology will not
change
> till the end of the simulation. Then can i manually store the routing
table
> information at every node about the hop numbers to other neighboring nodes
> that i mentioned in my previous email in all the nodes? Is it possible to
> store the values entered by me in a routing table in all the nodes ? Is
> there any method to do this? Please let me know how i can implement this
in
> my code?
> For example :
> 0 --> 1--> 2-->3-->4
> Node2  's routing table :
> Destination   Nexthop   hopcount
> 0                    1                2
> 1                    1                1
> 2                    0                0
> 3                    3                1
> 4                    3                2
> can i manually enter this information and store in node 2 ?
>
> Thanks a lot once again.
> Swetha.
> ________________________________
> From: Philip Levis <[email protected]>
> To: Swetha R <[email protected]>
> Cc: [email protected]
> Sent: Thursday, May 7, 2009 1:04:27 PM
> Subject: Re: [Tinyos-help] Routing table construction
>
>
> On May 7, 2009, at 11:56 AM, Swetha R wrote:
>
>> Hello Everyone ,
>>    I am new to TinyOS and would appreciate any kind of help to make me
>> understand the Routing protocols.I want to create a network topology by
>> using flooding where every node maintains a routing table which should
>> contain the following details :
>> destination node - to the node it has to send the data.
>> nexthop-  intermediate node to reach the destination.
>> hopcount- the number of hops to reach the destination.
>> For example :
>> 0 --> 1--> 2-->3-->4
>> Node2  's routing table :
>>
>>
>
> There's a huge amount of work in this area. The approach you describe was
> one of the first TinyOS routing protocols. There was then about 5 years of
> work that examined why it doesn't work well and how you can do better. The
> canonical paper is
>
> Deepak Ganesan, Bhaskar Krishnamachari, Alec Woo, David Culler, Deborah
> Estrin and Stephen Wicker,  Complex Behavior at Scale: An Experimental
Study
> of Low-Power Wireless Sensor Networks ,  UCLA Computer Science Technical
> Report UCLA/CSD-TR 02-0013.
>
> Modern protocols use a distance vector approach based on ETX (expected
> transmissions) or related link cost function. TinyOS 2.x has CTP and
> MultihopLQI that do this: the latter uses chip error rates to estimate
link
> cost. The Berkeley IP layer (blip) also does something similar, using a
> hybrid candidate parent approach, similar to as described in Jonathan
Hui's
> SenSys 2008 paper.
>
> Phil
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to