Hi,
I figured out why some nodes were not forwarding packets as mentioned in my mail yesterday. In selectRoute(), when either of the 2 conditions are satisfied by the intermediate nodes, they do not forward the packets.
1. if (gpCurrentParent == NULL) returns FAIL
2. if (gbCurrentHopCount >= pMHMsg->hopcount) returns FAIL i.e. possibility of a cycle
I believe the first condition returns FAIL when the intermediate node has still not found its Parent from the chooseParent() function.
For example, if node 6 --> node 1 --> node 0 is the static route. Node 6 first found out that node 1 is its parent from the chooseParent() function and transmitted a packet. But node 1 has still not found that node 0 is its parent, so the if (gpCurrentParent == NULL) condition returns FAIL and node 1 does not forward the packet to node 0.
So, I think this condition is doing the right thing by returning FAIL and not forwarding the packet. Please let me know if I am correct?
The second condition occurs when there is a possible cycle, e.g. considering the same static route, for a packet originated at node 6, the if (gbCurrentHopCount >= pMHMsg->hopcount) condition is satisfied at node 1 and it returns FAIL, thereby not forwarding the packet.
Since, I am hardwiring the routes in the network, I will make sure to avoid cycles. I commented the cycle-check condition and then saw that node 1 was forwarding all the packets that originated at node 6. I hope I did the right thing? Will commenting the cycle-check condition affect any other part of the algorithm?
I have one last question. It takes about 82 simulation seconds before the first node finds its parent and starts transmitting packets. All the messages exchanged in those 82 sec. are for route discovery. How can I avoid all these messages?
Your suggestion will really help me. Thanks a lot.
Regards,
Yogesh.
Yogesh Iyer <[EMAIL PROTECTED]> wrote:
Hi,I was finally able to implement static routes for the Surge application. In yesterdays mail, I had mentioned that we need to hardwire the routes at getParent(). But even after I did that, the nodes were still sending packets directly to node 0 (Base station).I realized that getParent() only changes the parent that is reported in the Surge packet. The actual parent is set in the chooseParent() function. So, I hardwired the parent address in chooseParent() as follows:if (pNewParent) {
atomic {
gpCurrentParent = pNewParent;
gbCurrentHopCount = bNewHopCount + 1;
switch (TOS_LOCAL_ADDRESS) {
case 0: // Parent of mote 0 is the UART
gpCurrentParent->id = TOS_UART_ADDR;
break;
case 1: // Parent of mote 1 is mote 2
gpCurrentParent->id = 0x02;
break;
case 2: // Parent of mote 2 is mote 0
gpCurrentParent->id = 0x00;
break;
case 3: // Parent of mote 3 is mote 0
gpCurrentParent->id = 0x00;
break;
case 4: // Parent of mote 4 is mote 1
gpCurrentParent->id = 0x01;
break;
case 5: // Parent of mote 5 is mote 0
gpCurrentParent->id = 0x00;
break;
case 6: // Parent of mote 6 is mote 2
gpCurrentParent->id = 0x02;
break;
case 7: // Parent of mote 7 is mote 5
gpCurrentParent->id = 0x05;
break;
case 8: // Parent of mote 8 is mote 0
gpCurrentParent->id = 0x00;
break;
case 9: // Parent of mote 9 is mote 5
gpCurrentParent->id = 0x05;
break;
}
dbg(DBG_ROUTE,"The chosen Parent is: %x",gpCurrentParent->id);
}}
The nodes then sent packets to their respective parents but then I observed the following cases:
- In a 7 node network (including the Base station), when node 1 sends a packet to node 2, node 2 does not forward it to node 0. Similarly, packets do not get forwarded on the path node 4 --> node 1 --> node 2 --> noe 0. The packet originated by node 4 does not get forwarded by node 1.
BUT, in a 10 node network, everything works perfectly. Node 1 and node 2 forward the packets that they get from other nodes to node 0.- Again with a 10 node network, I add a static route node 6 --> node 2 --> node 0; and observe that node 2 does not forward packets received from node 6, while still continuing to forward node 1's and node 4's packets.
- This is similar to case 2. I had a static route initially as node 9 --> node 5 --> node 0. Node 5 forwarded packets received from node 9.
BUT, when I add the static route node 7 --> node 5 --> node 0, node 5 does not forward node 7's packets while still continuing to forward node 9's packets.Can someone please explain why do we observe Case 1. How does different number of nodes in the network affect the forwarding of packets?
Also, in Case 2 & 3, why does node 2 and node 5 only forward packets coming from one route. Is this related to buffer overflow or something of that sort?
I'll be really obliged if you can explain whats going on. Thanks in advance and have a great new year.
Regards,
Yogesh.
[EMAIL PROTECTED] wrote:
Hi,
If the parent is in the neighbor table, meaning
you can assign a table entry pointer to gpCurrentParent, you can hardwire the parent
in chooseParent().
If you don't care about the neighbor table,
simply hardwire the route. Do it at RouteSelect.selectRoute. This is probably the easiest place to modify.
Something like:
pMHMsg->sourceaddr = TOS_LOCAL_ADDRESS;
pMHMsg->hopcount=gbCurrentHopCount;//hardwire
Msg->addr = gpCurrentParent->id; //hardwire
return SUCCESS;
should do. Hope this helps.
alec
Do you Yahoo!?
All your favorites on one personal page � Try My Yahoo!
_______________________________________________ Tinyos-users mailing list [email protected] http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users
