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.

802.11ad Packet Error Rate Simulation for Single Carrier PHY

This example shows how to measure the packet error rate of an IEEE® 802.11ad™ DMG single carrier (SC) PHY AWGN link using an end-to-end simulation.

Introduction

In this example an end-to-end simulation is used to determine the packet error rate for an 802.11ad SC [ 1 ] link with an AWGN channel at a selection of SNR points. At each SNR point multiple packets are transmitted through a noisy channel, demodulated and the PSDUs recovered. The PSDUs are compared to those transmitted to determine the number of packet errors and hence the packet error rate. The receiver assumes perfect synchronization when recovering data bits from the received signal. The processing for each packet is summarized in the following diagram.

This example also demonstrates how a parfor loop can be used instead of the for loop when simulating each SNR point to speed up a simulation. parfor, as part of the Parallel Computing Toolbox™, executes processing for each SNR in parallel to reduce the total simulation time.

Waveform Configuration

An 802.11ad DMG SC PHY transmission is simulated in this example. The DMG format configuration object contains the format specific configuration of the transmission. The object is created using the wlanDMGConfig function. The properties of the object contains the configuration of the transmitted packet. In this example the object is configured to generate a single carrier waveform of MCS 7.

% Create a format configuration object
cfgDMG = wlanDMGConfig;
mcs = 7;                  % MCS to test
cfgDMG.PSDULength = 4096; % PSDULength in bytes

Simulation Parameters

For each SNR point in the cell snrRanges a number of packets are generated, passed through a channel and demodulated to determine the packet error rate. The SNR points to test are selected from snrRanges based on the MCS simulated.

snrRanges = {-3:0.5:-0.5, ... % MCS 1
             -1:0.5:1.5, ...  % MCS 2
             0.5:0.5:3, ...   % MCS 3
             1.5:0.5:4, ...   % MCS 4
             2.5:0.5:5, ...   % MCS 5
             2.5:0.5:5, ...   % MCS 6
             3.5:0.5:6, ...   % MCS 7
             4.5:0.5:7, ...   % MCS 8
             5.5:0.5:8, ...   % MCS 9
             8:0.5:10.5, ...  % MCS 10
             9.5:0.5:12, ...  % MCS 11
             11:0.5:13.5};    % MCS 12

The number of packets tested at each SNR point is controlled by two parameters:

  1. maxNumErrors is the maximum number of packet errors simulated at each SNR point. When the number of packet errors reaches this limit, the simulation at this SNR point is complete.

  2. maxNumPackets is the maximum number of packets simulated at each SNR point and limits the length of the simulation if the packet error limit is not reached.

The numbers chosen in this example will lead to a very short simulation. For meaningful results we recommend increasing the numbers.

maxNumErrors = 10;   % The maximum number of packet errors at an SNR point
maxNumPackets = 100; % Maximum number of packets at an SNR point

Processing SNR Points

For each SNR point a number of packets are tested and the packet error rate calculated.

For each packet the following processing steps occur:

  1. A PSDU is created and encoded to create a single packet waveform.

  2. AWGN is added to the waveform. comm.AWGNChannel is configured to provide the correct SNR.

  3. The packet is received with perfect synchronization.

  4. The data field, excluding the first guard interval, is extracted and reshaped into blocks.

  5. The Guard Interval (GI) is discarded from all blocks.

  6. The PSDU is recovered from the extracted field.

A parfor loop can be used to parallelize processing of the SNR points, therefore for each SNR point an AWGN channel is created and configured with comm.AWGNChannel. To enable the use of parallel computing for increased speed comment out the for statement and uncomment the parfor statement below.

numSNR = numel(snrRanges{1}); % Number of SNR points
numMCS = numel(mcs);          % Number of MCS
packetErrorRate = zeros(numMCS,numSNR);
Ngi = 64; % GI length

for imcs = 1:numMCS
    cfgDMG.MCS = mcs(imcs);
    if ~strcmp(phyType(cfgDMG),'SC')
        error('This example only supports DMG SC PHY simulation');
    end
    dataFieldIndex = wlanFieldIndices(cfgDMG,'DMG-Data');
    snr = snrRanges{mcs(imcs)}; % SNR points to simulate from MCS

    %parfor isnr = 1:numSNR % Use 'parfor' to speed up the simulation
    for isnr = 1:numSNR     % Use 'for' to debug the simulation
        % Set random substream index per iteration to ensure that each
        % iteration uses a repeatable set of random numbers
        stream = RandStream('combRecursive','Seed',0);
        stream.Substream = isnr;
        RandStream.setGlobalStream(stream);

        % Create an instance of the AWGN channel per SNR point simulated
        awgnChannel = comm.AWGNChannel;
        awgnChannel.NoiseMethod = 'Signal to noise ratio (SNR)';
        awgnChannel.SNR = snr(isnr);

        % Noise power
        nVar = 10^(-snr(isnr)/10);

        % Set simulation parameters
        numPacketErrors = 0;
        numPkt = 1; % Index of the transmitted packet

        while numPacketErrors<=maxNumErrors && numPkt<=maxNumPackets
            % Generate a packet waveform
            psdu = randi([0 1],cfgDMG.PSDULength*8,1);
            tx = wlanWaveformGenerator(psdu,cfgDMG);

            % Add noise
            rx = awgnChannel(tx);

            % Extract data field, remove first GI and reshape into blocks
            % of 448-by-Nblks
            rxData = rx(dataFieldIndex(1):dataFieldIndex(2));
            rxBlks = reshapeData(rxData);

            % Discard GI from all blocks
            rxSym = rxBlks(1:end-Ngi,:);

            % Recover the transmitted PSDU from DMG Data field
            dataDecode = wlanDMGDataBitRecover(rxSym,nVar,cfgDMG);

            % Determine if any bits are in error, i.e. a packet error
            packetError = any(biterr(psdu,dataDecode));
            numPacketErrors = numPacketErrors + packetError;
            numPkt = numPkt+1;
        end

        % Calculate packet error rate (PER) at SNR point
        packetErrorRate(imcs,isnr) = numPacketErrors/(numPkt-1);
        disp(['     MCS:' num2str(cfgDMG.MCS) ', SNR ' ...
            num2str(snr(isnr)) ' completed after ' ...
            num2str(numPkt-1) ' packets, PER: ' ...
            num2str(packetErrorRate(imcs,isnr))]);
    end
end
     MCS:7, SNR 3.5 completed after 12 packets, PER: 0.91667
     MCS:7, SNR 4 completed after 53 packets, PER: 0.20755
     MCS:7, SNR 4.5 completed after 100 packets, PER: 0.01
     MCS:7, SNR 5 completed after 100 packets, PER: 0
     MCS:7, SNR 5.5 completed after 100 packets, PER: 0
     MCS:7, SNR 6 completed after 100 packets, PER: 0

Plot Packet Error Rate vs SNR Results

markers = 'ox*sd^v><ph+';
color = 'bmcrgbrkymcr';
figure;
for imcs = 1:numMCS
    semilogy(snrRanges{mcs(imcs)},packetErrorRate(imcs,:).',['-' markers(imcs) color(imcs)]);
    hold on;
end
grid on;
xlabel('SNR (dB)');
ylabel('PER');
dataStr = arrayfun(@(x)sprintf('MCS %d',x),mcs,'UniformOutput',false);
legend(dataStr);
title('PER for DMG SC-PHY, AWGN channel');

Further Exploration

The number of packets tested at each SNR point is controlled by two parameters; maxNumErrors and maxNumPackets. For meaningful results, it is recommended that these values should be larger than those presented in this example. Increasing the number of packets simulated allows the PER under different scenarios to be compared. Try changing the MCS value and compare the packet error rate. As an example, the figure below was created by running the example for a PSDULength of 8192 bytes, mcs: 1:12, maxNumErrors: 1000 and maxNumPackets: 10000.

Selected Bibliography

  1. IEEE Std 802.11ad™-2012 IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 3: Enhancements for Very High Throughput in the 60 GHz Band.

Local Functions

The following local function is used in this example:

  • reshapeData: Remove GI and reshape into data block, 448-by-Nblks

function y = reshapeData(rx)
    blkSize = 512; % Data block size
    Ngi = 64;      % Guard interval length
    % Number of data blocks
    Nblks = floor(size(rx,1)/blkSize);
    % Reshape to 448-by-Nblks
    y = reshape(rx(Ngi+1:end),blkSize,Nblks);
end
Was this topic helpful?