WARNING: This implementation of SenseCode is a prototype and therefore may contain serious bugs.
This is an implementation of the protocol describe in the paper:
Abstract:
Designing a communication protocol for sensor networks often involves obtaining the "right" trade-off between energy efficiency and end-to-end packet error rate. In this paper, we show that network coding provides a means to elegantly balance these two goals. We present the design and implementation of SenseCode, a collection protocol for sensor networks and - , to the best of our knowledge, the first such implemented protocol to employ network coding. SenseCode provides a way to gracefully introduce a configurable amount of redundant information in the network, thereby increasing end-to-end packet error rate in the face of packet loss. We compare SenseCode to the best (to our knowledge) existing alternative and show that it reduces end-to-end packet error rate in highly dynamic environments, while consuming a comparable amount of network resources. We have implemented SenseCode as a TinyOS module and evaluate it through extensive TOSSIM simulations.
Description of the contents:
The implementation of SenseCode is included in the sensecode directory.
The directory demo contains a demo application that uses SenseCode.
The demo application consists of a sink node that every 60 seconds broadcasts a request to all nodes in the network. All the other nodes answer the request by sending a packet with SenseCode.
The demo application is setup to send data with a rate 0.5 systematic code and support
up to 32 active nodes. It is possible to change these parameters in the file DemoApp.h.
Included in the demo directory there is also a python script to run a TOSSIM simulation.
To run the demo application with TOSSIM:
-
Install docker engine on your machine (tested with Docker 20.10.2)
-
Build a docker image with all the dependencies with the command
docker build -t senscode . -
Start a docker container with the image with the command:
docker run --rm -it -v "$(pwd):/opt/sensecode" sensecode -
In the container compile the code with the command
cd demo && make micaz sim -
Run the code with the command
python runner.py
The simulation code uses a test network with 32 nodes. It can be changed using the files
in demo/test and the variable numNodes in the runner.py script. The file linkgains.dat
describes the attenuation on the link between each pair of nodes and the file noise.dat
contains a sample of noise that is used to build the statistical model used in the simulation.
The syntax and semantic of these files is described in detail the
TOSSIM Documentation.
Description of the simulation output:
The output of the simulation has the following format:
TIME XXXX
The current simulation time.
DEBUG (X): 0: Powering on node
The node X was started.
DEBUG (0): Y: Starting request Z with schema W
The sink node starts disseminating a request to collect data, where schema 0 means that nodes must send their data with a systematic code (i.e. sent at least a packet with a unit coding vector).
DEBUG (X): Request Z: Received request
The node X has received the request Z and will start sending its data for this request.
DEBUG (0): Y: Request Z: Received first packet from W, payload length 9
The sink received the first packet that was initially generated by node W and was forwarded (and coded) by the routing nodes. This confirms that the routing from W to the sink is currently working.
DEBUG (0): Received message at sink : Generation Z (I : seqno J) V ( P )
The sink node received a message with data for request Z, originally created by node I, with ctp seq no J, coding vector V and coded payload P.
DEBUG (0): T: Request Z: Received packet from I, payload length 9, coded: 1, coding vector: V payload: P
The sink decoded the message for request Z generated by node I. The coding vector is a unit vector V and the payload P is what the node sent.
DEBUG (0): Request Z: Estimated X sources out of Y ( W packets received )
The sink has finished waiting for responses for request Z and was able to decode X sources out of the expected Y sources from the W packets it received.