Akankshu,

1)
if (clusterhead)
{
//do something
}
else //!clusterhead
{
//do something
}

2)
Look at the micaz NESDOC (google nesdoc)for how to turn off the receiver for the radio.

The real problem you are going to run into is how does the non-clusterheads know when to become the new clusterhead if they turn off their radio. If it's timing based, you need to synchronize their clocks periodically (which requires all nodes to have the receiver enabled). If the receivers are always turned off, you will not be able receive ACKs, so the transmitting node will have no idea if it's data actually reached the clusterhead or not (this can lead to very poor PRRs at your sink).

-Paul

Akankshu Dhawan wrote:
Hi All
I am trying to implement a clustering algorithm and for that I want to make sure that the Receive mechanism applies only to the clusterhead.

Regular Nodes:
- samples data
- Transmit packets every few seconds

Clusterhead
- samples the data
- Receives regular node packets
- processes the data (including its own as well as received)
- then transmits to the base station its results

Since they both have the same sampling process I want to have the same code and just switch behavior at time intervals on whether its a clusterhead or just a regular node (state maintenance).

I have a question:
1. How do I make sure that the same piece of code behaves differently at different nodes depending on whether its the clusterhead or not ? How do I restrict this receive mechanism to only clusterheads ? I am basically talking about a state variable for the cluster .


Please guide me

Thanks Akankshu

--
First they ignore you, then they laugh at you, then they fight you, then you win.
- Mahatma Gandhi
------------------------------------------------------------------------

_______________________________________________
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