BMac

Package: inet.linklayer.bmac

compound module BMac

Implementation of B-MAC (also called Berkeley MAC, Low Power Listening, or LPL). See C++ documentation for details.

BMac

Inheritance diagram

Extends

Name

Type

Description

MacProtocolBase

simple module

Module base for different MAC protocols.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

interfaceTableModule

string

address

string

“auto”

MAC address as a hex string (12 hex digits), or

slotDuration

double

0.1s

“auto”. “auto” values will be replaced by a generated MAC address in init stage 0. BMAC specific parameters how long is one slot?

headerLength

int

10b

ctrlFrameLength

int

headerLength

mtu

int

0B

checkInterval

double

0.01s

how long is the check interval (CCA)?

animation

bool

true

should we animate the nodes with colors depending on their state or not?

bitrate

double

19200 bps

bit rate

useMACAcks

bool

false

should the MAC send and expect acknowledgments?

radioModule

string

“^.radio”

The path to the Radio module // FIXME remove default value

maxTxAttempts

int

2

Maximum transmission attempts per data packet, when ACKs are used

Properties

Name

Value

Description

class

BMac

display

i=block/rxtx

selfMessageKinds

inet::BMacType

Gates

Name

Direction

Size

Description

upperLayerIn

input

upperLayerOut

output

lowerLayerIn

input

lowerLayerOut

output

Signals

Name

Type

Unit

Description

linkBroken

inet::Packet

packetDropped

cPacket

packetReceivedFromLower

cPacket

packetReceivedFromUpper

cPacket

packetSentToLower

cPacket

packetSentToUpper

cPacket

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

linkBroken

link break

linkBroken

count

none

packetDropIncorrectlyReceived

packet drop: incorrectly received

packetDropReasonIsIncorrectlyReceived(packetDropped)

count,sum(packetBytes),vector(packetBytes)

none

packetDropNotAddressedToUs

packet drop: not addressed to us

packetDropReasonIsNotAddressedToUs(packetDropped)

count,sum(packetBytes),vector(packetBytes)

none

packetDropQueueOverflow

packet drop: queue overflow

packetDropReasonIsQueueOverflow(packetDropped)

count,sum(packetBytes),vector(packetBytes)

none

Source code

//
// Implementation of B-MAC (also called Berkeley MAC, Low Power Listening, or
// LPL).
// See C++ documentation for details.
//
module BMac extends MacProtocolBase like IMacProtocol
{
    parameters:
        string address @mutable = default("auto"); // MAC address as a hex string (12 hex digits), or
                                                   // "auto". "auto" values will be replaced
                                                   // by a generated MAC address in init stage 0.
        // BMAC specific parameters
        // how long is one slot?
        double slotDuration @unit(s) = default(0.1s);

        int headerLength @unit(b) = default(10b);
        int ctrlFrameLength @unit(b) = default(headerLength);
        int mtu @unit(B) = default(0B);

        // how long is the check interval (CCA)?
        double checkInterval @unit(s) = default(0.01s);

        // should we animate the nodes with colors depending on their state or
        // not?
        bool animation = default(true);

        // bit rate
        double bitrate @unit(bps) = default(19200 bps);

        // should the MAC send and expect acknowledgments?
        bool useMACAcks = default(false);

        string radioModule = default("^.radio");   // The path to the Radio module  // FIXME remove default value

        int maxTxAttempts = default(2);     // Maximum transmission attempts per data packet, when ACKs are used

        @class(BMac);
        @signal[linkBroken](type=inet::Packet);
        @statistic[linkBroken](title="link break"; source=linkBroken; record=count; interpolationmode=none);
        @statistic[packetDropIncorrectlyReceived](title="packet drop: incorrectly received"; source=packetDropReasonIsIncorrectlyReceived(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropNotAddressedToUs](title="packet drop: not addressed to us"; source=packetDropReasonIsNotAddressedToUs(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);
        @statistic[packetDropQueueOverflow](title="packet drop: queue overflow"; source=packetDropReasonIsQueueOverflow(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none);

        @selfMessageKinds(inet::BMacType);
}

File: src/inet/linklayer/bmac/BMac.ned