Main Content


Calculate APEP length in octets

Since R2019b



APEPLength = wlanAPEPLength(cfgPHY,unit,value) returns APEPLength, the aggregate MAC protocol data unit (A-MPDU) pre-EOF padding (APEP) length, in octets from the given value and the physical layer configuration, cfgPHY. The units of value can be in terms of physical layer conformance procedure (PLCP) protocol data unit (PPDU) transmission time or number of data symbols, specified by the unit input argument.


collapse all

Create a wlanVHTConfig object, 'cfgPHY', and specify the transmission time, 'txTime', in microseconds.

cfgPHY = wlanVHTConfig;
txTime = 200;

Calculate the APEP length in octets.

apepLength = wlanAPEPLength(cfgPHY,'TxTime',txTime)
apepLength = 580

Set the number of bytes carried in the user payload for the configuration object, 'cfgPHY', to this APEP length.

cfgPHY.APEPLength = apepLength;

Create a wlanMACFrameConfig object, 'cfgMAC'. Use this object to generate a VHT-format QoS data frame.

cfgMAC = wlanMACFrameConfig('FrameType','QoS Data', ...

Calculate the MAC service data unit (MSDU) lengths required to generate a MAC frame of size 'APEPLength'.

msduLengths = wlanMSDULengths(apepLength,cfgMAC,cfgPHY);

Create random MSDUs using 'msduLengths'.

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

Generate MAC frame bits using the MSDUs, 'msduList'.

macFrameBits = wlanMACFrame(msduList,cfgMAC,cfgPHY,'OutputFormat','bits');

Generate a VHT waveform using 'cfgPHY' and the generated MAC frame bits, 'macFrameBits'.

waveform = wlanWaveformGenerator(macFrameBits,cfgPHY);

Create a wlanHESUConfig object, 'cfgPHY'.

cfgPHY = wlanHESUConfig;

Calculate the APEP length in octets, specifying 200 data symbols.

apepLength = wlanAPEPLength(cfgPHY,'NumDataSymbols',200)
apepLength = 2916

Set the number of bytes carried in the user payload for the configuration object, 'cfgPHY', to this APEP length. Calculate the PSDU length.

cfgPHY.APEPLength = apepLength;
psduLength = getPSDULength(cfgPHY)*8;

Create a random PSDU, 'psdu', using the calculated PSDU length.

psdu = randi([0 1],getPSDULength(cfgPHY)*8,1);

Generate an HE-SU waveform using 'cfgPHY' and 'psdu'.

waveform = wlanWaveformGenerator(psdu,cfgPHY);

Input Arguments

collapse all

PHY format configuration, specified a wlanHESUConfig ,or wlanVHTConfig object. This object defines a PHY format configuration and its applicable properties.

Units of argument value, specified as one of 'TxTime' or 'NumDataSymbols'. This value indicates the units of value from which the APEP length is calculated.

Data Types: char | string

Value from which APEP length is calculated, specified as a numeric scalar. Input argument unit specifies the unit of value. This table describes how the function interprets value based on unit.

unit Valuevalue Description
'TxTime'Scalar number specifying the time in microseconds
'NumDataSymbols'Scalar number specifying the number of data symbols

Data Types: double

Output Arguments

collapse all

Length of APEP, in octets, returned as a numeric scalar. This value returns the maximum APEP length that fits into the specified value of 'TxTime' or 'NumDataSymbols'.

Data Types: double

Extended Capabilities

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

Version History

Introduced in R2019b

See Also