A.     Contention based MAC

 

The file maccon.h and maccon.cc in folder mac is an example implementation for contention based MAC.  In this Maccon, each node randomly selects a channel from a predefined channel list. Since each node is not aware of what channel being used by other node, collision is still existed for this random channel selection. The channel information selected by each node is passed to PHY layer through the packet header.

 

In this Maccon, the channel list array number is equal to the number of nodes in the simulation script test4maccon.tcl. Nodes randomly select the channel based on this channel array. In the topology and traffic file topo4.tcl, 3 pairs of nodes are transmitted simultaneously.  Since the channel decision of this MAC depends on specific transmission scenario, users need to add change to make Maccon adapt to other scenarios.

 

Besides the code change in MAC, the following code should be added in the sendDown function of wirelessphy.

Module wirelessphy: example about how to use interface for MAC

void WirelessPhy::sendDown(Packet *p){

     

                // Send the packet

                //channel_->recv(p, this);

 

               multichannel[hdr_cmn::access(p)->channelindex_]->recv(p, this);

 

     

}

 

B. Collision free MAC

The file macng.h and macng.cc in folder mac is an example implementation for collision frees MAC. In intelligent based and schedule based MAC, they both require negotiation about channel decision and transmission parameters. Most of the current intelligent based and schedule based MAC are negotiated over common control channel. In this example, we illustrate the how to negotiate through common control channel and make the channel decision.

 

The operation of Macng is divided into two phases. In the first phase, each node sends out strategy packet with preferred receiving channel. If there is an empty channel available, then it is selected as the preferred receiving channel. If there is no empty channel, node shares the channel with the node that is furthest away from it. In the second phase, node will use the channel selected during the first phase to send and receive data. The channel selection algorithms we are using is a simple rule, which is for the demonstration purpose, hence, collision still exists.

 

Besides the code change in MAC, the following code should be added in the sendDown function of wirelessphy.

Module wirelessphy: example about how to use interface for MAC

void WirelessPhy::sendDown(Packet *p){

     

                // Send the packet

                //channel_->recv(p, this);

 

               multichannel[hdr_cmn::access(p)->channelindex_]->recv(p, this);

 

     

}

 

The simulation script for this MAC can be found in test4macng.tcl (with topo4.tcl).

Here is the simulation result for Maccon and Macng.

 

Previous: Exemplary Demonstrations Overview       Next: GUI user guide

Return to Main…