The TinyOS interfaces used in the program and components provide them are shown in the table below.
Table 1: Interfaces and Components in TinyOS
Perform operations at different time intervals
|| To generate a random number
|| Provides events for message reception
| Send Msg
|| Provides commands for sending messages
The program asks the user to enter some details.
1. First option is which program an user wants to use?
- If user wants leach program he has to give option as 1 (Giving any other number will not make the motes run or the program will not execute)
2. Next option is how many numbers of nodes are required to participate in leader election?
- The user has to enter a number which should be is less than or equal to the total number of nodes deployed.
- When a user enters a number, then that number of nodes will only participate in the program.
3. Once the user enters the above two options as inputs, the nodes checks if the program choice is leach and the entered node ID value is less than or equal to the total number of nodes deployed for participating in leader election.
4. If both the conditions are satisfied then only the program starts to run else it will not.
5. Once the two conditions are satisfied the nodes checks if it has become a cluster head in the last few rounds.
6. If not then it generates a random number between 0 and 1.
7. When this random number is less than the threshold value, then the nodes changes its status as Cluster Head.
8. Each cluster head then broadcast an advertising message indicating that it is the cluster head.
9. The nodes when receives message from different cluster heads, will compare power from which cluster head is more and elected as its cluster head.
10. The non-cluster head sends its data to the cluster head from which it received broadcast message with more power.
11. The main aim of the program is to elect a leader and when a leader is elected, Green LED will blink so that the user can understand that the particular node has been elected as leader.
12. In LEACH there is a possibility that in some rounds the number of nodes can be zero or it may be more than one.
Working of Remote Panel:
- Remote Panel gives the real time representation of the deployed nodes for the Clustering experiment.
- We can visualize how cluster formation happens in a randomly distributed nodes based on some user's inputs.
- Physical representation of the deployed nodes to clearly demonstrate the Cluster formation based on the user's input are also shown in this panel.
- Input options are provided on the right side of the Remote panel window.
- Mainly there are two inputs and the first input option is to select the agrothim that we are going to implement.
- In our case, LEACH algorithm is planning to implement and so we have to select LEACH as input from the drop down menu.
- Second input option represents the number of nodes that we are planning to use for this particular experiment.
- There should be a minimum of 3 nodes and maximum of 20 nodes for doing this experiment. We can select the required number of nodes according to our will.
- Then click on the Connect to WSN button to start the experiment and the visual representation of no : of nodes involved in the cluster head selection and cluster formation are seen in this remote panel.