Main Content

nrMACBSRDecode

Decode BSR MAC CE

    Description

    example

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr) decodes the buffer status report (BSR) medium access control (MAC) control element (CE). The input, lcid, specifies the logical channel ID (LCID) corresponding to the specified input bsr. The function returns the decoded logical channel group (LCG) IDs, lcgID, reported in the BSR, as well as the buffer size range, lcgBufferRange, for the values specified in the BSR.

    Examples

    collapse all

    Specify the LCG buffer size, the LCG priority, and the number of padding bytes available for generating a padding BSR.

    lcgBufferSize = [234 63 943 1002 4325 994 666 48]; % In bytes
    lcgPriority = [4 3 2 6 7 2 8 1];
    paddingBytes = 2;                                  % In bytes

    Generate a padding BSR MAC CE for multiple LCGs by using the nrMACBSR function. This function generates a short truncated BSR with the buffer information from LCG index 7.

    [lcid,bsr] = nrMACBSR(lcgBufferSize,lcgPriority,paddingBytes)
    lcid = 59
    
    bsr = 230
    

    Decode the LCG ID and the buffer size range of the BSR MAC CE by using the generated LCID and BSR values. The LCG ID output specifies the buffer information reported in LCG index 7.

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr)
    lcgID = 7
    
    lcgBufferRange = 1×2
    
        39    53
    
    

    Specify the LCID and BSR MAC CE of a short BSR.

    lcid = 61;
    bsr = 67;

    Decode the LCG ID and the buffer size range.

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr)
    lcgID = 2
    
    lcgBufferRange = 1×2
    
        15    20
    
    

    Specify the LCID and BSR MAC CE of a long BSR.

    lcid = 62;
    bsr = [36; 75; 253];

    Decode the LCG ID and the buffer size range of a long BSR. The function returns the indices of the LCG whose buffer status was reported and contains data for transmission. The LCG buffer range specifies the corresponding buffer size range of the LCG IDs. In a long BSR, the function maps the LCG ID and LCG buffer ranges on a one-to-one basis.

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr)
    lcgID = 2×1
    
         2
         5
    
    
    lcgBufferRange = 2×2
    
            1052        1119
        76380420    81338368
    
    

    Now, specify the LCID and BSR MAC CE of a long truncated BSR.

    lcid = 60;
    bsr = [145; 51; 26];

    Decode the LCG ID and the buffer size range of a long truncated BSR. The function returns the indices of the LCG containing data for transmission. The LCG buffer range specifies the buffer size range of the LCG IDs whose buffer status was reported. In a long truncated BSR, the function does not map the LCG ID and LCG buffer ranges on a one-to-one basis.

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr)
    lcgID = 3×1
    
         0
         4
         7
    
    
    lcgBufferRange = 2×2
    
       234   248
        50    52
    
    

    Now, for a long truncated BSR, specify the BSR containing one octet. This octet specifies the LCG bitmap.

    lcid = 60;
    bsr = 17;

    Decode the LCG ID and the buffer size range.

    [lcgID,lcgBufferRange] = nrMACBSRDecode(lcid,bsr)
    lcgID = 2×1
    
         0
         4
    
    
    lcgBufferRange =
    
      0×2 empty double matrix
    

    Input Arguments

    collapse all

    Logical channel ID of the BSR, specified as an integer in the range [59, 62]. The integers in this range correspond to BSR MAC formats.

    lcid ValueBSR Format
    59

    Short truncated BSR

    60

    Long truncated BSR

    61

    Short BSR

    62

    Long BSR

    Data Types: double

    BSR MAC CE, specified as one of these values.

    bsr ValueBSR Format Supported
    Nonnegative integer in the range [0, 255]

    Use this value for short and short truncated BSR formats.

    Column vector of octets in the range [0, 255]

    Use this value for long and long truncated BSR formats.

    • For long BSR format, set the length of the column vector equal to the number of reported LCGs + 1. The maximum length of the column vector is 9.

    • For long truncated BSR format, set the length of the column vector to less than or equal to the number of reported LCGs. The maximum length of the column vector is 8.

    The function uses this value to calculate the number of reported LCGs.

    Data Types: double

    Output Arguments

    collapse all

    Logical channel group ID, returned as an integer or a column vector with length equal to the number of LCGs reported.

    • For a short BSR, short truncated BSR, and long BSR, this output returns the index of the logical channels whose buffer status was reported by bsr.

    • For a long truncated BSR, this output returns the index of the logical channels that contains data for transmission.

    Data Types: double

    Buffer size range of the LCGs, returned as a row vector or a matrix. The first and second column of this output specify the lower and upper range of the buffer size, respectively.

    BSR FormatlcgBufferRange Value Description
    Short or short truncated BSR
    • Return a row vector of length 2.

    • The function maps this output to the corresponding lcgID output.

    • For a buffer size index of 31, the upper range of this output is set to the largest value of the 32-bit signed integer type for the purpose of calculation.

    Long BSR
    • Return a matrix of size N-by-2, where N denotes the number of LCGs containing data for transmission.

    • The function maps each row of this output to the corresponding row in the lcgID output.

    • For a buffer size index of 254, the upper range is set to the largest value of the 32-bit signed integer type for the purpose of calculation.

    Long truncated BSR

    • Return a matrix of size M-by-2, where M (M<N) denotes the number of buffer size values reported in BSR.

    • The function does not map this output and the lcgID output on a one-to-one basis. During long truncated BSR generation, the LCG buffer information of one or more lcgID is lost in the truncation.

    • For a buffer size index of 254, the upper range is set to the largest value of the 32-bit signed integer type for the purpose of calculation.

    For more information about the buffer size range of the LCGs, see Section 6.1.3.1 of 3GPP TS 38.321 [1].

    Data Types: double

    References

    [1] 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2022a

    See Also

    Functions

    Objects