DRAND has been implemented on NS-2 (version 2.26) as well as the TinyOS platform for sensor networks
• NS-2 installations instructions:
o Download the source tarball
o Untar it in your ns top-level directory: (NS_INSTALL_DIRECTORY)/ns-2.26.
o Add an entry in the Makefile for DRAND files as "drandNS2/drandAgent.o" for the OBJ_CC target.
o Add entry for DRAND packet type in (NS_INSTALL_DIRECTORY)/ns-2.26/tcl/lib/ns-packet.tcl as "DRAND" - sample .
o Add entry for DRAND packet type in (NS_INSTALL_DIRECTORY)/ns-2.26/common/packet.h as "PT_DRAND" - sample .
o Replace ns2.26/mac/mac-802_11.cc with this file: There is a small change to enable broadcast for DRAND packets.
o Replace ns2.26/trace/cmu-trace.cc with with this file: This adds support for DRAND packets.
• NS-2 execution instructions:
o Download the tcl script tarball
o Untar it in any location in your file-system.
o Execute simulation by the follwing command: "ns simple-wireless.tcl
o File "simple-wireless.tcl" runs a simulation of
o For generating the scenario file, use the CMU scenario generator included in the ns2 distribution: (NS_INSTALL_DIRECTORY)/ns-2.26/indep-utils/cmu-scen-gen/setdest. Also, note that the scenario should not contain any node motion, so please use the option "-p 0 -s 0"
o DRAND is composed of two phases - a "HELLO" phase, where nodes send beacons to each other to probe their network neighborhood, and the "DRAND" phase where the DRAND algorithm is run and a TDMA schedule is produced (For more details please refer to the paper "Randomized Dining Philosophers to TDMA Scheduling in Wireless Sensor Networks".
o DRAND output is as follows:
MESSAGE sID 82 mCt 15 rReq 0 rGra 0 mTime 27.826388 oneHopCount 7
MESSAGE sID 82 reqCt 1 graCt 7 rejCt 0 relCt 0 twoCt 7
MESSAGE sID 82 Round 20 maxC 0 twoHopMaxC 0 slotNum 11 roundDelay 0.023284 grantDelay 0.018388
Some of the noteworthy fields are:
sID = Node ID
mCt = Total messages transmitted
mTime = Total time for the node to get its own time slot
oneHopCount = Total number of nodes within one hop to this node
slotNum = TDMA slot assigned by DRAND
o In case of difficulties, contact Ajit Warrier.
• Software will be released soon.