CoopMAC Tutorial
Table of Contents
Major Components of CoopMAC
CoopMAC implementation is composed of set of logics and data structures.Following are the major components of CoopMAC.
- Helper learning logic: this provides mechanism for a wireless node to learn about potential helper candidates.
- Helper selection logic for transmission.
- Data structures(CoopTable) to store information related to potential helpers.
- Cooppackets(passing on control information to selected helper along with data).
- Hello Packets for relaying channel conditions to neighboring nodes.
Helper Learning
Each wireless node maintains a table called Cooptable, of potential helpers that can be used for assistance during transmission. The creation and updating of the Cooptable is done by passively listening to all ongoing transmissions. Hello packets can also be used to sereve this purpose. When a transmission from a station is overheard, a CoopMAC station estimates the channel condition between the sender of that packet and itself by measuring the received signal strength. When station overhears a data packet transmission betwwen a pair of other stations, it will identify the data rate used for this transmission. A helper station is stored in the Cooptable by the station if it satisfies
A station updates a cooptable if it learns a better route, the entry becomes stale or unsuccessful transmission attempts exceed a threshold for that route.
Helper selection for transmission
When a source station has data to send to a destination, it checks each helper entry in the CoopTable corresponding to that destination to decide whether to transmit through a particular helper. The helper through which the minimum transmission time is achieved will be chosen as the candidate helper. If multiple stations have the same value, the one with the most recent Time value will be chosen.
CoopTable
Cooptable is used to store information about potential helpers for a given destination. For a given destination it stores direct transmission rate, possible helpers and their rate and an index pointing to fastest helper. Below image shows a cooptable.
The code defining the cooptable is
struct helperAddrAndRate{ unsigned char helperAddr[MACADDRESSLEN]; //float ratethruhelper; // rate achieved using the helper... // check out what you want the data type to be here.... RATETYPE ratethruhelper; int valid; // TRUE if the entry is valid, FALSE otherwise..... intiallized to FALSE }; struct cooptableentry{ unsigned char destAddr[MACADDRESSLEN]; //float ratedirect; //rate achieved without using any helper... RATETYPE ratedirect; struct helperAddrAndRate helper[MAXNOOFHELPERS]; int valid; // to denote whether this entry is valid.... TRUE if the entry is valid, // FAlSE otherwise // intiallized to FALSE //latest field to be added to the structure int index; // this indicates which helper gives the fastest transmission rate....., initially set to INVALID // note that this index only compares the helpers and does not compare the rate at which the destination can itself send it without using any helpers };
CoopHeader
Coopheader is used to notify a node that it has been chosen as a helper.
When a node receives a packet with above header it will find out that it has been chosen as a helper to assist in transmission between given source and destination.
The code definig the coopheader is
struct coopHeader{ unsigned char srcAddr[6]; unsigned char helperAddr[6]; unsigned char destAddr[6]; };
Hello Packets
Hello Packets are used to update the cooptable. They contain information about neighboring nodes and corresponding transmission rates.
Subroutine for constructing hello packets is given below.
void constructHelloPacket(){ int y=0; for(y=0; y<NOOFCOOPTABLEENTRIES;y++){ cooptable[y].destAddr[0] = 0x16; cooptable[y].destAddr[1] = 0x24; cooptable[y].destAddr[2]= 0x63; cooptable[y].destAddr[3]= 0x53; cooptable[y].destAddr[4]= 0xe2; cooptable[y].destAddr[5]= 0xc3 + y; cooptable[y].ratedirect = 0x00 + y; cooptable[y].valid = TRUE; } int x = 0; int yindex = 0; for(x=0;x<NOOFCOOPTABLEENTRIES; x++){ data[yindex+0] = cooptable[x].destAddr[0]; data[yindex+1] = cooptable[x].destAddr[1]; data[yindex+2] = cooptable[x].destAddr[2]; data[yindex+3] = cooptable[x].destAddr[3]; data[yindex+4] = cooptable[x].destAddr[4]; data[yindex+5] = cooptable[x].destAddr[5]; data[yindex + 6] = cooptable[x].ratedirect; yindex = yindex + 7; } hello.pktRev=CSMAMAC; hello.pktType=COOPHELLO; unsigned char tmpdestAddr[6] = {0x16,0x24,0x63,0x53,0xe2,0xc5};// ip 3 memcpy(hello.destAddr,tmpdestAddr,6); memcpy(hello.srcAddr,myAddr,6); hello.currReSend=0; hello.length=NOOFCOOPTABLEENTRIES*(MACADDRESSLEN + RATEBYTELEN); hello.data = data; hello.isNew =1; int ijk=0;char tip; printf("hello contents \n"); for(ijk=0;ijk<hello.length; ijk++){ tip= hello.data[ijk]; printf("%x ",tip); } printf("\n"); }
Attachments
- ratelogic.JPG (3.2 kB) - added by member on 12/28/2007 01:59:29 AM.
- sysdiagram.jpg (61.7 kB) - added by member on 12/28/2007 02:30:04 AM.
- cooptable.JPG (21.4 kB) - added by member on 12/28/2007 06:36:45 PM.
- header.JPG (7.2 kB) - added by member on 01/02/2008 12:58:38 PM.
- hello.JPG (16.0 kB) - added by member on 01/02/2008 02:28:09 PM.

