= EMR – Energy-efficient Multi-hop Routing for Clustered WS&ANs Cookbook = This document includes instructions how to install and to run the Energy-efficient Multi-hop Routing (EMR) for Clustered WS&ANs. [[PageOutline(2-3,Table of Contents,inline)]] == Introduction == The main purpose of EMR is to address the hot-spot issue in WSNs so that the network energy could be better utilized. * The operation of EMR is as following: * First, some CH candidates are selected; * Second, these candidates compete to be the final CH; * Third, the CHs announce their role and allow non-CH nodes to join them as member nodes to form the cluster; * Fourth, the CHs collect the data packets from their respective member nodes; * Finally, the CHs aggregate these packets as one summary packet of the cluster and deliver them to the sink. Please note that the competition range of the CH candidates to be the CHs are determined by the probability of nodes to be the CH, acquired by the mathematical analysis which aims to equalize the node lifetime across the network. == Installation == === Hardware and Software Requirements Installing the EMR protocol requires the following hardware tools and software packages: * [http://www.ubuntu.com/ Linux PC (Ubuntu)]/ [http://www.microsoft.com/windows/windows-xp/default.aspx/ Windows XP)] * [http://docs.tinyos.net/index.php/Getting_started TinyOS-2.x] * [https://ncit-cluster.grid.pub.ro/trac/Sensei-Cookbook/wiki/emr/emr.tar.gz EMR software package] * At least 11 TelosB sensor nodes We assume that the installation PC is running a '''Linux''' operating system and the [http://docs.tinyos.net/index.php/Getting_started TinyOS-2.x] has been installed and configured properly on it. We skip the installation of TinyOS. A user could refer to here and refer to [http://docs.tinyos.net/index.php/Getting_started TinyOS-2.x] about the installation if necessary. We describe the installation and configuration steps in the following for the [http://www.ubuntu.com/ Ubuntu] operating system. There are two type of nodes in the network, the normal sensor nodes and the sink, where data packets from the normal nodes are periodically collected by the sink after some basic processing at the CH, e.g. data aggregation. This is the structure of the content of the EMR software package: * Node \\ * EMRAPPc.nc\\ Contains the configuration files and includes wiring between interfaces * EMRCHC.nc\\ Contains all relevant actions and behavior of the ClusterHead (CH), e.g. collecting the informaiton of the member nodes, receiving the data packets from the member nodes, and forwarding the summary packet of the cluster towards the sink * EMRClusteringC.nc\\ Contains the procedure about how the clusters are formed * EMRInitC.nc\\ Contains all initializations of each round across the network operation, and how to process the received message * EMRLib.nc\\ Contains general functionalities that could be used by other modules, e.g. the energy consumption model * EMRMemberC.nc\\Contains all recelvant actions and behavior of the member nodes, e.g. to determine which CH it belongs to, and to send data to the CH * EMRRouting.nc\\ Contains the process about how to determine the routing towards the sink in multi-hop scenario * Interface\\ Contains the defination of all involved interfaces * include\\ Contains all header files * Sink \\ * EMRSinkAppc.nc\\ Contains the configuration files and includes wiring between interfaces * EMRSinkC.nc\\ Contains the actions and behavior of the sink * EMRSink.h \\ Header file === Installation * First of all, install * [http://docs.tinyos.net/index.php/Getting_started TinyOS-2.x] * Then copy the {{{build}}} folder and the {{{Makefile}}} into a new folder under the tinyOS directory for normal node {{{ /opt/tinyOS2.x/emr/node/ }}} * Thirdly, copy the source code into a new folder for sink node {{{ e.g. /opt/tinyOS2.x/emr/sink/ }}} * Now, you can load the binary code into normal nodes by {{{ # make telosb reinstall. bsl,/dev/ttyUSB* }}} * And then compile and load the binary code into sink nodes by {{{ # make telosb install.100 bsl,/dev/ttyUSB* }}} == Running EMR== The following describes about how to run EMR step by step. *Operation * First, turn on all normal nodes. the nodes should have the red led on and wait for clustering indication from the sink node. * Then, turn on the Sink node. * When the sink node is on, the network starts operation, e.g. to cluster the nodes and to collect the data from the member ndoes by the CHs. * You could see that the different leds are on on the nodes, where bue led means a CH and green led means a member node. * The status of the nodes are changing from time to time, e.g. a node may change its led colour meaning its role in the new round. *Monitor the debug messages Use the serial output to watch the debug messages: {{{ # java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSB*:telosb }}} * Change parameters You could change the parameters, e.g. {{{control_packet_size}}}, {{{data_packet_size}}} freely in the funciton {{{send_parameter()}}} in the file {{{EMRSinkC.nc}}}