Table of Contents

1. Short description
2. Example with WSNet1
3. Example with WSNet2
4. Remarks

1. Short description

This example consists in four nodes sending a token in circle (0->1->2->3->0). Node 0 starts to send the token to node 1 and waits for an acknowledgement (acknowledgements sending is handled by hardware on Ti CC2420). A node tries again to send 5 times, while it doesn't receive an acknowledgement from the receiver. In case of failure, it tries to send to the next node.

This program uses the 802.15.4 address recognition, which is implemented on Ti CC2420 hardware. Thus a node accepts the token only if the destination pan and address match to its pan and address.

As soon as a node has received the token, it's blue led is turned on. This led is turned off when the node receives an acknowledgement after sending.

Red led is toggled each time the timer ends.

2. Example with WSNet1

As explained previouly, in a simulation using WSNet1, each node will see all the other nodes.

To launch the simulation, go in the /examples/wsn430v14/demo_tuto_wsnet/wsnet1 folder of WSim sources, and enter:

WSNet1 example execution

Figure IV.1. WSNet1 example execution

3. Example with WSNet2

To show some WSNet2 features, we are going to make a more advanced simulation. In the WSNet2 configuration file (/examples/wsn430v14/wsnet2/worldsens.xml), we have defined nodes positions over an area of 16*16*16 meters, as represented on the following diagram:

WSNet2 nodes positions

Figure IV.2. WSNet2 nodes positions

Nodes signal ranges are configured so that a node can see only its two nearest neighbours. For instance node 0 can't communicate with node 2.

Moreover a fire environment is added. The fire will start closed to node 0 after one second, and kill node 0. The simulation will continue, ignoring node 0 and also node 1, as node 3 is too fare from node 1 to send the token to it.

To launch the simulation, go in the /examples/wsn430v14/demo_tuto_wsnet/wsnet2 folder of WSim sources, and enter:

WSNet2 example execution : node 0 has been killed by fire

Figure IV.3. WSNet2 example execution : node 0 has been killed by fire

4. Remarks

  • When performing a WSim + WSNet simulation, you always must set WSim node-id option, for WSim nodes to be registered by WSNet. You have to be particularly carefull, if you have defined sereral nodes configurations in WSNet2 : node 0 (in the xml configuration file of WSNet2) matches first WSim connected node in WSNet2, node 1 the second one, and so on...

  • As WSim is cycle precise, if you run several nodes by using a script, they may be exactly synchronized. If all nodes have the same program, you might obtain unexpected results : for instance all nodes sending and receiving exactly at the same time. A solution is to use sleep sh command (or equivalent), to introduce a small lag between nodes starting.