Simple Module csma

Package: org.mixim.modules.mac
File: modules/mac/csma.ned

C++ definition

Generic CSMA protocol supporting Mac-ACKs as well as constant, linear or exponential backoff times.

csma

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram. Click here to see the full picture.

Inheritance diagram:

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram. Click here to see the full picture.

Extends:

BaseMacLayer (simple module)

Base module for every mac layer module

Known subclasses:

CSMA802154 (simple module)

IEEE 802.15.4-2006 non-beacon enabled CSMA protocol This model was independently validated on a wireless sensor network testbed. For more information, see Accurate Timeliness Simulations for Real-Time Wireless Sensor Networks, J. Rousselot, J.-D. Decotignie, M. Aoun, P. van der Stok, R. Serna Oliver, G. Fohler. In Proceedings of the 2009 Third UKSim European Symposium on Computer Modeling and Simulation.

Used in compound modules:

If a module type shows up more than once, that means it has been defined in more than one NED file.

NicCSMA (compound module)

This module implements a CSMA network interface card using the "csma" MAC layer module

Parameters:

Name Type Default value Description
notAffectedByHostState bool false
coreDebug bool

debug switch

headerLength double 72 bit

length of the MAC packet header (in bits)

debug bool false

debug switch

stats bool true
trace bool false
queueLength double 100

size of the MAC queue (maximum number of packets in Tx buffer)

bitrate double 250000 bps

bit rate

ccaDetectionTime double 0.000128 s

Clear Channel Assessment detection time

rxSetupTime double

Time to setup radio to reception state

aTurnaroundTime double 0.000192 s

Time to switch radio from Rx to Tx state

txPower double

tx power [mW]

useMACAcks bool

Send/Expect MAC acks for unicast traffic?

macMaxFrameRetries double 3

maximum number of frame retransmission only used when usage of MAC acks is enabled

macAckWaitDuration double 0.00056 s

time to wait for an acknowledgement after transmitting a unicast frame. only used when usage of MAC acks is enabled

ackLength double 40 bit

complete MAC ack message length (in bits) (! headerLength is not added to this) only used when usage of MAC acks is enabled

sifs double 0.000192 s

simple interframe space. Time to wait between receiving a frame and acknowledging it. Should be bigger than the maximum time for switching between Tx and Rx at the receiver. only used when usage of MAC acks is enabled

backoffMethod string "linear"

backoff method to use: constant, linear or exponential

macMaxCSMABackoffs double 5

maximum backoffs

aUnitBackoffPeriod double 0.00032 s

base unit for all backoff calculations

contentionWindow int 2

# of backoff periods of the initial contention window (for linear and constant backoff method only)

macMinBE double 3

minimum backoff exponent (for exponential backoff method only)

macMaxBE double 8

maximum backoff exponent (for exponential backoff method only)

Properties:

Name Value Description
class csma

Gates:

Name Direction Size Description
upperGateIn input

from upper layer

upperGateOut output

to uppe layer

upperControlIn input

control from upper layer

upperControlOut output

control to upper layer

lowerGateIn input

from lower layer

lowerGateOut output

to lower layer

lowerControlIn input

control from lower layer

lowerControlOut output

control to lower layer

Source code:

//
// Generic CSMA protocol supporting Mac-ACKs as well as
// constant, linear or exponential backoff times.
//
simple csma extends BaseMacLayer
{
    parameters:
        @class(csma);
        // debug switch
        bool debug = default(false);
        bool stats = default(true);
        bool trace = default(false);

        // length of MAC header
        headerLength @unit(bit) = default(72 bit);
        // size of the MAC queue (maximum number of packets in Tx buffer)
        double queueLength = default(100);
        // bit rate 
        double bitrate @unit(bps) = default(250000 bps);

        // Clear Channel Assessment detection time
        double ccaDetectionTime @unit(s) = default(0.000128 s); // 8 symbols
        // Time to setup radio to reception state
        double rxSetupTime @unit(s);
        // Time to switch radio from Rx to Tx state
        double aTurnaroundTime @unit(s) = default(0.000192 s);    // 12 symbols
        //tx power [mW]
        double txPower @unit(mW);

        // Send/Expect MAC acks for unicast traffic?
        bool useMACAcks;
        // maximum number of frame retransmission
        // only used when usage of MAC acks is enabled
        double macMaxFrameRetries = default(3);
        // time to wait for an acknowledgement after transmitting a unicast frame.
        // only used when usage of MAC acks is enabled
        double macAckWaitDuration @unit(s) = default(0.00056 s);  // 1+12+10+12 symbols
        // complete MAC ack message length (in bits) 
        // (! headerLength is not added to this)
        // only used when usage of MAC acks is enabled
        double ackLength @unit(bit) = default(40 bit);
        // simple interframe space. Time to wait between receiving a frame and acknowledging it.
        // Should be bigger than the maximum time for switching between Tx and Rx at the receiver.
        // only used when usage of MAC acks is enabled
        double sifs @unit(s) = default(0.000192 s); // 12 symbols

        //backoff method to use: constant, linear or exponential
        string backoffMethod = default("linear");
        // maximum backoffs
        double macMaxCSMABackoffs = default(5);
        // base unit for all backoff calculations
        double aUnitBackoffPeriod @unit(s) = default(0.00032 s);
        // # of backoff periods of the initial contention window
        // (for linear and constant backoff method only)
        int contentionWindow = default(2);
        // minimum backoff exponent (for exponential backoff method only)
        double macMinBE = default(3);
        // maximum backoff exponent (for exponential backoff method only)
        double macMaxBE = default(8);

}