wlanMSDULengths

Calculate MSDU lengths

Description

example

msduLengths = wlanMSDULengths(frameLength,macConfig) returns msduLengths, a vector of medium access control (MAC) service data unit (MSDU) lengths for the specified MAC frame length and configuration. The function calculates the MSDU lengths by removing the overhead of MAC headers, frame check sequence (FCS), and subframe overheads (if applicable).

example

msduLengths = wlanMSDULengths(frameLength,macConfig,phyConfig) returns MSDU lengths for the specified physical layer (PHY) format configuration object. Use this syntax to return MSDU lengths for aggregated MAC protocol data units (A-MPDUs).

Examples

collapse all

Generate a QoS Data frame of length 2000 octets.

Create a WLAN MAC frame configuration object.

macConfig = wlanMACFrameConfig('FrameType','QoS Data');

Calculate the MSDU lengths required to generate a 2000-octet QoS Data frame and display the result.

frameLength = 2000;
msduLengths = wlanMSDULengths(frameLength,macConfig);
disp(msduLengths)
        1970

Create a random payload of the obtained MSDU length.

msdu = randi([0 255],1,msduLengths);

Generate the 2000-octet QoS data frame.

[frame,frameLength] = wlanMACFrame(msdu,macConfig);
disp(frameLength)
        2000

Generate a high-throughput-format (HT-format) A-MPDU frame of length 5000 octets.

Create a MAC frame configuration object.

 macConfig = wlanMACFrameConfig('FrameType','QoS Data','FrameFormat','HT-Mixed', ...
                                       'MPDUAggregation', true);

Create an HT-format configuration object.

phyConfig = wlanHTConfig('MCS',4);  

Calculate the MSDU lengths required to generate a 5000-octet A-MPDU frame, displaying the result.

msduLengths = wlanMSDULengths(5000,macConfig,phyConfig);
disp(msduLengths)
        2302        2302         294

Create MSDUs with random data using the obtained MSDU length vector.

 numMSDUs = numel(msduLengths);
 msduList = cell(1,numMSDUs);
  for i = 1:numMSDUs
      msduList{i} = randi([0 255],1,msduLengths(i));
  end

Generate the 5000-octet A-MPDU.

[frame, frameLength] = wlanMACFrame(msduList,macConfig,phyConfig);
disp(frameLength)
        5000

Input Arguments

collapse all

Total length of the MAC frame, specified as an integer in the interval [28, 6,500,631].

Note

The maximum value of this input depends on the MAC and PHY configuration in accordance with Table 9-19 of [2].

For MAC frames in very-high-throughput (VHT) or high-efficiency (HE) format, this input is the A-MPDU pre-end-of-frame padding (APEP) length. For all other formats, this input is the physical layer convergence procedure (PLCP) service data unit PSDU length.

Note

APEP length is always a multiple of four octets due to final subframe padding. If you do not specify this argument as a multiple of four octets for VHT- or HE-format frames, the function rounds the value to the nearest multiple of four.

Data Types: double

MAC frame configuration, specified as a wlanMACFrameConfig object. This object defines the type of MAC frame and its applicable properties.

PHY format configuration, specified as a configuration object of type wlanHESUConfig, wlanVHTConfig, or wlanHTConfig. The value you specify must be compatible with the frame format specified in the macConfig input.

  • If the FrameFormat property of macConfig is 'HE-SU' or 'HE-EXT-SU', then you must specify this argument as a wlanHESUConfig object.

  • If the FrameFormat property of macConfig is 'VHT', then you must specify this argument as a wlanVHTConfig object.

  • If the FrameFormat property of macConfig is 'HT-Mixed', then you must specify this argument as a wlanHTConfig object.

Specify this argument to:

  • Ensure that the frame does not exceed the transmission time limit.

  • Add end-of-frame (EOF) padding to VHT- or HE-format frames.

  • Maintain minimum start spacing between MPDUs in an A-MPDU.

Output Arguments

collapse all

MSDU lengths, returned as a vector of integers. The number of elements in this vector corresponds to the number of MSDUs. Each element is the length of its corresponding MSDU.

Data Types: double

References

[1] IEEE Std 802.11™– 2016. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications." IEEE Standard for Information technology – Telecommunications and information exchange between systems – Local and metropolitan area networks – Specific requirements.

[2] IEEE P802.11ax™/D3.1. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 6: Enhancements for High Efficiency WLAN.” IEEE Standard for Information technology – Telecommunications and information exchange between systems Local and metropolitan area networks – Specific requirements.

Extended Capabilities

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

Introduced in R2018b