Main Content

802.11n Packet Error Rate Simulation for 2x2 TGn Channel

这个例子展示了如何衡量包的错误rate of an IEEE® 802.11n™ HT link using an end-to-end simulation with a fading TGn channel model and additive white Gaussian noise.

Introduction

In this example an end-to-end simulation is used to determine the packet error rate for an 802.11n HT [1] link with a fading channel at a selection of SNR points. At each SNR point multiple packets are transmitted through a 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. Packet detection, timing synchronization, carrier frequency offset correction and phase tracking are performed by the receiver. The processing for each packet is summarized in the following diagram.

此示例还说明了如何parforloop can be used instead of a为了在模拟每个SNR点时循环以加快模拟。这parforfunction, as part of the Parallel Computing Toolbox™, executes processing for each SNR in parallel to reduce the total simulation time.

波形配置

在此示例中,模拟了802.11N HT传输。HT格式配置对象,wlanHTConfig,包含传输的格式特定配置。对象的属性包含配置。在此示例中,该对象是为20 MHz通道带宽,2个传输天线,2个时空流和无空间时间块编码的配置。

%创建2 by-2 HT传输的格式配置对象cfght = wlanhtconfig;cfght.channelbandwidth ='cbw20';%20 MHz频道带宽cfght.numtransmitantennas = 2;% 2 transmit antennascfgHT.NumSpaceTimeStreams = 2;%2时空流cfgHT.PSDULength = 1000;% PSDU length in bytescfgHT.MCS = 15;% 2 spatial streams, 64-QAM rate-5/6CFGHT.CHANNELCODING ='BCC';%BCC频道编码

频道配置

In this example a TGn N-LOS channel model is used with delay profile Model-B. For Model-B when the distance between transmitter and receiver is greater than or equal to five meters, the model is NLOS. This is described further inwlantgnchannel

%创建和配置频道tgnChannel = wlantgnChannel;tgnChannel.delayProfile ='Model-B';tgnChannel.NumTransmitAntennas = cfgHT.NumTransmitAntennas; tgnChannel.NumReceiveAntennas = 2; tgnChannel.TransmitReceiveDistance = 10;% Distance in meters for NLOStgnChannel.LargeScaleFadingEffect ='None';tgnChannel.NormalizeChannelOutputs = false;

Simulation Parameters

For each SNR point in the vectorsnra number of packets are generated, passed through a channel and demodulated to determine the packet error rate.

snr = 25:10:45;

在每个SNR点测试的数据包的数量由两个参数控制:

  1. maxNumPEs是在每个SNR点模拟的最大数据包误差数。当数据包错误达到此限制时,该SNR点处的仿真完成。

  2. maxNumPackets是在每个SNR点模拟的最大数据包数,如果未达到数据包误差限制,则限制模拟的长度。

此示例中选择的数字将导致非常短的模拟。对于有意义的结果,我们建议增加数字。

maxNumPEs = 10;%在SNR点的最大数据包错误数量maxNumPackets = 100;%在SNR点的最大数据包数量

为仿真设置其余变量。

% Get the baseband sampling ratefs = wlanSampleRate(cfgHT);%获取OFDM信息ofdmInfo = wlanHTOFDMInfo('ht-data',cfght);% Set the sampling rate of the channeltgnChannel.samplerate = fs;% Indices for accessing each field within the time-domain packetind = wlanfieldIndices(cfght);

Processing SNR Points

对于每个SNR点,测试了许多数据包,并计算了数据包错误率。

For each packet the following processing steps occur:

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

  2. 波形通过TGN通道模型的不同实现。

  3. 一种WGN is added to the received waveform to create the desired average SNR per active subcarrier after OFDM demodulation.

  4. 这packet is detected.

  5. 估计和校正粗糙的载波频率偏移。

  6. Fine timing synchronization is established. The L-STF, L-LTF and L-SIG samples are provided for fine timing to allow for packet detection at the start or end of the L-STF.

  7. Fine carrier frequency offset is estimated and corrected.

  8. 这HT-LTF is extracted from the synchronized received waveform. The HT-LTF is OFDM demodulated and channel estimation is performed.

  9. 从同步接收的波形中提取HT数据字段。使用提取的字段和通道估计恢复PSDU。

一种parforloop can be used to parallelize processing of the SNR points. To enable the use of parallel computing for increased speed comment out the 'for' statement and uncomment the 'parfor' statement below.

s = numel(snr);packetRorrate = zeros(s,1);%parfor i = 1:S % Use 'parfor' to speed up the simulation为了i = 1:s% Use 'for' to debug the simulation% Set random substream index per iteration to ensure that each%迭代使用一组可重复的随机数stream = randstream(“ combrecursive',,,,'种子',,,,0); stream.Substream = i; RandStream.setGlobalStream(stream);百分比为nulls中的噪声能量,因此SNR已定义%主动子载波packetSNR = snr(i)-10*log10(ofdmInfo.FFTLength/ofdmInfo.NumTones);% Loop to simulate multiple packetsnumpacketerrors = 0;n = 1;传输数据包的%索引whilenumPacketErrors < = maxNumPEs && n<=maxNumPackets%生成数据包波形txPSDU = randi([0 1],cfgHT.PSDULength*8,1);字节中的%psdulengthtx = wlanwaveformgenerator(txpsdu,cfght);% Add trailing zeros to allow for channel filter delaytx = [tx;零(15,cfght.numtransmitantennas)];%#ok% Pass the waveform through the TGn channel modelreset(tgnChannel);% Reset channel for different realizationrx = tgnChannel(TX);%添加噪音rx = awgn(rx,packetsnr);% Packet detect and determine coarse packet offsetcoarsePktOffset = wlanPacketDetect(rx,cfgHT.ChannelBandwidth);ifisempty(croughpktoffset)% If empty no L-STF detected; packet errornumPacketErrors = numPacketErrors+1; n = n+1;继续;%转到下一个循环迭代结尾%提取L-STF并执行粗频校正lstf = rx(coarsePktOffset+(ind.LSTF(1):ind.LSTF(2)),:); coarseFreqOff = wlanCoarseCFOEstimate(lstf,cfgHT.ChannelBandwidth); rx = frequencyOffset(rx,fs,-coarseFreqOff);% Extract the non-HT fields and determine fine packet offsetnonhtfields = rx(coarsePktOffset+(ind.LSTF(1):ind.LSIG(2)),:); finePktOffset = wlanSymbolTimingEstimate(nonhtfields,...cfght.channelbandwidth);% Determine final packet offsetpktOffset = coarsePktOffset+finePktOffset;%如果数据包检测到超出预期延迟的范围% channel modeling; packet errorifpktoffset> 15 numpacketerrors = numpacketerrors+1;n = n+1;继续;%转到下一个循环迭代结尾%提取L-LTF并执行良好的频率偏移校正lltf = rx(pktoffset+(ind.lltf(1):ind.lltf(2)),:);finefreqoff = wlanfinecfoestimate(lltf,cfght.channelbandwidth);rx = venyereoffset(rx,fs,-finefreqoff);% Extract HT-LTF samples from the waveform, demodulate and perform%通道估计htltf = rx(pktoffset+(ind.htltf(1):ind.htltf(2)),:);htltfdemod = wlanhtltfdemodulate(htltf,cfght);chanest = wlanhtltfchanneLestimate(htltfdemod,cfght);% Extract HT Data samples from the waveformhtdata = rx(pktoffset+(ind.htdata(1):ind.htdata(2)),:);% Estimate the noise power in HT data fieldnVarHT = htNoiseEstimate(htdata,chanEst,cfgHT);% Recover the transmitted PSDU in HT DatarxPSDU = wlanHTDataRecover(htdata,chanEst,nVarHT,cfgHT);%确定是否有错误,即数据包错误packetError = any(biterr(txPSDU,rxPSDU)); numPacketErrors = numPacketErrors+packetError; n = n+1;结尾% Calculate packet error rate (PER) at SNR pointpacketErrorRate(i) = numPacketErrors/(n-1); disp(['snr'num2str(snr(i))...“完成后完成”num2str(n-1)' packets,'...' PER: 'num2str(packetErrortate(i))]);结尾
SNR 25 completed after 11 packets, PER: 1 SNR 35 completed after 45 packets, PER: 0.24444 SNR 45 completed after 100 packets, PER: 0.01

Plot Packet Error Rate vs SNR Results

数字;半学(SNR,Packeterrortate,'-OB');网格on;Xlabel('SNR [dB]');ylabel('PER');title('802.11n 20MHz,MCS15,直接映射,2x2通道模型B-NLOS');

Further Exploration

在每个SNR点测试的数据包的数量由两个参数控制;maxNumPEsandmaxNumPackets。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 transmit encoding scheme to LDPC and compare the packet error rate. As an example, the figure below was created by running the example formaxNumPEs: 200 andmaxNumPackets:10000,具有四个不同的配置;带有BCC和LDPC编码的1x1和2x2。

附录

This example uses the following helper functions:

Selected Bibliography

  1. IEEE Std 802.11™-2020. 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.