IEEE802.11 implementation in MiXiM

This entry was posted by on Friday, 9 September, 2011 at

In some of my simulation studies I use (a modified) Mac80211 implementation as present in MiXiM for OMNeT++. Sometimes it is sensible to represent 1k+ lines of code in a figure.

Mac80211 Contains both Unicast and Broadcast behaviour. It implements the RTS/CTS and Virtual Carrier Sense by means of the Network Allocation Vector (NAV). It also implements the post-backoff. The default implementation has a single FIFO transmission queue with tail-drop policy, as it was meant to model IEEE 802.11b.

States in Mac80211

The Broadcast functionality is contained in three states: IDLE, CONTEND and BUSY. The other states provide functionality for Unicast.

Mac80211 FSM

  • IDLE – not sending a packet, not receiving Unicast transmission. Possibly counting down post-backoff counter (using the same mechanism as backoff).
  • CONTEND – in contention: a random backoff counter (bc or remainingBackoff as the variable is known in the code) has been chosen from the contention window (CW). The bc is decremented every slotTime and is frozen during transmissions by other stations.
  • BUSY – the station is transmitting: receiver is switched to TX and a Signal is sent to the ConnectionManager, PHY implementation and the AnalogueModels.
  • WFCTS – the station has transmitted an RTS to another station, and is awaiting CTS response. It will break out of this when a CTS is received or a timeout expires.
  • WFACK – the station has transmitted its Unicast data frame and is waiting for an Acknowledgement. It will break out of this when an ACK is received or a timeout expires. In case of a timeout, a retransmission will be performed if the number of attempts < maxAttempts.
  • WFDATA – the station has received an RTS from another station and has replied with a CTS; it is now awaiting the Data frame.
  • QUIET – the station has overheard (part of) the RTS/CTS sequence between two other nodes and has set its NAV to remain quiet during their transmission.

After a transmission is over (signalled by MacToPhyInterface::TX_OVER) the handleEndTransmission function sets relevant counters and calls beginNewCycle() if state was BUSY. Then, if the queue is empty it will switch to state IDLE and perform postbackoff.

See also:

MiXiM / OMNeT++ add ons:
Intelligent Driver Model (IDM) in OMNeT++
OMNeT++ – talking directly to a different module
A Unit Disc propagation model for MiXiM
OMNeT++ and how to get more out of your Scalars
OMNeT++ and MiXiM… and putting our own code in a separate place!

MiXiM bugs:
Bug in Mac80211 in MiXiM backoff when channel busy
MiXiM 802.11 – is CSMA/CA implemented correctly?

Bugs in other simulators:
Duration of SlotTime in IEEE 802.11p – on how NS-2 contains a wrong slotTime for IEEE802.11p.

References
MiXiM API: Mac80211


Leave a Reply