Main Content

wlanFormatDetect

Detect packet format

Description

example

format = wlanFormatDetect(rxSig,chEst,noiseVarEst,cbw) detects and returns format, the packet format of a received time-domain signal. The function detects the packet format by performing a series of checks on rxSig, a portion of the signal whose contents uniquely determine the packet format. For more information, see Format Detection Processing. To perform these checks, the function also requires estimated channel characteristics chEst, estimated noise variance noiseVarEst, and channel bandwidth cbw.

example

format = wlanFormatDetect(rxSig,chEst,noiseVarEst,cbw,Name,Value) specifies algorithm options for information bit recovery by using one or more name-value arguments.

Examples

collapse all

Detect the format of a WLAN HE SU waveform.

Generate an HE SU waveform and obtain a received signal by adding noise.

cbw = 'CBW20'; % Specify channel bandwidth of 20 MHz
cfgHESU = wlanHESUConfig('ChannelBandwidth',cbw); % Create configuration object for HE SU format
bits = [1;0;0;1];
tx = wlanWaveformGenerator(bits,cfgHESU); % Generate HE SU waveform
snr = 10; % Specify signal-to-noise ratio (SNR)
rx = awgn(tx,snr); % Create receive waveform

Specify the sample rate and durations of the relevant PPDU fields.

sr = 20e6; % Sample rate in samples per second
tLSTF = 8e-6; % Duration of legacy short training field (L-STF)
tLLTF = tLSTF; % Duration of legacy long training field (L-LTF)

Determine the field indices and estimate the channel using the L-LTF.

ind = tLSTF*sr+(1:tLLTF*sr);
y = wlanLLTFDemodulate(rx(ind,:),cbw);
chEst = wlanLLTFChannelEstimate(y,cbw);

Specify the channel noise variance estimate and detect the format of the waveform.

noiseVarEst = 10^(-snr/20);
rxSig = rx((tLSTF+tLLTF)*sr+(1:sr*(16e-6)),:); % 16 microseconds corresponding to four OFDM symbols after HE L-LTF
format = wlanFormatDetect(rxSig,chEst,noiseVarEst,cbw);
disp(format)
HE-SU

Perform format detection on a WLAN high-throughput mixed format (HT-MF) waveform.

Generate an HT-MF waveform and add noise to the transmitted waveform.

cbw = 'CBW20';
cfgTx = wlanHTConfig('ChannelBandwidth',cbw);
tx = wlanWaveformGenerator([1;0;0;1],cfgTx);
snr = 10;
rxSig = awgn(tx,snr);

Demodulate Received Signal and Perform Channel Estimation

  1. Determine indices for the L-LTF of the 20 MHz bandwidth waveform. For this calculation, define local variables for the sample rate and duration of the L-STF and L-LTF fields in seconds.

  2. Demodulate the L-LTF.

  3. Perform channel estimation using the L-LTF.

  4. Estimate the noise variance.

sr = 20e6;
Tlstf = 8e-6;
Tlltf = 8e-6;

idxlltf = Tlstf*sr+(1:Tlltf*sr);

lltfDemod = wlanLLTFDemodulate(rxSig(idxlltf,:),cbw);
chEst = wlanLLTFChannelEstimate(lltfDemod,cbw);
noiseVarEst = 10^(-snr/20);

Detect Signal Format

  1. Determine indices for the three symbols following the L-LTF. For a 20 MHz bandwidth waveform, the duration for three symbols is 12 µs.

  2. Perform format detection.

idxDetectionSymbols = (Tlstf+Tlltf)*sr+(1:12e-6*sr);

in = rxSig(idxDetectionSymbols,:);
format = wlanFormatDetect(in,chEst,noiseVarEst,cbw)
format = 
'HT-MF'

Detect the format of a WLAN very high throughput (VHT) waveform, adjusting the default recovery algorithm settings.

Generate a VHT waveform and add white Gaussian noise to the transmitted waveform.

cbw = 'CBW80';
cfgTx = wlanVHTConfig('ChannelBandwidth',cbw);
tx = wlanWaveformGenerator([1;0;0;1],cfgTx);
snr = 10;
rxSig = awgn(tx,snr);

Demodulate Received Signal and Estimate Channel

  1. Determine indices for the L-LTF of the 80 MHz bandwidth waveform. For this calculation, define local variables for the sample rate and duration of the L-STF and L-LTF in seconds.

  2. Demodulate the L-LTF.

  3. Perform channel estimation using the L-LTF.

  4. Estimate the noise variance.

sr = 80e6;
Tlstf = 8e-6;
Tlltf = 8e-6;
idxlltf = Tlstf*sr+(1:Tlltf*sr);
lltfDemod = wlanLLTFDemodulate(rxSig(idxlltf,:),cbw);
chEst = wlanLLTFChannelEstimate(lltfDemod,cbw);
noiseVarEst = 10^(-snr/20);

Detect Format

  • Determine indices for the three symbols following the L-LTF. For an 80 MHz bandwidth waveform, the duration for three symbols is 12 µs.

  • Detect the format using modified recovery settings.

TdetectionSymbols = 12e-6;
idxDetectionSymbols = (Tlstf+Tlltf)*sr+(1:TdetectionSymbols*sr);
in = rxSig(idxDetectionSymbols,:);
format = wlanFormatDetect(in,chEst,noiseVarEst,cbw, ...
    'OFDMSymbolOffset',0.5,'PilotPhaseTracking','None')
format = 
'VHT'

Input Arguments

collapse all

Post-long-training-field (post-LTF) portion of the received time-domain signal, specified as a complex-valued NS-by-NR matrix, where:

  • NS is the number of time-domain samples.

  • NR is the number of receive antennas.

For the function to successfully detect the format of an EHT or HE packet, this input must contain all time-domain samples in the four OFDM symbols immediately following the L-LTF: sym1, sym2, sym3, and sym4. For the function to successfully detect other packet formats, this signal must contain all time-domain samples in the three OFDM symbols immediately following the relevant LTF: sym1, sym2, sym3. The first entry in each column of this input must be the first time-domain sample of the symbol received by the corresponding antenna. For more information about how the wlanFormatDetect function uses this input for format detection, see Format Detection Processing.

Note

If the number of received OFDM symbols is greater than four, the function ignores additional samples after sym4.

Data Types: single | double
Complex Number Support: Yes

Channel estimate for data and pilot subcarriers based on the L-LTF, specified as a numeric matrix or array of size NST-by-1-by-NR, where:

  • NST is the number of occupied subcarriers.

  • NR is the number of receive antennas.

The second dimension corresponds to the single transmitted stream in the L-LTF. If the transmission uses multiple antennas, the single transmitted stream includes the combined cyclic shifts.

Data Types: single | double
Complex Number Support: Yes

Noise variance estimate, specified as a nonnegative scalar.

Data Types: double

Channel bandwidth, in MHz, specified as one of these values.

  • 'CBW5' — Channel bandwidth of 5 MHz

  • 'CBW10' — Channel bandwidth of 10 MHz

  • 'CBW20' — Channel bandwidth of 20 MHz

  • 'CBW40' — Channel bandwidth of 40 MHz

  • 'CBW80' — Channel bandwidth of 80 MHz

  • 'CBW160' — Channel bandwidth of 160 MHz

  • 'CBW320' — Channel bandwidth of 320 MHz

Data Types: char

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'PilotPhaseTracking','None' disables pilot phase tracking.

OFDM symbol sampling offset represented as a fraction of the cyclic prefix (CP) length, specified as the name-value pair consisting of 'OFDMSymbolOffset' and a scalar in the interval [0, 1]. The value you specify indicates the start location for OFDM demodulation relative to the beginning of the CP. The value 0 represents the start of the CP, and the value 1 represents the end of the CP.

Different values of the OFDMSymbolOffset argument

Data Types: double

Equalization method, specified as one of these values.

  • 'MMSE' — The receiver uses a minimum mean-square error equalizer.

  • 'ZF' — The receiver uses a zero-forcing equalizer.

When the received signal has multiple receive antennas, the function exploits receiver diversity during equalization. When the number of transmitted space-time streams is one and you specify this argument as 'ZF', the function performs maximal-ratio combining.

Data Types: char | string

Pilot phase tracking, specified as the name-value pair consisting of 'PilotPhaseTracking' and one of these values.

  • 'PreEQ' — Enable pilot phase tracking, which the function performs before any equalization operation.

  • 'None' — Disable pilot phase tracking.

Data Types: char | string

Warning suppression, specified as false or true. Set to true to suppress warning messages.

Data Types: logical

Output Arguments

collapse all

Packet format, returned as one of these values:

  • 'Non-HT' — Non-high-throughput (non-HT) format

  • 'HT-MF' — High-throughput mixed format (HT MF)

  • 'HT-GF' — High-throughput greenfield format (HT GF)

  • 'VHT' — Very-high-throughput (VHT) format

  • 'HE-SU' — High-efficiency single-user (HE SU) format

  • 'HE-EXT-SU' — HE extended-range single-user (HE ER SU) format

  • 'HE-MU' — HE multi-user (HE MU) format

  • 'HE-TB' — HE trigger-based (HE TB) format

  • 'EHT-MU' — EHT multi-user (EHT MU) format (since R2023a)

  • 'EHT-TB' — EHT trigger-based (EHT TB) format (since R2023a)

  • 'EHTValidate' — Validation bit detected. See Section 36.3.12.7.2 of [1]. (since R2023a)

Algorithms

collapse all

Format Detection Processing

The wlanFormatDetect function determines packet format by checking relevant attributes of the rxSig input.

  • For the function to successfully detect the format of an EHT or HE packet, rxSig must contain all time-domain samples in the four OFDM symbols following the L-LTF.

  • For the function to successfully detect the format of a non-HT, HT-MF, or VHT packet, rxSig must contain all time-domain samples in the three OFDM symbols following the L-LTF.

  • For the function to successfully detect the format of an HT-GF packet, rxSig must contain all time-domain samples in the three OFDM symbols following the HT-LTF1.

The first entry in each column of rxSig must be the first time-domain sample of the first OFDM symbol following the relevant LTF received by the corresponding antenna. The function does not use additional samples after the last sample of the fourth OFDM symbol.

Before demodulating any packet symbols, the function checks the number of OFDM symbols in the rxSig input. If the function detects four or more symbols, it determines the packet format by following the steps outlined in HE Format Detection. If the function detects three symbols, it determines the packet format by following the steps outlined in Legacy Format Detection.

HE Format Detection
  1. Check for the repeated L-SIG (RL-SIG) field. If RL-SIG field is detected, begin detection for HE formats.

    1. Check the validity of the L-SIG field by computing the parity and data rate. If the L-SIG field is valid, follow these steps.

      1. Check the length of the L-SIG field modulo 3.

        1. If the length modulo 3 is 1, the packet format is either HE ER SU or HE MU. Demodulate the HE-SIG-A field and check the modulation scheme of sym4.

          1. If the modulation method of sym4 is QBPSK, the format is HE ER SU.

          2. If the modulation method of sym4 is BPSK, the format is HE MU.

        2. If the length modulo 3 is 2, the packet format is either HE SU or HE TB. Recover the information bits in the HE-SIG-A field by using the wlanHESIGABitRecover function.

          1. If the first bit is 0, the format is HE TB.

          2. If the first bit is 1, the format is HE SU.

          3. If the HE-SIG-A field fails the cyclic redundancy check (CRC), detect the format by following the steps in Legacy Format Detection.

        3. If the length modulo 3 is 0, detect the format by following the steps in EHT Format Detection.

    2. If the L-SIG field is invalid, detect the format by following the steps in Legacy Format Detection.

  2. If RL-SIG field is not detected, detect the format by following the steps outlined in Legacy Format Detection.

Symbols used for HE format detection

Process for HE format detection

EHT Format Detection
  1. Check for the repeated L-SIG (RL-SIG) field. If RL-SIG field is detected, begin detection for EHT formats. If RL-SIG field is not detected, detect the format by following the steps outlined in Legacy Format Detection.

    1. Check the validity of the L-SIG field by computing the parity and data rate. If the L-SIG field is valid, follow these steps.

      1. Check the length of the L-SIG field modulo 3.

        1. If the length is not 0 mod 3, follow the corresponding steps in HE Format Detection.

        2. If the length is 0 mod 3, go to step 2.

    2. If the L-SIG field is invalid, detect the format by following the steps in Legacy Format Detection.

  2. Perform a cyclic redundancy check on the U-SIG field.

    1. If the check fails, detect the format by following the steps in Legacy Format Detection. If the check passes, check the modulation scheme of the first symbol of the U-SIG field.

    2. If the modulation scheme of the first symbol of the U-SIG field is QBPSK, detect the format by following the steps in Legacy Format Detection. If the modulation scheme is not QBSPK, check the modulation scheme of the second symbol of the U-SIG field.

  3. If the modulation scheme of the second symbol of the U-SIG field is BPSK, check the uplink indication bit.

    1. If the uplink indication bit is 0, check the 'PPDU Type and Compression Mode' as defined in Table 36-29 of [1].

      1. If the PPDU type subfield is 0, 1, or 2, the format is EHT MU.

      2. Otherwise, the function returns 'EHTValidate'

    2. If the uplink indication bit is 1, check the 'PPDU Type and Compression Mode' as defined in Table 36-29 of [1].

      1. If the PPDU type subfield is 0, the format is EHT TB.

      2. If the PPDU type subfield is 1, the format is EHT MU.

      3. Otherwise, the function returns 'EHTValidate'.

Process for EHT format detection

Legacy Format Detection
  1. If the modulation scheme of sym1 is QBPSK, the packet format is HT-GF.

  2. If the modulation scheme of sym1 is BPSK and the L-SIG parity check fails, the function returns a warning. The format detection processing continues because the L-SIG parity check does not conclusively indicate an error in the modulation and coding scheme (MCS) determination.

    1. If the MCS is not 0, the packet format is non-HT.

    2. If the MCS is 0, check the modulation scheme of sym2.

      1. If the modulation scheme of sym2 is QBPSK, the format is HT MF.

      2. If the modulation scheme of sym2 is BPSK, detect the modulation scheme of sym3.

        1. If the modulation scheme of sym3 is QBPSK, the format is VHT.

        2. If the modulation scheme of sym3 is BPSK, the format is non-HT.

Symbols used for legacy format detection

Process for legacy format detection

Extended Capabilities

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

Version History

Introduced in R2016b

expand all