README
上传用户:joranyuan
上传日期:2022-06-23
资源大小:3306k
文件大小:4k
- This is a simple multi-hop application displaying the use of Z-MAC. Nodes
- send packets evert SEND_RATE ms to a sink node.
- Working
- -------
- A rough sketch of how the application works is as follows:
- 0. Application is initialized in B-MAC mode.
- 1. Upon starting, routing is initiated for ROUTE_TIME ms
- 2. At the end of routing, if DRAND_ENABLE is defined,
- DRAND is initiated for DRAND_TIME ms, else MAC is switched
- to Z-MAC and nodes start sending at once.
- 3. if DRAND_ENABLE is defined, at the end of DRAND, the
- mac is switched to Z-MAC, and nodes start sending.
- 4. Statistics is printed out every STAT_TIME ms
- DRAND
- -----
- As explained in the top level README, Z-MAC need DRAND information. This
- can be supplied in two ways, DRAND can be made to run during initialization,
- or it can be run separately, and the information may be stored in a file
- and supplied statically. The first is the default way to run Z-MAC, the
- second is useful when testing.
- To run DRAND separately:
- - use the application apps/TestBedTopology and run
- it on your testbed with options -DDEBUG and -DES_DEBUG.
- - The output from each node should be stored using telnet sessions.
- A sample script used for our testbed is included in this directory,
- called runDrand.py. You will need to edit for your environment.
- [Note, the program loadlistTB is a local program we use to upload our
- mica2 images onto the testbed motes. It is included for reference,
- telmoteTB is another small script to open telnet sessions to each
- mote and log the
- output to separate files, it is also included.]
- - Run a simple script to convert the DRAND neighbor information into
- a file 'nbrTable.h', a sample can be found in tos/platform/mica2. A
- script to perform this conversion is also included, called
- getNbrTableForZMAC.py. You will need to edit it for your own environment.
- The script takes only one parameter, the node id of the sink.
- - Finally put this file nbrTable.h into tos/platform/mica2 and
- DO NOT use -DDRAND_ENABLE in your Makefile
- To run DRAND on initialization:
- - compile application with -DDRAND_ENABLE in the Makefile
- Z-MAC
- -----
- Once DRAND is over, Z-MAC begins transmission. Note that Z-MAC being
- built on top of B-MAC executes in B-MAC mode till it gets DRAND
- information. The switch from B-MAC to Z-MAC mode is performed by
- calling the command
- command result_t SetDrand.Set(nodeInfo *myInfo, uint8_t nHop,
- nodeInfo *nInfo, uint16_t sSize);
- The first parameter is a pointer to a structure of type nodeInfo, defined in
- tos/system/DrandMSG.h, which contains neighbor information (slot/frame,etc.)
- myInfo contains my own slot/frame information.
- The second information is the current next hop towards the sink, as
- determined from routing.
- The third parameter is again of type pointer to nodeInfo - nInfo is a pointer
- to an array of type nodeInfo containing neighbor information.
- The fourth parameter is the current TDMA slot size, default is 50ms.
- Once DRAND is over, myInfo can be obtained by calling Drand.getMyInfo(),
- and nInfo can be obtained by calling Drand.getNeighborInfo() [see the
- code in MultiHopThroughput for more details].
- Clearly, if you are using the static method (above) for DRAND, then
- you can pass NULL for both nInfo and myInfo, since the nbrTable.h
- should contain the relevant information.
- A simple script to run Z-MAC applicatin is included called runExp.py.
- Makefile Options
- ----------------
- - SLEEPTIME is the time for sleep in LPL mode (unit is ms). If it is
- 0, then Z-MAC operates in full 100% duty cycle mode.
- - PREAMBELELEN is the length of the preamble in bytes
- - SELECTHCL is the boolean variable deciding whether you are in HCL mode
- or LCL mode (see paper for HCL/LCL description)
- - SEND_RATE is the inter-packet time (unit ms), or 1/SEND_RATE is the
- transmission rate in packets/second