Lab 5: Multi-hop routing Pre-lab 1. Please go over the slides on Lab 5. Make sure you understand it. Also try it out, make sure your results are what expected. Note: you may want to read Chapter 7 in “MoteWorks Getting Started Guide” and read the source code (using Programmer’s Notepad) when going over the slides. 2. Read Chapter 7 in “MoteWorks Getting Started Guide”. Understand how to view packets using XSniffer (you’ll need a third mote when using XSniffer). Try it out. Make sure your results are what expected. Lab for undergraduate-student teams For this lab, we’ll construct a two-hop network (note that the example in the slides is a 1hop network). We will use three motes, with IDs of 0, 1, and 2. Mote 0 is the base station (i.e., receiver). Mote 2 is the sender. Place the motes so that mote 2 cannot transmit directly to the base station. Rather, it needs mote 1 to route its packets to the base station. (To get a sense of how to place these motes, you need to do some experiments to know how far away two motes can be placed so that they cannot communicate directly). You can design the sender, forwarder and receiver as follows: Sender: runs XMesh multihop routing. It sends a packet every one second. You can use the code in Chapter 7. Forwarder: runs XMesh multihop routing. Since it does not send packets and simply forward packets, you need to slightly modify the sender program in Chapter 7. Receiver: you can use XmeshBase. Note: Make sure you choose the same group ID and radio frequency for the sender, receiver and forwarder programs. You can use a 4th mote to work as a sniffer (You can use TOSBase and connect this mote to PC. Use XSniffer to log data (you can output the captured data of XSniffer into a file). Verify that mote 2 indeed uses mote 1 to transmit to the receiver. Analyze the log file to determine what packets are lost. Use xi to represent whether the ith packet is lost or not, i.e., xi takes the value 1 if the ith packet arrives successfully and the value 0 if it is lost. Thus you will get a data sequence {xi}. For example, if a total of ten packets are sent and the second, third, sixth, eighth, and ninth packets are lost, the packet trace will be 1,0,0,1,1,0,1,0,0,1. Hint: you can know whether a packet is lost through a sequence number (you will need to enhance the sender to add a sequence number field in each packet payload) or simply by the timing logged from XSniffer. 1 Experiment: Install the sender, forwarder and receiver programs on motes 0, 1, and 2, respectively. Install the sniffer program on the sniffer. Start the data logging program on the PC to record packet trace. Turn on the sending mote to start sending packets to the base station. Do the experiments in different environments (e.g., indoor, outdoor, behind blocking objects), and for different distances between the sender and receiver. Also, vary the transmission power of the sender. This can be done by modifying the power setting in the MakeXbowlocal file. Choose four scenarios to do your experiments. Analysis: Error rate For each packet trace, compute the average packet loss rate every m packets, m = 50. Plot the results (packet loss rate versus time). Does the loss rate change over time? Now change m to 200, what do you observe? Error burst lengths An alternate way to represent the data is to divide the trace into portions of consecutive 0s (called burst errors) and portions of consecutive 1s (called good runs). Thus the original trace is divided into two sequences of observations: {gi} and {li} where gi is the ith good run length (expressed in number of packets) and li is the ith loss run length (also expressed in the number of packets). For example, for original trace {x} = {0,0,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,0,1}, we have {l} = {3,5,2,3}, {g} = {2,4,1,1}. For each packet trace, construct the sequence of good run length and loss run length. Compute the mean and variance of the burst error length and good run length. This will give you an idea of the burstiness of the packet losses. Report: 1. Briefly describe the design of the sender, forwarder, and receiver programs (it is OK if you are using an existing program). 2. Does mote 2 indeed use mote 1 to transmit to the receiver? Why do you believe so? 3. Describe the four scenarios you chose and the measurement results. 4. Turn in your source code (with comments). Lab for Graduate-student teams For this lab, we’ll construct a two-hop network (note that the example in the slides is a 1hop network). We’ll use three motes, with IDs of 0, 1, and 2. Mote 0 is the base station (i.e., receiver). Mote 2 is the sender. Place the motes so that mote 2 cannot transmit directly to the base station. Rather, it needs mote 1 to route its packets to the base station. In addition, we’ll use a 4th mote as a sniffer, Our goal is to understand the packet loss characteristics from mote 2 to the base station (this is over 2 hops, while what you did for Lab 4 is over a single hop). For this purpose, 2 you need to write a sender program, a forwarder program, a receiver program, a data logging program, and a data analysis program. Mote 2 runs the sender program. The base station runs the receiver program. Mote 1 runs the forwarder program. Feel free to modify example source codes for your use. Sender: the sender sends packets to the base station at a fixed rate (5 packets per second or equivalently, 1 packet per 200 ms). Each packet contains a sequence number (two bytes integer) which starts from 0 and increments by 1 each time (seq # = 0, 1, 2, 3, 4, …). Your sender should use XMesh multihop routing so that it can use mote 1 to relay traffic. Forwarder: the forwarder runs XMesh multihop routing to forward incoming packets. Since a forwarder does not send packet, you can slightly modify the sender program in Chapter 7 (by disabling sending function) for the forwarder program. Receiver: you can use XmeshBase. Sniffer: connected to the PC and runs TOSBase. Make sure you choose the same group ID and radio frequency for the sender, receiver and forwarder programs. Data Logger: data logger at the PC reads from the serial port and constructs a trace of the received and lost packets. Experiment: Install the sender, forwarder and receiver programs on motes 0, 1, and 2, respectively. Install the sniffer program on the sniffer. Start the data logging program on the PC to record packet trace. Turn on the sending mote to start sending packets to the base station. Do the experiments in different environments (e.g., indoor, outdoor, behind blocking objects), and for different distances between the sender and receiver. Also, vary the transmission power of the sender. This can be done by modifying the power setting in the MakeXbowlocal file. Choose four scenarios to do your experiments. Analysis: Calculate error rate and Error burst lengths (as you did for Lab 4) for each scenario that you chose. Report: 1. Briefly describe your design of the sender, forwarder, receiver and data logging programs (it is OK if you are using an existing program). 2. Describe the four scenarios you chose and the measurement results. 3. Turn in your source code (with comments). 3 Paper review: Read the following paper on multi-hop routing in wireless sensor networks, and write a review. Omprakash Gnawali, Rodrigo Fonseca, Kyle Jamieson, David Moss, and Phil Levis, Collection tree protocol, SenSys 2009. Your reviews have to be in your own words and include the following: o A brief summary of the paper. o A list of the strengths of this paper. o A list of shortcomings/limitations/open-issues. 4