LteMacBase¶
Package: simu5g.stack.mac
compound module LteMacBase
Base module for the Medium Access Control (MAC) layer of the LTE protocol stack.
Provides common functionalities for MAC operations at both the eNodeB and User Equipment (UE) sides, such as functions to exchange MAC Service Data Units (SDUs) with the Radio Link Control (RLC) layer, and MAC Protocol Data Units (PDUs) with the physical layer.
Inheritance diagram¶
Known subclasses¶
Name |
Type |
Description |
|---|---|---|
compound module |
Extends the LteMacBase module by providing specific MAC functions on the eNodeB side. Specifically, it initializes and manages the scheduling classes responsible for resource allocation operations in both uplink and downlink directions, while also supporting Carrier Aggregation (CA). It manages the Random Access procedure (RAC) and the reception of Buffer Status Reports (BSRs) from UEs, as well as the transmission of scheduling grants to UEs allocated within the uplink bandwidth. For downlink connections, it notifies the Radio Link Control (RLC) layer when it is ready to receive MAC Service Data Units (SDUs) to build MAC Protocol Data Units (PDUs) and transmit them to the physical layer. |
|
compound module |
Extends the LteMacBase module by providing specific MAC functions at the User Equipment (UE) side. For uplink connections, this module manages the initiation of the Random Access procedure (RAC) and the sending of Buffer Status Reports (BSRs) to the eNodeBs. Once it receives an uplink scheduling grant from the eNodeB, it is responsible for managing the local connections’ scheduler and constructing MAC Protocol Data Units (PDUs) to be transmitted to the physical layer. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
macNodeId |
int |
MacNodeId of the stack leg this MAC belongs to (set by the NIC) |
|
binderModule |
string |
“binder” |
|
queueSize |
int |
2MiB |
MAC Buffers queue size |
harqProcesses |
int |
8 |
|
maxHarqRtx |
int |
3 |
|
harqFbEvaluationTimer |
int |
4 |
Number of slots for sending back HARQ FB |
statDisplay |
bool |
false |
Properties¶
Name |
Value |
Description |
|---|---|---|
display |
i=block/mac |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
upperLayerIn |
input |
From RLC |
|
upperLayerOut |
output |
To RLC |
|
phyIn |
input |
From PHY |
|
phyOut |
output |
To PHY |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
grantSent |
|||
harqErrorRate_1st_Dl |
|||
harqErrorRate_1st_Ul |
|||
harqErrorRate_2nd_Dl |
|||
harqErrorRate_2nd_Ul |
|||
harqErrorRate_3rd_Dl |
|||
harqErrorRate_3rd_Ul |
|||
harqErrorRate_4th_Dl |
|||
harqErrorRate_4th_Ul |
|||
harqErrorRateDl |
|||
harqErrorRateUl |
|||
harqTxAttemptsDl |
|||
harqTxAttemptsUl |
|||
macBufferOverFlowDl |
|||
macBufferOverFlowUl |
|||
macCellPacketLossDl |
|||
macCellPacketLossUl |
|||
macDelayDl |
|||
macDelayUl |
|||
macPacketLossDl |
|||
macPacketLossUl |
|||
macPduAcked |
|||
macPduDiscarded |
|||
macThroughputDl |
|||
macThroughputUl |
|||
receivedPacketFromLowerLayer |
|||
receivedPacketFromUpperLayer |
|||
rlcPduDiscarded |
|||
sentPacketToLowerLayer |
|||
sentPacketToUpperLayer |
|||
ulMacPduArrived |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
harqErrorRate_1st_Dl |
Harq Error Rate Dl (1st tx) |
harqErrorRate_1st_Dl |
mean,vector |
|||
harqErrorRate_1st_Ul |
Harq Error Rate Ul (1st tx) |
harqErrorRate_1st_Ul |
mean,vector |
|||
harqErrorRate_2nd_Dl |
Harq Error Rate Dl (2nd tx) |
harqErrorRate_2nd_Dl |
mean,vector |
|||
harqErrorRate_2nd_Ul |
Harq Error Rate Ul (2nd tx) |
harqErrorRate_2nd_Ul |
mean,vector |
|||
harqErrorRate_3rd_Dl |
Harq Error Rate Dl (3rd tx) |
harqErrorRate_3rd_Dl |
mean,vector |
|||
harqErrorRate_3rd_Ul |
Harq Error Rate Ul (3rd tx) |
harqErrorRate_3rd_Ul |
mean,vector |
|||
harqErrorRate_4th_Dl |
Harq Error Rate Dl (4th tx) |
harqErrorRate_4th_Dl |
mean,vector |
|||
harqErrorRate_4th_Ul |
Harq Error Rate Ul (4th tx) |
harqErrorRate_4th_Ul |
mean,vector |
|||
harqErrorRateDl |
Harq Error Rate Dl |
harqErrorRateDl |
mean,vector |
|||
harqErrorRateUl |
Harq Error Rate Ul |
harqErrorRateUl |
mean,vector |
|||
harqTxAttemptsDl |
Harq Tx Attempts Dl |
harqTxAttemptsDl |
mean,vector |
|||
harqTxAttemptsUl |
Harq Tx Attempts Ul |
harqTxAttemptsUl |
mean,vector |
|||
macBufferOverFlowDl |
Mac buffer overflow as function of time |
macBufferOverFlowDl |
mean |
Byte/s |
||
macBufferOverFlowUl |
Mac buffer overflow as function of time |
macBufferOverFlowUl |
mean |
Byte/s |
||
macCellPacketLossDl |
Mac Cell Packet Loss Dl |
macCellPacketLossDl |
mean |
|||
macCellPacketLossUl |
Mac Cell Packet Loss Ul |
macCellPacketLossUl |
mean |
|||
macDelayDl |
Delay at the MAC layer UL |
macDelayDl |
mean,vector |
s |
||
macDelayUl |
Delay at the MAC layer UL |
macDelayUl |
mean,vector |
s |
||
macPacketLossDl |
Mac Packet Loss Dl |
macPacketLossDl |
mean |
|||
macPacketLossUl |
Mac Packet Loss Ul |
macPacketLossUl |
mean |
|||
macThroughputDl |
Throughput at the MAC layer DL |
macThroughputDl |
simu5g_rateavg |
Bps |
||
macThroughputUl |
Throughput at the MAC layer UL |
macThroughputUl |
simu5g_rateavg |
Bps |
||
receivedPacketFromLowerLayer |
receivedPacketFromLowerLayer |
count,”sum(packetBytes)”,”vector(packetBytes)” |
none |
|||
receivedPacketFromUpperLayer |
receivedPacketFromUpperLayer |
count,”sum(packetBytes)”,”vector(packetBytes)” |
none |
|||
sentPacketToLowerLayer |
sentPacketToLowerLayer |
count,”sum(packetBytes)”,”vector(packetBytes)” |
none |
|||
sentPacketToUpperLayer |
sentPacketToUpperLayer |
count,”sum(packetBytes)”,”vector(packetBytes)” |
none |
Source code¶
//
// Base module for the Medium Access Control (MAC) layer of the LTE protocol stack.
//
// Provides common functionalities for MAC operations at both the
// eNodeB and User Equipment (UE) sides, such as functions to exchange MAC Service
// Data Units (SDUs) with the Radio Link Control (RLC) layer, and MAC Protocol Data
// Units (PDUs) with the physical layer.
//
module LteMacBase like ILteMac
{
parameters:
@display("i=block/mac");
int macNodeId; // MacNodeId of the stack leg this MAC belongs to (set by the NIC)
string binderModule = default("binder");
//# Mac Queues
int queueSize @unit(B) = default(2MiB); // MAC Buffers queue size
//# Mac MIB
//# H-ARQ
int harqProcesses = default(8);
int maxHarqRtx = default(3);
int harqFbEvaluationTimer = default(4); // Number of slots for sending back HARQ FB
//# Statistics display (in GUI)
bool statDisplay = default(false);
//# Statistics recording
@signal[macDelayDl];
@statistic[macDelayDl](title="Delay at the MAC layer UL"; unit="s"; source="macDelayDl"; record=mean,vector);
@signal[macThroughputDl];
@statistic[macThroughputDl](title="Throughput at the MAC layer DL"; unit="Bps"; source="macThroughputDl"; record=simu5g_rateavg);
@signal[macDelayUl];
@statistic[macDelayUl](title="Delay at the MAC layer UL"; unit="s"; source="macDelayUl"; record=mean,vector);
@signal[macThroughputUl];
@statistic[macThroughputUl](title="Throughput at the MAC layer UL"; unit="Bps"; source="macThroughputUl"; record=simu5g_rateavg);
@signal[macCellPacketLossDl];
@statistic[macCellPacketLossDl](title="Mac Cell Packet Loss Dl"; unit=""; source="macCellPacketLossDl"; record=mean);
@signal[macCellPacketLossUl];
@statistic[macCellPacketLossUl](title="Mac Cell Packet Loss Ul"; unit=""; source="macCellPacketLossUl"; record=mean);
@signal[macPacketLossUl];
@statistic[macPacketLossUl](title="Mac Packet Loss Ul"; unit=""; source="macPacketLossUl"; record=mean);
@signal[macPacketLossDl];
@statistic[macPacketLossDl](title="Mac Packet Loss Dl"; unit=""; source="macPacketLossDl"; record=mean);
@signal[macBufferOverFlowDl];
@statistic[macBufferOverFlowDl](title="Mac buffer overflow as function of time"; unit="Byte/s"; source="macBufferOverFlowDl"; record=mean);
@signal[macBufferOverFlowUl];
@statistic[macBufferOverFlowUl](title="Mac buffer overflow as function of time"; unit="Byte/s"; source="macBufferOverFlowUl"; record=mean);
@signal[harqErrorRateUl];
@statistic[harqErrorRateUl](title="Harq Error Rate Ul"; unit=""; source="harqErrorRateUl"; record=mean,vector);
@signal[harqErrorRateDl];
@statistic[harqErrorRateDl](title="Harq Error Rate Dl"; unit=""; source="harqErrorRateDl"; record=mean,vector);
@signal[harqTxAttemptsDl];
@statistic[harqTxAttemptsDl](title="Harq Tx Attempts Dl"; unit=""; source="harqTxAttemptsDl"; record=mean,vector);
@signal[harqTxAttemptsUl];
@statistic[harqTxAttemptsUl](title="Harq Tx Attempts Ul"; unit=""; source="harqTxAttemptsUl"; record=mean,vector);
@signal[harqErrorRate_1st_Ul];
@statistic[harqErrorRate_1st_Ul](title="Harq Error Rate Ul (1st tx)"; unit=""; source="harqErrorRate_1st_Ul"; record=mean,vector);
@signal[harqErrorRate_1st_Dl];
@statistic[harqErrorRate_1st_Dl](title="Harq Error Rate Dl (1st tx)"; unit=""; source="harqErrorRate_1st_Dl"; record=mean,vector);
@signal[harqErrorRate_2nd_Ul];
@statistic[harqErrorRate_2nd_Ul](title="Harq Error Rate Ul (2nd tx)"; unit=""; source="harqErrorRate_2nd_Ul"; record=mean,vector);
@signal[harqErrorRate_2nd_Dl];
@statistic[harqErrorRate_2nd_Dl](title="Harq Error Rate Dl (2nd tx)"; unit=""; source="harqErrorRate_2nd_Dl"; record=mean,vector);
@signal[harqErrorRate_3rd_Ul];
@statistic[harqErrorRate_3rd_Ul](title="Harq Error Rate Ul (3rd tx)"; unit=""; source="harqErrorRate_3rd_Ul"; record=mean,vector);
@signal[harqErrorRate_3rd_Dl];
@statistic[harqErrorRate_3rd_Dl](title="Harq Error Rate Dl (3rd tx)"; unit=""; source="harqErrorRate_3rd_Dl"; record=mean,vector);
@signal[harqErrorRate_4th_Ul];
@statistic[harqErrorRate_4th_Ul](title="Harq Error Rate Ul (4th tx)"; unit=""; source="harqErrorRate_4th_Ul"; record=mean,vector);
@signal[harqErrorRate_4th_Dl];
@statistic[harqErrorRate_4th_Dl](title="Harq Error Rate Dl (4th tx)"; unit=""; source="harqErrorRate_4th_Dl"; record=mean,vector);
@signal[receivedPacketFromUpperLayer];
@statistic[receivedPacketFromUpperLayer](source="receivedPacketFromUpperLayer"; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
@signal[receivedPacketFromLowerLayer];
@statistic[receivedPacketFromLowerLayer](source="receivedPacketFromLowerLayer"; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
@signal[sentPacketToUpperLayer];
@statistic[sentPacketToUpperLayer](source="sentPacketToUpperLayer"; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
@signal[sentPacketToLowerLayer];
@statistic[sentPacketToLowerLayer](source="sentPacketToLowerLayer"; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
@signal[macPduAcked];
@signal[macPduDiscarded];
@signal[rlcPduDiscarded];
@signal[grantSent];
@signal[ulMacPduArrived];
gates:
//# Gates connecting RLC and MAC Layers
input upperLayerIn; // From RLC
output upperLayerOut; // To RLC
//# Gates connecting MAC and PHY Layers
input phyIn; // From PHY
output phyOut; // To PHY
}