Main Content

Include Path Loss in NR Link-Level Simulations

This example shows how to include path loss, transmit power, and receive noise in 5G NR link-level simulations to study the impact of these parameters in the performance of a 5G link.

Introduction

Link-level simulations measure block error rate and throughput across a range of average signal-to-noise ratio (SNR) values at the receive side. This example shows how to calculate the SNR from parameters such as the path loss, transmit power, and receiver input noise and noise figure. You can use this SNR in the NR PDSCH Throughput and NR PUSCH Throughput examples to study the effect of those parameters in a 5G link. In this example, you can:

  1. Configure a transmitter, receiver, carrier, and propagation channel.

  2. Calculate the path loss and noise power.

  3. Calculate the SNR at the receiver.

  4. Verify the SNR calculation.

Configure Transmitter, Receiver, and Carrier

This section configures a carrier, transmitter, and receiver with these characteristics:

  • The transmitter or base station (BS) model includes the average power delivered to all antennas and the antenna height. You can specify the average transmit power of a fully allocated resource grid, but this power does not include antenna element gains. Therefore, the actual average power transmitted scales with the resource grid allocation and antenna element gains, but this power does not scale with the number of transmit antennas.

  • The receiver or user equipment (UE) model includes its noise figure and the antenna temperature and height. The noise figure models the receiver internal noise, and the antenna temperature models the input noise. This receiver specifies the noise per antenna element.

  • You can specify the distance between the BS and UE as a vector to calculate the SNR values at the specified distances.

% Configure the carrier.
simParameters.Carrier = nrCarrierConfig;
simParameters.Carrier.NSizeGrid = 51;            % Bandwidth in number of resource blocks (51 RBs at 30 kHz SCS for 20 MHz BW)
simParameters.Carrier.SubcarrierSpacing = 30;    % 15, 30, 60, 120, 240 (kHz)
simParameters.Carrier.CyclicPrefix = 'Normal';   % 'Normal' or 'Extended' (Extended CP is relevant for 60 kHz SCS only)

% Configure the carrier frequency, transmitter (BS), receiver (UE), and
% distance between the BS and UE. Specify this distance as a vector for
% multiple SNR points.
simParameters.CarrierFrequency = 3.5e9;   % Carrier frequency (Hz)
simParameters.TxHeight = 25;              % Height of the BS antenna (m)
simParameters.TxPower = 40;               % Power delivered to all antennas of the BS on a fully allocated grid (dBm)
simParameters.RxHeight = 1.5;             % Height of UE antenna (m)
simParameters.RxNoiseFigure = 6;          % Noise figure of the UE (dB)
simParameters.RxAntTemperature = 290;     % Antenna temperature of the UE (K)
simParameters.TxRxDistance = [5e2 9e2];   % Distance between the BS and UE (m)

Configure Propagation Channel

The propagation channel model includes path loss and small-scale fading. The path loss depends on the distance between the BS and UE, the carrier frequency, and other parameters that are specific to each scenario. The fading channels can be clustered delay line (CDL) or tapped delay line (TDL) channels. In this example, the fading channel configuration determines the line-of-sight (LOS) existence between the transmitter (BS) and receiver (UE), which is required for path loss calculation. Delay profiles A, B, and C configure non-LOS channels and delay profiles D and E configure LOS channels.

Configure Path Loss

Configure the scenario and other path loss parameters of the 5G path loss model as defined in TR 38.901 Section 7.4. Alternatively, specify the free-space path loss model. The path loss model determines the average attenuation of the transmitted signal.

simParameters.PathLossModel = '5G-NR';        % '5G-NR' or 'fspl'
simParameters.PathLoss = nrPathLossConfig;
simParameters.PathLoss.Scenario = 'UMa';      % Urban macrocell
simParameters.PathLoss.EnvironmentHeight = 1; % Average height of the environment in UMa/UMi

Configure Fading Channel and LOS

Configure a CDL or TDL fading channel as defined in TR 38.901. The fading channel models short-term variations of the channel response over time and frequency.

simParameters.DelayProfile = 'TDL-A'; % A, B, and C profiles are NLOS channels. D and E profiles are LOS channels.

if contains(simParameters.DelayProfile,'CDL','IgnoreCase',true)
    channel = nrCDLChannel;
    channel.DelayProfile = simParameters.DelayProfile;
    chInfo = info(channel);
    kFactor = chInfo.KFactorFirstCluster; % dB
else % TDL
    channel = nrTDLChannel;
    channel.DelayProfile = simParameters.DelayProfile;
    chInfo = info(channel);
    kFactor = chInfo.KFactorFirstTap; % dB
end

% Determine LOS between Tx and Rx based on Rician factor K.
simParameters.LOS = kFactor>-Inf;

% Determine the sample rate and FFT size that are required for this carrier.
waveformInfo = nrOFDMInfo(simParameters.Carrier);

% Get the maximum delay of the fading channel.
chInfo = info(channel);
maxChDelay = chInfo.MaximumChannelDelay;

Calculate Propagation Path Loss

This section calculates the path loss between the transmitter (BS) and receiver (UE).

% Calculate the path loss.
if contains(simParameters.PathLossModel,'5G','IgnoreCase',true)
    txPosition = [0;0; simParameters.TxHeight];
    dtr = simParameters.TxRxDistance;
    rxPosition = [dtr; zeros(size(dtr)); simParameters.RxHeight*ones(size(dtr))];
    pathLoss = nrPathLoss(simParameters.PathLoss,simParameters.CarrierFrequency,simParameters.LOS,txPosition,rxPosition);
else % Free-space path loss
    lambda = physconst('LightSpeed')/simParameters.CarrierFrequency;
    pathLoss = fspl(simParameters.TxRxDistance,lambda);
end

Calculate Antenna and Receiver Noise

This section calculates the equivalent noise temperature and amplitude per receive antenna element from the input noise temperature and receiver internal noise. The noise amplitude per receive antenna is

N0=12kBTe

where k is the Boltzmann constant (1.3807×10-23JK-1). B is the bandwidth, which is equal the waveform sample rate. The equivalent noise temperature Te is

Te=TAnt+290(NF-1),

TAnt is the input noise temperature and NF is the receiver noise figure in linear units.

kBoltz = physconst('Boltzmann');
NF = 10^(simParameters.RxNoiseFigure/10);
Teq = simParameters.RxAntTemperature + 290*(NF-1); % K
N0 = sqrt(kBoltz*waveformInfo.SampleRate*Teq/2.0);

Calculate Signal-to-Noise Ratio (SNR)

This section uses the configuration parameters to calculate the SNR per resource element (RE) resulting from the transmit power, receive noise, bandwidth, and path loss. The average receive signal per RE and the receive antenna and noise power per RE are

SPRES=PTxL×NFFT212Ngridsize and

NPREN=2N02NFFT.

PTx is the total transmitted power at the transmit antenna array input. NFFT is the number of fast Fourier transform (FFT) points used for OFDM modulation. Ngridsize is the size of the OFDM grid in resource blocks. L is the path loss. 2N0 is root-mean-square (RMS) value of the noise per receive antenna. The average SNR per RE and receive antenna is

(SN)dB=10log10(PTx)-10log10(L)+10log10(NFFT12Ngridsize)-10log10(2N02).

These are the SNR values you must use in the NR PDSCH Throughput and NR PUSCH Throughput examples.

fftOccupancy = 12*simParameters.Carrier.NSizeGrid/waveformInfo.Nfft;
simParameters.SNRIn = (simParameters.TxPower-30) - pathLoss - 10*log10(fftOccupancy) - 10*log10(2*N0^2);
disp(simParameters.SNRIn)
    5.4206   -4.5425

Create a table to display the SNR at each Tx-Rx distance

SNRInc = mat2cell(simParameters.SNRIn(:),length(pathLoss),1);
tSNRIn = table(simParameters.TxRxDistance(:),SNRInc{:},'VariableNames',{'Distance Tx-Rx (m)','SNR (dB)'});
disp(tSNRIn)
    Distance Tx-Rx (m)    SNR (dB)
    __________________    ________

           500             5.4206 
           900            -4.5425 

For more information on how 5G Toolbox™ link-level simulations define the signal-to-noise ratio (SNR), see SNR Definition Used in Link Simulations.

Appendix: Verify SNR Values

This section helps you verify the SNR values obtained and review additional details of the relationship between the path loss, transmit power, and receive noise, and the resulting SNR. For that purpose, this section simulates the transmission of a CP-OFDM signal with the specified transmit power through the propagation channel, and measure the resulting SNR at the receiver. You do not need to implement this transmission in 5G Toolbox examples. Instead, you can use the SNR expression or values obtained in previous section of this example.

For the SNR measurement, the receiver has knowledge of the channel and noise. This SNR measurement uses independent channel realizations (block fading) to obtain meaningful results with the minimum number of transmission slots required.

Set the length of the simulation in terms of the number of 10ms frames.

NFrames = 20;
NSlots = NFrames*simParameters.Carrier.SlotsPerFrame;
nSNRPoints = length(pathLoss);                          % Number of SNR points

% Initialize measurements and create auxiliary variables.
nTxAnt = chInfo.NumTransmitAntennas;
nRxAnt = chInfo.NumReceiveAntennas;
[powSignalRE,powSignal,powNoiseRE,powNoise] = deal(zeros(nSNRPoints,nRxAnt,NSlots));
pgains = zeros(length(chInfo.PathDelays),nTxAnt,nRxAnt,nSNRPoints,NSlots);
scs = simParameters.Carrier.SubcarrierSpacing;
nSizeGrid = simParameters.Carrier.NSizeGrid;
nfft = waveformInfo.Nfft;

% Reset the random generator for reproducibility.
rng('default');

% Transmit a CP-OFDM waveform through the channel and measure the SNR for
% each distance between Tx and Rx (path loss values).
for pl = 1:length(pathLoss)
    carrier = simParameters.Carrier;
    for slot = 0:NSlots-1
        slotIdx = slot+1;
        carrier.NSlot = slot;

        % Change random seed to generate an independent realization of the
        % channel in every time slot (block fading).
        release(channel);
        channel.Seed = slot; 
        
        % Create the OFDM resource grid and allocate random QPSK symbols.
        txgrid = nrResourceGrid(carrier,nTxAnt);
        txgrid(:) = nrSymbolModulate(randi([0 1],numel(txgrid)*2,1),'QPSK');
        
        % Perform CP-OFDM modulation.
        txWaveform = nrOFDMModulate(txgrid,scs,slot);

        % Calculate the amplitude of the transmitted signal. The FFT and
        % resource grid size scaling normalize the signal power. The
        % transmitter distributes the power across all antennas equally,
        % simulating the effect of unit norm beamformer.
        signalAmp = db2mag(simParameters.TxPower-30)*sqrt(nfft^2/(nSizeGrid*12*nTxAnt));
        txWaveform = signalAmp*txWaveform;
        
        % Pad the signal with zeros to ensure that a full slot is available
        % to the receiver after synchronization.
        txWaveform = [txWaveform; zeros(maxChDelay, size(txWaveform,2))]; %#ok<AGROW>
        
        % Pass the signal through fading channel.
        [rxWaveform,pathGains,sampleTimes] = channel(txWaveform);
        pgains(:,:,:,pl,slotIdx) = pathGains(1,:,:,:);

        % Apply path loss to the signal.
        rxWaveform = rxWaveform*db2mag(-pathLoss(pl));
        
        % Generate AWGN.
        noise = N0*complex(randn(size(rxWaveform)),randn(size(rxWaveform)));
        
        % Perform perfect synchronization.
        pathFilters = getPathFilters(channel); % Path filters for perfect timing estimation
        offset = nrPerfectTimingEstimate(pathGains,pathFilters);
        rxWaveform = rxWaveform(1+offset:end,:);
        noise = noise(1+offset:end,:);

        % Perform CP-OFDM demodulation of the received signal and noise.
        ngrid = nrOFDMDemodulate(carrier,noise);
        rxgrid = nrOFDMDemodulate(carrier,rxWaveform);

        % Measure the RE and overall power of the received signal and noise.
        powSignalRE(pl,:,slotIdx) = rms(rxgrid,[1 2]).^2/nfft^2;
        powSignal(pl,:,slotIdx) = powSignalRE(pl,:,slotIdx)*nSizeGrid*12;
        
        powNoiseRE(pl,:,slotIdx) = rms(ngrid,[1 2]).^2/nfft^2;
        powNoise(pl,:,slotIdx) = powNoiseRE(pl,:,slotIdx)*nfft;
    end
end

You can calculate the overall SNR and SNR per RE by using the obtained received signal and noise power. The difference between the overall SNR and SNR per RE is equal to the FFT spectrum occupancy ratio 12Ngridsize/NFFT, which results from the spreading of noise energy across all FFT bins, including those bins beyond the frequency span of the resource grid.

fprintf('The resource grid uses %.1f %% of the FFT size, introducing a %.1f dB SNR gain.\n', fftOccupancy*100, -10*log10(fftOccupancy))
The resource grid uses 59.8 % of the FFT size, introducing a 2.2 dB SNR gain.
% Correct CDL/TDL average gain.
Gf = permute(mean(sum(rms(pgains,5).^2,1),2),[4 3 1 2]); % Correction factor

% Calculate overall SNR and SNR per RE.
SNRo  = 10*log10(mean(powSignal,3)./mean(powNoise,3)) - 10*log10(Gf); 
SNRre = 10*log10(mean(powSignalRE,3)./mean(powNoiseRE,3)) - 10*log10(Gf);

% Create a table to display the results.
SNRrec = mat2cell(SNRre,nSNRPoints,ones(nRxAnt,1));
tSNRre = table(simParameters.TxRxDistance(:),SNRrec{:},'VariableNames',["Distance (m)", "SNR RxAnt"+(1:nRxAnt)]);
disp(tSNRre)
    Distance (m)    SNR RxAnt1    SNR RxAnt2
    ____________    __________    __________

        500           5.4398        5.4816  
        900          -4.5261       -4.4795  

In addition to small-scale fading, CDL and TDL channels model other aspects such as antenna polarization, antenna gain, antenna correlation, and normalization by the number of received antennas, that affect the average propagation loss. The correction factor Gf applied to the SNR compensates for this average propagation loss introduced by the CDL or TDL channel and matches the measurement with the SNR definition in 5G Toolbox link-level simulations.

See Also

Functions

Objects

Related Topics