Main Content

NR Cell Performance Evaluation with Physical Layer Integration

This example shows how to use full physical layer (PHY) processing in system-level simulation. The example models a 5G New Radio (NR) cell consisting of a set of user equipment (UE) nodes connected to a gNB node. The NR stack on the nodes includes radio link control (RLC), medium access control (MAC), and physical (PHY) layers. The example also models channel impairments that you can customize. You can also run the example with abstract PHY and compare its performance with that of full PHY.

Introduction

This example models:

  • Full PHY with perfect channel estimation. Use full PHY to model single-cell scenarios.

  • Downlink (DL) channel quality measurements performed by UE nodes based on the channel state information reference signal (CSI-RS) received from the gNB. All the UE nodes in the cell use the same CSI-RS resource.

  • Uplink (UL) channel quality measurement performed by the gNB node based on the sounding reference signals (SRS) received from the UE nodes.

  • Free space path loss (FSPL).

  • Clustered delay line (CDL) propagation channel model for each link. You can customize the channel model configuration.

  • Single-input-single-output (SISO) antenna configuration. You can configure the example to use a multiple-input multiple-output (MIMO) configuration.

The example assumes that the nodes send the control packets — buffer status report (BSR), DL assignment, UL grants, physical downlink shared channel (PDSCH) feedback, and CSI reportout — of band, without the need for resources for transmission and assured error-free reception.

Physical Layer

The example uses 5G Toolbox™ for PHY layer operations performed by a UE and a gNB. The transmitter-side operations involve the PHY processing of a transport block received from MAC and its transmission. The receiver-side operations include the processing of the received waveform and sending the decoded information to MAC. For more information about the PDSCH and physical uplink shared channel (PUSCH) processing chains, see the NR PDSCH Throughput and NR PUSCH Throughput examples, respectively.

Channel Measurement and Reporting

To perform the DL channel measurement, a UE node uses CSI-RS. The gNB, on the other hand, uses SRS to perform the UL channel measurement. For more information about channel measurement and reporting, see the section 'Channel measurement and reporting' in the example NR Cell Performance Evaluation with MIMO.

Scenario Configuration

Check if the Communications Toolbox Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.

wirelessnetworkSupportPackageCheck

Create the wireless network simulator.

rng("default") % Reset the random number generator
numFrameSimulation = 20; % Simulation time in terms of number of 10 ms frames
networkSimulator = wirelessNetworkSimulator.init;

To use full PHY, set the PHY type, phyAbstractionType, to none. To use abstract PHY, set phyAbstractionType to linkToSystemMapping. All the nodes (gNB and UEs) must use the same PHY processing method.

phyAbstractionType = "none";

Create a gNB node.

gNB = nrGNB(Name="gNB",CarrierFrequency=2.6e9,ChannelBandwidth=5e6,SubcarrierSpacing=15e3,PHYAbstractionMethod=phyAbstractionType, ...
    ReceiveGain=10,TransmitPower=29);

Create four UE nodes.

uePositions = [1000 0 0; 4000 0 0; 7000 0 0; 10000 0 0];
ueNames = "UE-" + (1:size(uePositions,1));
UEs = nrUE(Name=ueNames,Position=uePositions,TransmitPower=23,PHYAbstractionMethod=phyAbstractionType);

Create a cell by connecting the UE nodes to the gNB node. Install full buffer traffic in the DL and UL directions.

connectUE(gNB,UEs,FullBufferTraffic="on");

Add the gNB node and UE nodes to the network simulator.

addNodes(networkSimulator,gNB)
addNodes(networkSimulator,UEs)

Create an N-by-N array of link-level channels, where N is the number of nodes in the cell. An element at index (i,j) contains the channel instance from node i to node j. An empty element at index (i,j) indicates that the channel does not exist from node i to node j. Here, i and j are the node IDs.

channelConfig = struct("DelayProfile","CDL-C","DelaySpread",300e-9);
channels = createCDLChannels(channelConfig,gNB,UEs);

Create a custom channel model using channels and install the custom channel on the simulator. The network simulator applies the custom channel to a packet in transit before passing it to the receiver.

customChannelModel = hNRCustomChannelModel(channels,struct(PHYAbstractionMethod=phyAbstractionType));
addChannelModel(networkSimulator,@customChannelModel.applyChannelModel)

To capture IQ samples for all the nodes in the simulation, enable the enableIQSampleCapture flag. A node only captures the IQ samples transmitted on the node's reception frequency at a time when the node expects a reception. In addition to the signal of interest to the node, the captured IQ samples may include interfering signals. The node captures the IQ samples after the waveform passes through the channel. In the captured output, zeros represent the reception inactivity duration of the node. The reception inactivity means the node did not receive any relevant IQ signal.

Capture the IQ samples of the nodes by using the helperCaptureIQSamples helper object. At the end of the simulation, the simulation stores the IQ samples of the corresponding nodes in a MAT file with the filename format NodeName_NodeID_yyyyMMdd_HHmmss.mat, where:

  • NodeName — Name of the node.

  • NodeID — Numeric ID of the node.

  • yyyyMMdd — Date of file creation, in the format year, month, day.

  • HHmmss — Time of file creation, in the format hour, minute, second, using the 24-hour clock format.

The IQSamples property of the iqSampleObj object contains the captured IQ samples. When you enable the IQ sample capture, the simulation can consume significant memory if many nodes exist or you run the simulation for a long duration. In addition the simulation generates one MAT file per node, which can consume significant disk space. For example, the simulation that captures 100 million samples generates a MAT file of size approximately 1.5 GB. Also, the IQ sample capture can result in longer simulation runtime.

if strcmp(phyAbstractionType, "none") % IQ sample capture only applies to full-PHY
    enableIQSampleCapture = false;
    if enableIQSampleCapture
        iqSampleObj = helperCaptureIQSamples.empty;
        % Set up IQ sample capture on gNB
        iqSampleObj(1) = helperCaptureIQSamples(gNB,Bandwidth=gNB.ChannelBandwidth);
        % Set up IQ sample capture on the UEs
        enableIQSampleCaptureUE = false;
        if enableIQSampleCaptureUE
            for idx = 1:numel(UEs)
                iqSampleObj(1+idx) = helperCaptureIQSamples(UEs(idx),Bandwidth=gNB.ChannelBandwidth);
            end
        end
    end
end

To log the traces, set enableTraces to true. If you set enableTraces to false, the simulation does not log the traces.

enableTraces = true;

Set up the scheduling logger and PHY logger.

if enableTraces
    % Create an object for scheduler traces logging
    simSchedulingLogger = helperNRSchedulingLogger(numFrameSimulation,gNB,UEs);
    % Create an object for PHY traces logging
    simPhyLogger = helperNRPhyLogger(numFrameSimulation,gNB,UEs);
end

The example updates the metrics plots periodically. Set the number of updates during the simulation.

numMetricsSteps = 10;

Set up the metric visualizer.

metricsVisualizer = helperNRMetricsVisualizer(gNB,UEs,NumMetricsSteps=numMetricsSteps,...
    PlotSchedulerMetrics=true,PlotPhyMetrics=true);

Write the logs to a MAT-file. You can use these logs for postsimulation analysis.

simulationLogFile = "simulationLogs"; % For logging the simulation traces

Run the simulation for the specified numFrameSimulation frames.

% Calculate the simulation duration (in seconds)
simulationTime = numFrameSimulation * 1e-2;
% Run the simulation
run(networkSimulator,simulationTime);

Read per-node statistics.

gNBStats = statistics(gNB);
ueStats = statistics(UEs);

Compare the achieved value for system performance indicators with their theoretical peak values (considering zero overheads). The performance indicators displayed are the achieved data rate (UL and DL), the achieved spectral efficiency (UL and DL), and the achieved block error rate (UL and DL). This example calculates the peak values as per 3GPP TR 37.910.

displayPerformanceIndicators(metricsVisualizer)
Peak UL Throughput: 31.11 Mbps. Achieved Cell UL Throughput: 22.15 Mbps
Achieved UL Throughput for each UE: [6.94        5.73        5.01        4.46]
Peak UL spectral efficiency: 6.22 bits/s/Hz. Achieved UL spectral efficiency for cell: 4.43 bits/s/Hz 
Block error rate for each UE in the uplink direction: [0           0           0       0.005]

Peak DL Throughput: 31.11 Mbps. Achieved Cell DL Throughput: 14.89 Mbps
Achieved DL Throughput for each UE: [5.82        3.82        2.92        2.32]
Peak DL spectral efficiency: 6.22 bits/s/Hz. Achieved DL spectral efficiency for cell: 2.98 bits/s/Hz
Block error rate for each UE in the downlink direction: [0        0.03           0        0.02]

Simulation Visualization

To evaluate the cell performance, the example shows different runtime visualizations. For more information about the shown runtime visualizations, see the example NR Cell Performance Evaluation with MIMO.

Simulation Logs

The example saves the simulation logs in a MAT-files for postsimulation analysis. For more details on the logged information, see the example NR Cell Performance Evaluation with MIMO.

if enableTraces
    simulationLogs = cell(1,1);
    if gNB.DuplexMode == "FDD"
        logInfo = struct("DLTimeStepLogs",[],"ULTimeStepLogs",[],...
            "SchedulingAssignmentLogs",[],"PhyReceptionLogs",[]);
        [logInfo.DLTimeStepLogs,logInfo.ULTimeStepLogs] = getSchedulingLogs(simSchedulingLogger);
    else % TDD
        logInfo = struct("TimeStepLogs",[],"SchedulingAssignmentLogs",[],"PhyReceptionLogs",[]);
        logInfo.TimeStepLogs = getSchedulingLogs(simSchedulingLogger);
    end
    % Get the scheduling assignments log
    logInfo.SchedulingAssignmentLogs = getGrantLogs(simSchedulingLogger);
    % Get the Phy reception logs
    logInfo.PhyReceptionLogs = getReceptionLogs(simPhyLogger);
    % Save simulation logs in a MAT-file
    simulationLogs{1} = logInfo;
    save(simulationLogFile,"simulationLogs")
end

Further Exploration

Try running the example with these modifications.

  • Run the example with MIMO antenna configuration. For more information about how to model a 5G NR cell with MIMO antenna configuration, see the example NR Cell Performance Evaluation with MIMO.

  • Use abstract PHY and compare its performance with that of full PHY.

  • Visualize the captured IQ samples. Capture the IQ samples by enabling the enableIQSampleCapture flag. To visualize the captured IQ samples, use the Signal Analyzer (Signal Processing Toolbox) app. For example, to visualize the IQ Samples captured at the gNB node, uncomment this code.

% if enableIQSampleCapture && strcmp(phyAbstractionType, "none")
%   signalAnalyzer(iqSampleObj(1).IQSamples);
% end

Local functions

Set up CDL channel instances for each DL and UL link in the cell..

function channels = createCDLChannels(channelConfig,gNB,UEs)
%createCDLChannels Create channels between gNB node and UE nodes in a cell
%   CHANNELS = createCDLChannels(CHANNELCONFIG,GNB,UES) creates channels
%   between GNB and UES in a cell.
%
%   CHANNELS is a N-by-N array where N is the number of nodes in the cell.
%
%   CHANNLECONFIG is a struct with these fields - DelayProfile and
%   DelaySpread.
%
%   GNB is an nrGNB node.
%
%   UES is an array of nrUE nodes.

numUEs = length(UEs);
numNodes = length(gNB) + numUEs;
% Create channel matrix to hold the channel objects
channels = cell(numNodes,numNodes);

% Get the sample rate of waveform
waveformInfo = nrOFDMInfo(gNB.NumResourceBlocks,gNB.SubcarrierSpacing/1e3);
sampleRate = waveformInfo.SampleRate;
channelFiltering = strcmp(gNB.PHYAbstractionMethod,'none');

for ueIdx = 1:numUEs
    % Configure the UL channel model between gNB and UE
    channel = nrCDLChannel;
    channel.DelayProfile = channelConfig.DelayProfile;
    channel.DelaySpread = channelConfig.DelaySpread;
    channel.Seed = 73 + (ueIdx - 1);
    channel.CarrierFrequency = gNB.CarrierFrequency;
    channel = hArrayGeometry(channel,UEs(ueIdx).NumTransmitAntennas,gNB.NumReceiveAntennas,...
        'uplink');
    channel.SampleRate = sampleRate;
    channel.ChannelFiltering = channelFiltering;
    channels{UEs(ueIdx).ID, gNB.ID} = channel;

    % Configure the DL channel model between gNB and UE
    channel = nrCDLChannel;
    channel.DelayProfile = channelConfig.DelayProfile;
    channel.DelaySpread = channelConfig.DelaySpread;
    channel.Seed = 73 + (ueIdx - 1);
    channel.CarrierFrequency = gNB.CarrierFrequency;
    channel = hArrayGeometry(channel,gNB.NumTransmitAntennas,UEs(ueIdx).NumReceiveAntennas,...
        'downlink');
    channel.SampleRate = sampleRate;
    channel.ChannelFiltering = channelFiltering;
    channels{gNB.ID, UEs(ueIdx).ID} = channel;
end
end

Appendix

The example uses these helper classes:

References

[1] 3GPP TS 38.104. “NR; Base Station (BS) radio transmission and reception.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[2] 3GPP TS 38.214. “NR; Physical layer procedures for data.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[3] 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[4] 3GPP TS 38.322. “NR; Radio Link Control (RLC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[5] 3GPP TS 38.323. “NR; Packet Data Convergence Protocol (PDCP) specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[6] 3GPP TS 38.331. “NR; Radio Resource Control (RRC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[7] 3GPP TR 37.910. “Study on self evaluation towards IMT-2020 submission.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

Related Topics