Generate BSR MAC CE
generates a regular or periodic buffer status report (BSR) medium access control (MAC)
control element (CE). The input
bsr] = nrMACBSR(
lcgBufferSize specifies the buffer size
values for logical channel groups (LCGs). The function generates the BSR for the nonzero
values specified in
lcgBufferSize. The function also returns
lcid, which indicates the logical channel ID corresponding to the
generates a padding BSR MAC CE.
bsr] = nrMACBSR(
lcgPriority specifies the priority of
paddingBytes specifies the number of available padding bytes
for the function to use to generate the padded BSR MAC CE.
Generate Regular or Periodic BSR MAC CE
Generate a regular or periodic BSR MAC CE for a single LCG.
lcgbuffersize = [0 0 0 9000]; % LCG 3 has data for transmission [lcid,bsr] = nrMACBSR(lcgbuffersize)
lcid = 61
bsr = 118
LCID 61 represents a short BSR format because only one LCG has data to transmit.
Now generate regular or periodic BSR MAC CE when all eight LCGs have data to transmit.
LCID 62 represents a long BSR format because more than one LCG has data to transmit.
lcgbuffersize = [20000 700 624 3030 125 1020 3500 2100]; [lcid,bsr] = nrMACBSR(lcgbuffersize)
lcid = 62
bsr = 9×1 255 121 68 66 91 41 74 94 86
Generate Padding BSR MAC CE
Generate a padding BSR MAC CE for multiple LCGs.
Specify the LCG buffer size, LCG priority, and padding bytes.
lcgBufferSize = [1200 3450 7000 4500 5250 6000 2100 9000]; lcgPriority = [4 15 2 10 7 3 2 9]; paddingBytes = 5;
Generate a padding BSR MAC CE.
[lcid,bsr] = nrMACBSR(lcgBufferSize,lcgPriority,paddingBytes)
lcid = 60
bsr = 3×1 255 105 86
lcgBufferSize — Buffer size of LCGs
Buffer size of the LCGs, specified as a vector with a maximum of eight elements.
In this vector, specify the LCGs in increasing order of their corresponding LCG IDs. The LCG IDs are indexed from 0 to 7.
The size of the vector is limited by the highest LCG ID having nonzero data available for transmission.
lcgPriority — Priority of LCGs
vector with elements in the range [1, 16]
Priority of the LCGs, specified as a vector with elements in the range [1, 16]. In this vector, list the priority in increasing order of LCG ID.
A lower priority value indicates an LCG with higher priority, and a higher priority value indicates an LCG with lower priority. For a long truncated BSR format, the LCGs with equal priority are reported in the order of their increasing LCG ID.
An LCG priority value is derived from the highest priority logical channel mapped to it.
paddingBytes — Number of available padding bytes
integer greater than 1
Number of available padding bytes, specified as an integer greater than 1. You must specify these bytes to generate a padding BSR MAC CE.
The function might not use all of the padding bytes, depending on the value of input
paddingbytes value limits the number of LCG buffer size
values that the function can report in a long truncated BSR format.
bsr — BSR MAC CE
nonnegative integer | column vector of octets in decimal format
BSR MAC CE, returned as one of these options.
Nonnegative integer — For short and short truncated BSR formats.
Column vector of octets in decimal format — For long and long truncated BSR formats. The length of the vector is determined by the number of reported LCGs.
BSR is of one of these three types. For more details, see 3GPP TS 38.321 Section 5.4.5 .
Regular — When new data arrives in the uplink (UL) buffer and has higher priority than the data that is already waiting in the buffer of the user equipment (UE); or when none of the other LCGs have data to transmit.
Periodic — When sent with a predefined periodicity which is set by the network, at the expiry of the periodic BSR timer.
Padding — When the number of padding bits in a data message is larger than the size of BSR. In this case, padding bit space can be used to send the BSR.
Each of these three types of BSR can have one of these four formats.
Short — When the UE triggers a regular or periodic BSR, and only a single LCG has data to transmit, then the BSR is reported in the short format.
Short truncated — When the UE triggers a padding BSR and multiple LCGs have data to transmit, and the number of padding bits is equal to the length of short BSR and sub header, then the BSR is reported in the short truncated format.
Long — When the UE triggers a regular or periodic BSR and multiple LCGs have data to transmit, then the BSR is reported in the long format.
Long truncated — When the UE triggers a padding BSR and multiple LCGs have data to transmit, and the padding bit length of the MAC protocol data unit (PDU) is insufficient to transmit the long BSR format, then the UE uses the long truncated format to report the BSR.
The short truncated and long truncated formats are supported only with padding BSR type. The short and long formats support all three types of BSR CE (regular, periodic, or padding).
For more details, see 3GPP TS 38.321 Section 22.214.171.124 .
lcid — Logical channel ID
Logical channel ID, returned as one of these values, which corresponds to the generated BSR format.
59— Short truncated BSR format
60— Long truncated BSR format
61— Short BSR format
62— Long BSR format
 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2021b