Main Content

SNR Definition in End-to-End Simulations

This example shows how WLAN Toolbox™ defines signal-to-noise ratio (SNR) in end-to-end simulations.

SNR Definition

WLAN Toolbox™ end-to-end simulation examples introduce AWGN to the received signal in the time domain, after the fading channel, and before OFDM demodulation.

SNR_1.png

WLAN Toolbox defines the SNR as the expected SNR per subcarrier (SC) per receive antenna. In IEEE Std 802.11-2020 [1], the transmitter normalizes the waveform, so that the sum of the baseband power over all transmit antennas is 1 W.

The expected SNR per subcarrier (SC) is denoted by SNRSC.

SNRSC=SSCNSC

SSC and NSC are the average signal and noise power per subcarrier per receive antenna, respectively. NSC models the AWGN that is added to the signal.

For a signal x with discrete Fourier transform (DFT) X, Parseval's theorem states

n=1NFFT|xn|2=1NFFTk=1NFFT|Xk|2.

NFFT is the FFT length. Divide the equation by NFFT to get the average signal power

S=1NFFTn=1NFFT|xn|2=1NFFT2k=1NFFT|Xk|2=1NFFTXRMS2.

In WLAN, the signal of interest does not use all FFT bins (or subcarriers) because of guard bands. If the signal uses only KS subcarriers of the FFT, the signal power is

S=KSNFFT(1NFFTXRMS2)=KSNFFT2XRMS2. (1)

KS is the number of nonzero power subcarriers per OFDM symbol.

The signal power per subcarrier is

SSC=SKS.

The noise power per subcarrier is

NSC=NNFFT.

Because the noise is added in the time domain, the noise occupies all subcarriers, not just the allocated subcarriers. Therefore, the noise power, N, is divided by NFFT and not KS.

With these definitions, the SNRSC becomes

SNRSC=SSCNSC=KSKSNFFT2XRMS2NNFFT=XRMS2NFFTN. (2)

Rearranging equation 2, the noise power at the input of an OFDM demodulator is

N=XRMS2NFFTSNRSC. (3)

The awgn function adds noise in the time domain. If you use equation 1 and equation 3, the time-domain SNR becomes

SNR=SN=(KSXRMS2NNFFT2)XRMS2NFFTSNRSC=SNRSC(NNFFTKS).

SNRSC is in decibels. The SNR in decibels is

SNR=SNRSC-10log10(NFFTKS). (4)

SNR Verification

To verify your target SNR, you need to understand the process that WLAN Toolbox uses to simulate an end-to-end link for the given SNR. For this example, WLAN Toolbox simulates an end-to-end link and measures the SNR of the received packet as shown in the figure below. Multiple packets are transmitted through a Fourier channel. A Fourier matrix in a MIMO system assumes that all receive antennas are coupled with the transmit antennas. The matrix is orthogonal, so the spatial streams are completely separate, resulting in no noise enhancement [2].

The example uses the demodulated L-LTF field with and without noise to estimate the noise and signal power of each packet, and hence, the SNR. The example displays the simulated SNR, which is averaged over multiple packets.

SNR_2.png

For each packet, the following steps occur in the process:

  1. Generate a non-HT waveform.

  2. Set the required SNR according to Equation-4.

  3. Pass the waveform through a Fourier channel.

  4. Add AWGN to the received waveform to create the desired average SNR per subcarrier after OFDM demodulation.

  5. Extract and OFDM-demodulate the L-LTF field before and after adding noise.

  6. Estimate the signal power by using the demodulated L-LTF symbols before adding noise.

  7. Estimate the noise power by using the demodulated L-LTF symbols after adding noise.

  8. Calculate and display the average SNR.

Simulation Setup

For this example specify a target SNR of 10 dB.

SNRSC = 10;
rng("default") % Set default random number generator for repeatability

Set the number of transmit and receive antennas.

nTxAnts = 2;
nRxAnts = 2;

Create a configuration object for an non-HT transmission.

cfg = wlanNonHTConfig;
cfg.NumTransmitAntennas = nTxAnts; % N transmit antennas

SNR Setup

Scale the SNR to account for energy in unused subcarriers according to equation 4.

ofdmInfo = wlanNonHTOFDMInfo('NonHT-Data',cfg); % Get the OFDM info
SNRdB = SNRSC-10*log10(ofdmInfo.FFTLength/ofdmInfo.NumTones);

Simulate Link

Now simulate the transmission and verify that the measured SNR approximates your target SNR.

% Indices for accessing each field within the time-domain packet
ind = wlanFieldIndices(cfg);
N = 100;
nVar = zeros(1,N);
signalPower = zeros(1,N);

for i=1:N
    % Generate a packet waveform
    txPSDU = randi([0 1],cfg.PSDULength*8,1); % PSDULength in bytes
    tx = wlanWaveformGenerator(txPSDU,cfg);

    % Channel
    h = dftmtx(max(nTxAnts,nRxAnts)); % Fourier channel
    h = h(1:nTxAnts,1:nRxAnts);
    rx = tx*h;

    % Add noise
    rxNoise = awgn(rx,SNRdB);

    % Measure noise power by comparing L-LTF over 2 symbols. The noise
    % power is averaged across receive antennas.
    lltf = rxNoise(ind.LLTF(1):ind.LLTF(2),:);
    lltfDemod = wlanNonHTOFDMDemodulate(lltf,'L-LTF',cfg);
    nVar(i) = wlanLLTFNoiseEstimate(lltfDemod);

    % Measure signal power before noise addition
    lltf = rx(ind.LLTF(1):ind.LLTF(2),:);
    lltfDemod = wlanNonHTOFDMDemodulate(lltf,'L-LTF',cfg);
    signalPower(i) = mean(lltfDemod.*conj(lltfDemod),'all');
end

% Measure SNR
measuredSNR = signalPower./nVar;

% Verify that the measured SNR approximates the target SNR
disp(['Measured SNR ' num2str(10*log10(mean(measuredSNR))) ' dB'])
Measured SNR 10.0864 dB

References

  1. IEEE Std 802.11 - 2020. Telecommunications and Information Exchange between Systems Local and Metropolitan Area Networks Specific Requirements.

  2. Perahia, Eldad, and Robert Stacey. Next Generation Wireless LANS: 802.11n and 802.11ac. Cambridge University Press, 2013.

See Also

Functions