BMac

Package: inet.linklayer.bmac

BMac

compound module

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

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
MacProtocolBase simple module

Module base for different MAC protocols.

Parameters

Name Type Default value Description
interfaceTableModule string
address string "auto"

MAC address as hex string (12 hex digits), or "auto". "auto" values will be replaced by a generated MAC address in init stage 0.

slotDuration double 0.1s

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 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
display i=block/rxtx
class BMac
selfMessageKinds inet::BMacType

Gates

Name Direction Size Description
upperLayerIn input
upperLayerOut output
lowerLayerIn input
lowerLayerOut output

Signals

Name Type Unit
linkBroken inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode
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
linkBroken link break linkBroken count none
packetDropIncorrectlyReceived packet drop: incorrectly received packetDropReasonIsIncorrectlyReceived(packetDropped) count, sum(packetBytes), vector(packetBytes) none

Scheduled messages (observed)

msgkindctrltagsmsgnamecontext
Packet192 (BMacType::BMAC_DATA)ErrorRateInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirIndpingNN
omnetpp::cMessage196 (BMacType::BMAC_START_BMAC)start_bmac
omnetpp::cMessage197 (BMacType::BMAC_WAKE_UP)wakeup
omnetpp::cMessage199 (BMacType::BMAC_CCA_TIMEOUT)cca_timeout
omnetpp::cMessage201 (BMacType::BMAC_SEND_PREAMBLE)send_preamble
omnetpp::cMessage202 (BMacType::BMAC_STOP_PREAMBLES)stop_preambles
omnetpp::cMessage203 (BMacType::BMAC_DATA_TX_OVER)data_tx_over
omnetpp::cMessage204 (BMacType::BMAC_DATA_TIMEOUT)data_timeout

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
PcapRecorderinet::PcapRecorder::receiveSignalpacketReceivedFromLower
InterfaceTableinet::InterfaceTable::interfaceChangedinterfaceChanged
ApskDimensionalRadioinet::physicallayer::ApskRadio::setRadioModesetRadioMode
ApskScalarRadioinet::physicallayer::ApskRadio::setRadioModesetRadioMode
UnitDiskRadioinet::physicallayer::UnitDiskRadio::setRadioModesetRadioMode
DropTailQueueinet::queueing::PacketQueue::pullPacketpullPacket

Called methods (observed)

functioninfocall from
inet::BMac::handleCanPullPacketChangedhandleCanPullPacketChangedDropTailQueue
inet::BMac::receiveSignalradioModeChangedApskDimensionalRadio, ApskScalarRadio, UnitDiskRadio
inet::BMac::receiveSignaltransmissionStateChangedApskDimensionalRadio, ApskScalarRadio, UnitDiskRadio

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
lowerLayerInPacket0ApskDimensionalRadioErrorRateInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
lowerLayerInPacket0ApskScalarRadioErrorRateInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
lowerLayerInPacket0UnitDiskRadioErrorRateInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd

Outgoing messages (observed)

gatemsgkindctrldestModuletags
lowerLayerOutPacket0ApskDimensionalRadioPacketProtocolTag, InterfaceReq?, MacAddressReq?
lowerLayerOutPacket0ApskScalarRadioPacketProtocolTag, DispatchProtocolInd?, InterfaceReq?, MacAddressReq?, MulticastReq?, NetworkProtocolInd?, TransportProtocolInd?
lowerLayerOutPacket0UnitDiskRadioPacketProtocolTag, DispatchProtocolInd?, InterfaceReq?, MacAddressReq?, NetworkProtocolInd?, SocketReq?
upperLayerOutPacket0ArpDispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd
upperLayerOutPacket0Ipv4DispatchProtocolReq, ErrorRateInd, InterfaceInd, MacAddressInd, PacketProtocolTag, SignalPowerInd, SignalTimeInd, SnirInd

Pull in messages (observed)

gatemsgkindctrlsrcModuletags
upperLayerInPacket0DropTailQueueInterfaceReq, MacAddressReq, PacketProtocolTag, DispatchProtocolInd?, MulticastReq?, NetworkProtocolInd?, SocketReq?, TransportProtocolInd?

Packet operations (observed)

chunkTypepacketAction
BMacControlFrameinsertAtFront
BMacDataFrameHeaderinsertAtFront, peekAtFront, popAtFront
BMacHeaderBasepeekAtFront

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolReqaddTagIfAbsent
InterfaceIndaddTagIfAbsent
MacAddressIndaddTagIfAbsent
MacAddressReqgetTag
PacketProtocolTagaddTag, addTagIfAbsent, getTag

Source code

//
// Implementation of B-MAC (called also 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 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 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