Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Packet Recovery

Received packets are degraded due to radio and channel impairments. Recovery of packet contents requires symbol timing and frequency offset correction, channel estimation, and demodulation and recovery of the preamble and payload. WLAN System Toolbox™ functions perform these operations on VHT, HT-mixed, and non-HT PPDU fields.

VHT Packet Recovery

This example shows how to recover contents from a VHT format waveform.

Generate 80 MHz VHT Waveform

Create a VHT configuration object. Set APEPLength to 3200 and MCS to 5. Later these settings are compared to recovered signal information. Create a transmission bit stream for the data field. For a VHT waveform, the data field is PSDULength*8 bits.

vht = wlanVHTConfig('APEPLength',3200,'MCS',5);
txBits = randi([0 1],vht.PSDULength*8,1);

Create the PPDU fields individually. Create L-STF, L-LTF, L-SIG, VHT-SIG-A, VHT-STF, VHT-LTF, and VHT-SIG-B preamble fields and the VHT-Data field.

lstf = wlanLSTF(vht);
lltf = wlanLLTF(vht);
lsig = wlanLSIG(vht);
vhtSigA = wlanVHTSIGA(vht);
vhtstf = wlanVHTSTF(vht);
vhtltf = wlanVHTLTF(vht);
vhtSigB = wlanVHTSIGB(vht);
vhtData = wlanVHTData(txBits,vht);

Concatenate the individual fields to create a single PPDU waveform.

txPPDU = [lstf; lltf; lsig; vhtSigA; vhtstf; vhtltf; vhtSigB; vhtData];

Pass VHT Waveform Through TGac SISO Channel

Create TGac SISO and AWGN channel objects.

chBW = vht.ChannelBandwidth;
fs = 80e6;
tgacChan = wlanTGacChannel('SampleRate',fs,'ChannelBandwidth',chBW,...
    'LargeScaleFadingEffect','Pathloss and shadowing');
awgnChan = comm.AWGNChannel('NoiseMethod','Variance','VarianceSource','Input port');

Calculate the noise variance for a receiver with a 9 dB noise figure. The noise variance, noiseVar, is equal to kTBF, where k is Boltzmann's constant, T is the ambient temperature of 290 K, B is the bandwidth (sample rate), and F is the receiver noise figure. Pass the transmitted waveform through the noisy TGac channel.

noiseVar = 10^((-228.6 + 10*log10(290) + 10*log10(fs) + 9)/10)
rxPPDU = awgnChan(tgacChan(txPPDU),noiseVar);
noiseVar =

   2.5438e-12

Recover VHT Preamble Contents from PPDU

In general, the L-STF and L-LTF are processed to perform frequency offset estimation and correction, and symbol timing. For this example, the carrier frequency is not offset and the packet timing is 'on-time'. Therefore, for accurate demodulation, determination of carrier frequency offset and symbol timing is not required.

Find the start and stop indices for the PPDU fields.

fieldInd = wlanFieldIndices(vht)
fieldInd = 

  struct with fields:

       LSTF: [1 640]
       LLTF: [641 1280]
       LSIG: [1281 1600]
    VHTSIGA: [1601 2240]
     VHTSTF: [2241 2560]
     VHTLTF: [2561 2880]
    VHTSIGB: [2881 3200]
    VHTData: [3201 12160]

The stop index of VHT-SIG-B indicates the preamble length in samples.

numSamples = fieldInd.VHTSIGB(2);

Plot the preamble and the beginning of the packet data. Add markers to and plot to delineate the packet field boundaries.

time = ([0:double(numSamples)-1]/fs)*1e6;
peak = 1.2*max(abs(rxPPDU(1:numSamples)));
fieldMarkers = zeros(numSamples,1);
fieldMarkers(fieldInd.LSTF(2)-1,1) = peak;
fieldMarkers(fieldInd.LLTF(2)-1,1) = peak;
fieldMarkers(fieldInd.LSIG(2)-1,1) = peak;
fieldMarkers(fieldInd.VHTSIGA(2)-1,1) = peak;
fieldMarkers(fieldInd.VHTSTF(2)-1,1) = peak;
fieldMarkers(fieldInd.VHTLTF(2)-1,1) = peak;
fieldMarkers(fieldInd.VHTSIGB(2)-1,1) = peak;
plot(time,abs(rxPPDU(1:numSamples)),time,fieldMarkers)
xlabel ('Time (microseconds)')
ylabel('Magnitude')
title('VHT Format Preamble')

Demodulate the L-LTF and estimate the channel.

rxLLTF = rxPPDU(fieldInd.LLTF(1):fieldInd.LLTF(2),:);
demodLLTF = wlanLLTFDemodulate(rxLLTF,vht);
chEstLLTF = wlanLLTFChannelEstimate(demodLLTF,vht);

Extract the L-SIG field from the received PPDU, recover its information bits and check the CRC.

rxLSIG = rxPPDU(fieldInd.LSIG(1):fieldInd.LSIG(2),:);
[recLSIG,failCRC] = wlanLSIGRecover(rxLSIG,chEstLLTF,noiseVar,chBW);
failCRC
failCRC =

  logical

   0

failCRC = 0 indicates that CRC passed.

For the VHT format, the L-SIG rate bits are constant and set to [1 1 0 1]. Inspect the L-SIG rate information and confirm that this constant sequence is recovered. For the VHT format, the MCS setting in VHT-SIG-A2 determines the actual data rate.

rate = recLSIG(1:4)'
rate =

  1x4 int8 row vector

   1   1   0   1

Extract the VHT-SIG-A and confirm that the CRC check passed.

rxVHTSIGA = rxPPDU(fieldInd.VHTSIGA(1):fieldInd.VHTSIGA(2),:);
[recVHTSIGA,failCRC] = wlanVHTSIGARecover(rxVHTSIGA, ...
    chEstLLTF,noiseVar,chBW);
failCRC
failCRC =

  logical

   0

Extract the MCS setting from the VHT-SIG-A. For single user VHT, the MCS is located in VHT-SIG-A2 bits 4 through 7.

recMCSbits = (recVHTSIGA(29:32))';
recMCS = bi2de(double(recMCSbits))
isequal(recMCS,vht.MCS)
recMCS =

     5


ans =

  logical

   1

The recovered MCS setting matches the MCS value in the configuration object.

Extract and demodulate the VHT-LTF. Use the demodulated signal to perform channel estimation. Use the channel estimate to recover the VHT-SIG-B and VHT-Data fields.

rxVHTLTF = rxPPDU(fieldInd.VHTLTF(1):fieldInd.VHTLTF(2),:);
demodVHTLTF = wlanVHTLTFDemodulate(rxVHTLTF,vht);
chEstVHTLTF = wlanVHTLTFChannelEstimate(demodVHTLTF,vht);

Extract and recover the VHT-SIG-B.

rxVHTSIGB = rxPPDU(fieldInd.VHTSIGB(1):fieldInd.VHTSIGB(2),:);
recVHTSIGB = wlanVHTSIGBRecover(rxVHTSIGB,chEstVHTLTF,noiseVar,chBW);

As described in IEEE Std 802.11ac-2013, Table 22-1, the value in the VHT-SIG-B Length field multiplied by 4 is the recovered APEP length for packets carrying data. Verify that the APEP length, contained in the first 19 bits of the VHT-SIG-B, corresponds to the specified APEP length.

sigbAPEPbits = recVHTSIGB(1:19)';
sigbAPEPlength = bi2de(double(sigbAPEPbits))*4
isequal(sigbAPEPlength,vht.APEPLength)
sigbAPEPlength =

        3200


ans =

  logical

   1

The recovered value matches the configured APEP Length.

Recover VHT-Data Contents from PPDU

Construct a recovery configuration object.

cfgRec = wlanRecoveryConfig;

Recover receive equalized symbols using channel estimates from VHT-LTF.

recPSDU = wlanVHTDataRecover(rxPPDU(fieldInd.VHTData(1):fieldInd.VHTData(2),:),...
    chEstVHTLTF,noiseVar,vht,cfgRec);

Compare transmission and receive PSDU bits.

numErr = biterr(txBits,recPSDU)
numErr =

     0

The number of bit errors is zero.

HT Packet Recovery

This example shows how to recover content from a HT format waveform.

Generate 20 MHz HT Waveform

Create an HT configuration object and transmission PSDU. Set MCS to 2. Later these settings are compared to recovered signal information. For an HT waveform, the data field is PSDULength*8 bits.

ht = wlanHTConfig('MCS',2);
txPSDU = randi([0 1],ht.PSDULength*8,1);

Create the PPDU fields individually. Create L-STF, L-LTF, L-SIG, HT-SIG, HT-STF, and HT-LTF preamble fields and the HT-Data field.

lstf = wlanLSTF(ht);
lltf = wlanLLTF(ht);
lsig = wlanLSIG(ht);
htsig = wlanHTSIG(ht);
htstf = wlanHTSTF(ht);
htltf = wlanHTLTF(ht);
htData = wlanHTData(txPSDU,ht);

Concatenate the individual fields to create a single PPDU waveform.

txPPDU = [lstf; lltf; lsig; htsig; htstf; htltf; htData];

Pass HT Waveform Through TGn SISO Channel

Create TGn SISO channel and AWGN channel objects.

fs = 20e6;
tgnChan = wlanTGnChannel('SampleRate',fs,'LargeScaleFadingEffect','Pathloss and shadowing');
awgnChan = comm.AWGNChannel('NoiseMethod','Variance','VarianceSource','Input port');

Calculate the noise variance for a receiver with a 9 dB noise figure. The noise variance, noiseVar, is equal to kTBF, where k is Boltzmann's constant, T is the ambient temperature of 290 K, B is the bandwidth (sample rate), and F is the receiver noise figure. Pass the transmitted waveform through the noisy TGn channel.

noiseVar = 10^((-228.6 + 10*log10(290) + 10*log10(fs) + 9)/10);
rxPPDU = awgnChan(tgnChan(txPPDU),noiseVar);

Recover HT Preamble Contents from PPDU

In general, the L-STF and L-LTF are processed to perform frequency offset estimation and correction, and symbol timing. For this example, the carrier frequency is not offset and the packet timing is 'on-time'. Therefore, for accurate demodulation, determination of carrier frequency offset and symbol timing is not required.

Find the start and stop indices for the PPDU fields.

fieldInd = wlanFieldIndices(ht)
fieldInd = 

  struct with fields:

      LSTF: [1 160]
      LLTF: [161 320]
      LSIG: [321 400]
     HTSIG: [401 560]
     HTSTF: [561 640]
     HTLTF: [641 720]
    HTData: [721 9200]

The stop index of HT-LTF indicates the preamble length in samples.

numSamples = fieldInd.HTLTF(2);

Plot the preamble and the beginning of the packet data. Add markers to and plot to delineate the packet field boundaries.

time = ([0:double(numSamples)-1]/fs)*1e6;
peak = 1.2*max(abs(rxPPDU(1:numSamples)));
fieldMarkers = zeros(numSamples,1);
fieldMarkers(fieldInd.LSTF(2)-1,1) = peak;
fieldMarkers(fieldInd.LLTF(2)-1,1) = peak;
fieldMarkers(fieldInd.LSIG(2)-1,1) = peak;
fieldMarkers(fieldInd.HTSIG(2)-1,1) = peak;
fieldMarkers(fieldInd.HTSTF(2)-1,1) = peak;
fieldMarkers(fieldInd.HTLTF(2)-1,1) = peak;
plot(time,abs(rxPPDU(1:numSamples)),time,fieldMarkers)
xlabel ('Time (microseconds)')
ylabel('Magnitude')
title('HT Format Preamble')

Demodulate the L-LTF and estimate the channel.

rxLLTF = rxPPDU(fieldInd.LLTF(1):fieldInd.LLTF(2),:);
demodLLTF = wlanLLTFDemodulate(rxLLTF,ht);
chEstLLTF = wlanLLTFChannelEstimate(demodLLTF,ht);

Extract the L-SIG field from the received PPDU and recover its information bits.

rxLSIG = rxPPDU(fieldInd.LSIG(1):fieldInd.LSIG(2),:);
[recLSIG,failCRC] = wlanLSIGRecover(rxLSIG,chEstLLTF,noiseVar,ht.ChannelBandwidth);
failCRC
failCRC =

  logical

   0

failCRC = 0 indicates that CRC passed.

For the HT format, the L-SIG rate bits are constant and set to [1 1 0 1]. Inspect the L-SIG rate information and confirm that this constant sequence is recovered. For the HT format, the MCS setting in HT-SIG determines the actual data rate.

rate = recLSIG(1:4)'
rate =

  1x4 int8 row vector

   1   1   0   1

Extract the HT-SIG and confirm that the CRC check passed.

recHTSIG = rxPPDU(fieldInd.HTSIG(1):fieldInd.HTSIG(2),:);
[recHTSIG,failCRC] = wlanHTSIGRecover(recHTSIG,chEstLLTF,noiseVar,ht.ChannelBandwidth);
failCRC
failCRC =

  logical

   0

Extract the MCS setting from the HT-SIG. For HT, the MCS is located in HT-SIG bits 0 through 6.

recMCSbits = (recHTSIG(1:7))';
recMCS = bi2de(double(recMCSbits))
isequal(recMCS,ht.MCS)
recMCS =

     2


ans =

  logical

   1

The recovered MCS setting matches the MCS value in the configuration object.

Extract and demodulate the HT-LTF. Use the demodulated signal to perform channel estimation. Use the channel estimate to recover the HT-Data field.

rxHTLTF = rxPPDU(fieldInd.HTLTF(1):fieldInd.HTLTF(2),:);
demodHTLTF = wlanHTLTFDemodulate(rxHTLTF,ht);
chEstHTLTF = wlanHTLTFChannelEstimate(demodHTLTF,ht);

Recover HT-Data Contents from PPDU

Create a recovery configuration object.

cfgRec = wlanRecoveryConfig;

Recover the received equalized symbols using channel estimates from the HT-LTF.

[recPSDU] = wlanHTDataRecover(rxPPDU(fieldInd.HTData(1):fieldInd.HTData(2),:),...
    chEstHTLTF,noiseVar,ht,cfgRec);

Compare the transmitted and received PSDU bits, and confirm that the number of bit errors is zero.

numErr = biterr(txPSDU,recPSDU)
numErr =

     0

Non-HT Packet Recovery

This example steps through recovery of non-HT format waveform content.

Generate 20 MHz Non-HT Waveform

Create a non-HT configuration object and transmission PSDU. Set MCS to 4. Later these settings are compared to recovered signal information. For a non-HT waveform, the data field is PSDULength*8 bits.

nht = wlanNonHTConfig('MCS',4);
txPSDU = randi([0 1],nht.PSDULength*8,1);

Create the PPDU fields individually. Use the non-HT-Data contents to check the bit error rate after recovery. Create L-STF, L-LTF, and L-SIG preamble fields and non-HT data field.

lstf = wlanLSTF(nht);
lltf = wlanLLTF(nht);
lsig = wlanLSIG(nht);
nhtData = wlanNonHTData(txPSDU,nht);

Concatenate the individual fields to create a single PPDU waveform.

txPPDU = [lstf; lltf; lsig; nhtData];

Pass Non-HT Waveform Through 802.11g SISO Channel

Calculate the free-space path loss for a transmitter-to-receiver separation distance of 3 meters. Create an 802.11g channel with a 3 Hz maximum Doppler shift and an RMS path delay equal to two times the sample time. Create an AWGN channel.

dist = 3;
pathLoss = 10^(-log10(4*pi*dist*(2.4e9/3e8)));
fs = 20e6;
trms = 2/fs;
ch802 = stdchan(1/fs,3,'802.11g',trms);
awgnChan = comm.AWGNChannel('NoiseMethod','Variance','VarianceSource','Input port');

Calculate the noise variance for a receiver with a 9 dB noise figure. The noise variance, noiseVar, is equal to kTBF, where k is Boltzmann's constant, T is the ambient temperature of 290 K, B is the bandwidth (sample rate), and F is the receiver noise figure. Pass the transmitted waveform through the noisy, lossy 802.11g channel.

noiseVar = 10^((-228.6 + 10*log10(290) + 10*log10(fs) + 9)/10);
rxPPDU = awgnChan(filter(ch802,txPPDU),noiseVar) * pathLoss;

Recover Non-HT Preamble Contents from PPDU

In general, the L-STF and L-LTF are processed to perform frequency offset estimation and correction, and symbol timing. For this example, the carrier frequency is not offset and the packet timing is 'on-time'. Therefore, for accurate demodulation, determination of carrier frequency offset and symbol timing is not required.

Find the start and stop indices for the PPDU fields.

fieldInd = wlanFieldIndices(nht)
fieldInd = 

  struct with fields:

         LSTF: [1 160]
         LLTF: [161 320]
         LSIG: [321 400]
    NonHTData: [401 7120]

The stop index of the L-SIG field indicates the preamble length in samples.

numSamples = fieldInd.LSIG(2);

Plot the preamble and the beginning of the packet data. Add markers to and plot to delineate the packet field boundaries.

time = ([0:double(numSamples)-1]/fs)*1e6;
peak = 1.2*max(abs(rxPPDU(1:numSamples)));
fieldMarkers = zeros(numSamples,1);
fieldMarkers(fieldInd.LSTF(2)-1,1)  = peak;
fieldMarkers(fieldInd.LLTF(2)-1,1) = peak;
fieldMarkers(fieldInd.LSIG(2)-1,1) = peak;
plot(time,abs(rxPPDU(1:numSamples)),time,fieldMarkers)
xlabel ('Time (microseconds)')
ylabel('Magnitude')
title('Non-HT Format Preamble')

Demodulate the L-LTF and estimate the channel.

rxLLTF = rxPPDU(fieldInd.LLTF(1):fieldInd.LLTF(2),:);
demodLLTF = wlanLLTFDemodulate(rxLLTF,nht);
chEstLLTF = wlanLLTFChannelEstimate(demodLLTF,nht);

Extract the L-SIG field from the received PPDU and recover its information bits.

rxLSIG = rxPPDU(fieldInd.LSIG(1):fieldInd.LSIG(2),:);
recLSIG = wlanLSIGRecover(rxLSIG,chEstLLTF,noiseVar,'CBW20');

The first four bits of the L-SIG field, bits 0 through 3, contain the rate information. Confirm that the sequence [1 0 0 1] is recovered. This sequence corresponds to the 24 MHz data rate for the non-HT MCS setting of 4.

rate = recLSIG(1:4)'
rate =

  1x4 int8 row vector

   1   0   0   1

Extract and demodulate the L-LTF. Use the demodulated signal to perform channel estimation. Use the channel estimate to recover the non-HT-Data field.

rxLLTF = rxPPDU(fieldInd.LLTF(1):fieldInd.LLTF(2),:);
demodLLTF = wlanLLTFDemodulate(rxLLTF,nht);
chEstLLTF = wlanLLTFChannelEstimate(demodLLTF,nht);

Recover Non-HT-Data Contents from PPDU

Create a recovery configuration object, with its equalization method set to zero forcing.

cfgRec = wlanRecoveryConfig('EqualizationMethod','ZF');

Recover equalized symbols using channel estimates from HT-LTF.

rxPSDU = rxPPDU(fieldInd.NonHTData(1):fieldInd.NonHTData(2),:);
[recPSDU,~,eqSym] = wlanNonHTDataRecover(rxPSDU,chEstLLTF,noiseVar,nht,cfgRec);

Compare the transmitted and received PSDU bits, and confirm that the number of bit errors is zero.

numErr = biterr(txPSDU,recPSDU)
numErr =

     0

See Also

| | |

Related Topics

Was this topic helpful?