Main Content

NR Cell Performance Evaluation with Physical Layer Integration

This example models a 5G New Radio (NR) cell by integrating the higher layers of the NR stack with 5G Toolbox™ physical layer processing and evaluates the network performance in the presence of channel impairments. The cell has a set of user equipments (UEs) connected to a gNB with radio link control (RLC), medium access control (MAC), and physical (PHY) layers of the NR stack installed on the network nodes. For faster MAC focused simulations you can switch to passthrough PHY layer or you can integrate with a custom PHY layer.

Introduction

The example considers the following operations within gNB and UEs that facilitate uplink (UL) and downlink (DL) transmissions and receptions.

The complete PUSCH or PDSCH packet is transmitted in the first symbol of its allocated symbol set. Receiver processes the packet in the symbol just after the last symbol in the allocated symbol set.

This example models:

  • Slot-based UL and DL scheduling of PUSCH and PDSCH resources, respectively. The time-domain granularity of the UL assignment and DL assignment is one slot.

  • Configurable subcarrier spacing resulting in different slot durations.

  • Noncontiguous allocation of frequency-domain resources in terms of resource block groups (RBGs).

  • Asynchronous adaptive hybrid automatic repeat request (HARQ) mechanism in UL and DL.

  • PUSCH demodulation reference signal (DM-RS) and PDSCH DM-RS.

  • DL channel quality measurement by UEs based on the CSI-RS received from gNB. By default, the CSI-RS resource element is transmitted in each slot for each resource block (RB) in DL bandwidth for all UEs. The same CSI-RS configuration is applicable to all the UEs. The example does not model the sounding reference signal (SRS) for measuring UL channel quality. UL channel quality is assumed to be the same as the DL channel quality measured on CSI-RS.

  • Free space path loss (FSPL), additive white Gaussian noise (AWGN), and clustered delay line (CDL) propagation channel model.

  • Single input single output (SISO) antenna configuration.

  • Single bandwidth part across the whole carrier.

Control packets such as UL assignment, DL assignment, buffer status report (BSR), PDSCH feedback, and channel quality indicator (CQI) report, are assumed to be sent out of band, that is, without the need of resources for transmission and assured error-free reception.

NR Protocol Stack

A node (gNB or UE) is a composition of NR stack layers. The helper classes hNRGNB.m and hNRUE.m create gNB and UE nodes respectively, containing the RLC, MAC, and PHY layers.

RLC Layer

RLC operates in unacknowledged mode (UM) with a single logical channel (LCH). For the RLC layer, both hNRGNB.m and hNRUE.m use hNRUMEntity.m to implement the functionality of both the RLC transmitter and receiver.

MAC Layer

For the MAC layer, hNRGNB.m uses the helper class hNRGNBMAC.m to implement the gNB MAC functionality and hNRUE.m uses hNRUEMAC.m to implement the UE MAC functionality. gNB MAC has UL and DL schedulers that assign UL and DL resources, respectively to the UEs. For more details about UL and DL scheduling to assign the PUSCH and the PDSCH resources, see the NR FDD Scheduling Performance Evaluation example. Schedulers are implemented in hNRSchedulerRoundRobin.m (Round robin strategy), hNRSchedulerProportionalFair.m (Proportional fair strategy), and hNRSchedulerBestCQI.m (Best CQI strategy) helper classes. All these schedulers are inherited from the base class hNRScheduler.m, which contains the core scheduling functionality.

PHY Layer and Channel Modeling

The example uses 5G Toolbox™ for PHY layer operations of UE and gNB. On the Tx side, the operations involve the physical layer processing of a transport block received from MAC and its transmission. On the Rx side, there is processing of received waveform and sending the decoded information to MAC. For more details on PDSCH and PUSCH processing chains, refer to the NR PDSCH Throughput example and NR PUSCH Throughput example, respectively. For the PHY layer, hNRGNB.m uses the helper class hNRGNBPhy.m to implement the gNB PHY layer functionality and hNRUE.m uses hNRUEPhy.m to implement the UE PHY layer functionality. For channel impairments, the example models FSPL, AWGN, and the CDL propagation channel model.

The example uses a lookup table to map the received signal to interference and noise ratio (SINR) to CQI index for 0.1 block error rate (BLER). The lookup table corresponds to the CQI table as per 3GPP TS 38.214 Table 5.2.2.1-3. For more information about the process of generating this lookup table, refer to 5G NR CQI Reporting example.

MAC-PHY Interface

Following are the major interface calls between the MAC layer and PHY layer. For more details, refer to hNRPhyInterface.m.

  • txDataRequest: The request from MAC to PHY to transmit either PDSCH (by gNB) or PUSCH (by UE). MAC calls this request at the start of Tx time. The PHY processing time is not modeled in this example.

  • rxDataRequest: The request from MAC to PHY to receive either PUSCH (by gNB) or PDSCH (by UE). MAC calls this request at the start of Rx time.

  • dlTTIRequest: The request from MAC to PHY for non-data downlink transmissions or receptions. For gNB, this request is sent by gNB MAC for DL transmissions. For UE, it is sent by UE MAC for DL receptions. MAC sends the request at the start of a DL slot for all the scheduled DL transmission or receptions in the slot. This interface is used for all the DL transmission and receptions, except PDSCH. txDataRequest and rxDataRequest are used for PDSCH. In this example, gNB MAC uses this interface to send CSI-RS, and UE MAC uses it to receive CSI-RS.

  • registerMACInterfaceFcn: The one-time setup call to register MAC callback functions at PHY. PHY uses the callbacks to send information up the stack to MAC. gNB PHY uses the callback to send decoded UL packets to MAC. UE PHY uses the callbacks to send decoded DL packets and DL channel quality measured on CSI-RS to MAC.

Pluggable PHY

You can plug and use different variations of PHY layer in your system. In a simulation run, all the nodes use the same variation of the PHY layer. The MAC is unaware of the type of PHY layer underneath, because the MAC uses the MAC-PHY interface to interact with the PHY layer. By default the example uses 5G Toolbox™ to model the PHY layer. To use a passthrough PHY layer, refer to NR PUSCH FDD Scheduling, NR FDD Scheduling Performance Evaluation, and NR TDD Symbol Based Scheduling Performance Evaluation examples. A passthrough PHY layer does not do any physical layer processing of packets.

Scenario Configuration

Set the parameters for simulation.

rng('default'); % Reset the random number generator
simParameters = []; % Clear the simParameters variable

simParameters.NumFramesSim = 30; % Simulation time in terms of number of 10 ms frames
% Number of UEs in the simulation. UEs are assumed to have sequential radio
% network temporary identifiers (RNTIs) from 1 to NumUEs. If you change the
% number of UEs, ensure that the following simulation parameters are array
% of length equal to NumUEs: simParameters.UEDistance,
% simParameters.ULPacketPeriodicityUEs, simParameters.ULPacketSizesUEs,
% simParameters.DLPacketPeriodicityUEs, simParameters.DLPacketSizesUEs
simParameters.NumUEs = 4;
simParameters.UEDistance = [100; 400; 1500; 1000];

% Set the channel bandwidth to 5 MHz and subcarrier spacing (SCS) to 15
% kHz as defined in 3GPP TS 38.104 Section 5.3.2
% RB count for 5 MHz band with 15 kHz SCS. The complete
% bandwidth is assumed to be allotted for PUSCH/PDSCH
simParameters.NumRBs = 25;
simParameters.SCS = 15; % kHz
simParameters.DLCarrierFreq = 2.635e9; % Hz
simParameters.ULCarrierFreq = 2.515e9; % Hz
% The UL and DL carriers are assumed to have symmetric channel
% bandwidth
simParameters.DLBandwidth = 5e6; % Hz
simParameters.ULBandwidth = 5e6; % Hz

simParameters.UETxPower = 23; % Tx power for all the UEs in dBm
simParameters.GNBTxPower = 29; % Tx power for gNB in dBm
simParameters.RxGain = 11; % Receiver antenna gain at gNB

% SINR to CQI mapping table for 0.1 BLER
simParameters.SINR90pc = [-5.46 -0.46 4.54 9.05 11.54 14.04 15.54 18.04 ...
    20.04 22.43 24.93 25.43 27.43 30.43 33.43];

simParameters.SchedulerStrategy = 'PF'; % Supported scheduling strategies: 'PF', 'RR', and 'BestCQI'
% Maximum limit on the RBs allotted for PUSCH and PDSCH
% Transmission limit is applicable for new PUSCH and PDSCH assignments and
% not for the retransmissions
simParameters.RBAllocationLimitUL = 15; % For PUSCH
simParameters.RBAllocationLimitDL = 15; % For PDSCH

% Logging and Visualization Configuration
% The parameters CQIVisualization and RBVisualization control the display
% of these visualizations: (i) CQI visualization of RBs (ii) RB assignment
% visualization. By default, the 'RBVisualization' plot is disabled. You
% can enable it by setting to 'true'
simParameters.CQIVisualization = true;
simParameters.RBVisualization = false;
% The output metrics plots are updated periodically NumMetricsSteps times within the
% simulation duration
simParameters.NumMetricsSteps = 20;
% MAT-files to write the logs into. They are used for post simulation analysis and visualization
simParameters.ParametersLogFile = 'simParameters'; % For logging the simulation parameters
simParameters.SimulationLogFile = 'simulationLogs'; % For logging the simulation logs

% Enable packet capture (PCAP)
simParameters.PCAPLogging = false; % Set the value to true to enable packet capture for UEofInterest
simParameters.UEofInterest = 1; % Log the packets of UE with this RNTI

% Set the periodic UL and DL application traffic pattern for UEs
simParameters.ULPacketPeriodicityUEs = [10; 20; 20; 30]; % Periodicity (in ms) at which the UL packets are generated by UEs
simParameters.ULPacketSizesUEs = [8000; 8000; 7500; 8500]; % Size of the UL packets (in bytes) generated by UEs
simParameters.DLPacketPeriodicityUEs = [10; 20; 30; 30]; % Periodicity (in ms) at which the DL packets are generated for UEs at gNB
simParameters.DLPacketSizesUEs = [10000; 9000; 7500; 7500]; % Size of the DL packets generated (in bytes) for UEs at gNB

% Validate the simulation configuration
hNRCellPerformanceWithPhysicalLayerValidateConfig(simParameters);

Derived Parameters

Based on the primary configuration parameters, compute the derived parameters. Additionally, set some example specific constants.

simParameters.DuplexMode = 0; % FDD
simParameters.NCellID = 1; % Physical cell ID
simParameters.Position = [0 0 0]; % Position of gNB in (x,y,z) coordinates
simParameters.CSIRSRowNumber = 2; % Possible row numbers for single transmit antenna case are 1 and 2
simParameters.SubbandSize = 8; % Size of sub-band for CQI reporting in terms of number of RBs
simParameters.ChannelModelType = 'CDL'; % To model CDL propagation channel
% gNB ensures that PUSCH assignment is received at UEs PUSCHPrepTime ahead
% of the transmission time
simParameters.PUSCHPrepTime = 200; % In microseconds
% Slot duration for the selected SCS and number of slots in a 10 ms frame
slotDuration = 1/(simParameters.SCS/15); % In ms
numSlotsFrame = 10/slotDuration; % Number of slots in a 10 ms frame
numSlotsSim = simParameters.NumFramesSim * numSlotsFrame; % Number of slots in the simulation

% Interval at which metrics visualization updates in terms of number of
% slots. As one slot is the finest time-granularity of the simulation, make
% sure that MetricsStepSize is an integer
simParameters.MetricsStepSize = ceil(numSlotsSim / simParameters.NumMetricsSteps);
if mod(numSlotsSim, simParameters.NumMetricsSteps) ~= 0
    % Update the NumMetricsSteps parameter if NumSlotsSim is not
    % completely divisible by it
    simParameters.NumMetricsSteps = floor(numSlotsSim / simParameters.MetricsStepSize);
end

% DL and UL packet periodicities for UEs in terms of number of slots
appPeriodicityUEsSlotsUL = simParameters.ULPacketPeriodicityUEs ./ slotDuration;
appPeriodicityUEsSlotsDL = simParameters.DLPacketPeriodicityUEs ./ slotDuration;

simParameters.NumLogicalChannels = 1; % Only 1 logical channel is assumed in each UE in this example

% Mapping between logical channel and logical channel group ID
simParameters.LCHConfig.LCGID = ones(simParameters.NumUEs, simParameters.NumLogicalChannels);
% Priority of each logical channel
simParameters.LCHConfig.Priority = ones(simParameters.NumUEs, simParameters.NumLogicalChannels);
% Prioritized bitrate (in kilo bytes per second) of each logical channel
simParameters.LCHConfig.PBR = 8*ones(simParameters.NumUEs, simParameters.NumLogicalChannels);
% Bucket size duration (BSD) of each logical channel (in ms). However, the priority,
% PBR and BSD for logical channel is not relevant with single logical
% channel assumed in this example
simParameters.LCHConfig.BSD = 10*ones(simParameters.NumUEs, simParameters.NumLogicalChannels);
% Logical channel id (logical channel ID of data radio bearers starts from 4) 
simParameters.LCHConfig.LCID = ones(simParameters.NumUEs, simParameters.NumLogicalChannels) .* (4:4+simParameters.NumLogicalChannels-1);

% RLC entity direction. Value 0 represents DL only, 1
% represents UL only and 2 represents both UL and DL
% direction. Setting entity direction to have both UL and DL
simParameters.RLCConfig.EntityDir = 2*ones(simParameters.NumUEs, simParameters.NumLogicalChannels);

% Maximum RLC SDU length (in bytes) as per 3GPP TS 38.323
simParameters.maxRLCSDULength = 9000;

gNB and UEs Setup

Create the gNB and UE objects, initialize the channel quality information for UEs, and set up the logical channel at gNB and UE. The helper classes hNRGNB.m and hNRUE.m create gNB node and UE node respectively, containing the RLC, MAC and PHY layers.

gNB = hNRGNB(simParameters); % Create gNB node
% Create scheduler
switch(simParameters.SchedulerStrategy)
    case 'RR' % Round robin scheduler
        scheduler = hNRSchedulerRoundRobin(simParameters);
    case 'PF' % Proportional fair scheduler
        scheduler = hNRSchedulerProportionalFair(simParameters);
    case 'BestCQI' % Best CQI scheduler
        scheduler = hNRSchedulerBestCQI(simParameters);
end
addScheduler(gNB, scheduler); % Add scheduler to gNB

gNB.PhyEntity = hNRGNBPhy(simParameters); % Create the PHY layer instance
configurePhy(gNB, simParameters); % Configure the PHY layer
setPhyInterface(gNB); % Set the interface to PHY layer

% Create the set of UE nodes
UEs = cell(simParameters.NumUEs, 1);
for ueIdx=1:simParameters.NumUEs
    simParameters.Position = [simParameters.UEDistance(ueIdx) 0 0]; % Position of UE
    UEs{ueIdx} = hNRUE(simParameters, ueIdx);
    UEs{ueIdx}.PhyEntity = hNRUEPhy(simParameters, ueIdx); % Create the PHY layer instance
    configurePhy(UEs{ueIdx}, simParameters); % Configure the PHY layer
    setPhyInterface(UEs{ueIdx}); % Set up the interface to PHY layer
    
    % Setup the logical channels and add application traffic
    for lcIdx = 1:simParameters.NumLogicalChannels
        % Create RLC channel configuration structure
        rlcChannelConfigStruct.EntityType = simParameters.RLCConfig.EntityDir(ueIdx, lcIdx);
        rlcChannelConfigStruct.LogicalChannelID = simParameters.LCHConfig.LCID(ueIdx, lcIdx);
        rlcChannelConfigStruct.LCGID = simParameters.LCHConfig.LCGID(ueIdx, lcIdx);
        rlcChannelConfigStruct.Priority = simParameters.LCHConfig.Priority(ueIdx, lcIdx);
        rlcChannelConfigStruct.PBR = simParameters.LCHConfig.PBR(ueIdx, lcIdx);
        rlcChannelConfigStruct.BSD = simParameters.LCHConfig.BSD(ueIdx, lcIdx);
        % Setup logical channel at gNB for the UE
        configureLogicalChannel(gNB, ueIdx, rlcChannelConfigStruct);
        % Setup logical channel at UE
        configureLogicalChannel(UEs{ueIdx}, ueIdx, rlcChannelConfigStruct);
        
        % Add data traffic pattern generators to gNB and UE nodes
        ulPacketSize = simParameters.ULPacketSizesUEs(ueIdx);
        % Calculate the data rate (in kbps) of On-Off traffic pattern using
        % packet size (in bytes) and packet interval (in ms)
        ulDataRate = ceil(1000/simParameters.ULPacketPeriodicityUEs(ueIdx)) * ulPacketSize * 8e-3;
        % Limit the size of the generated application packet to the maximum RLC
        % SDU size. The maximum supported RLC SDU size is 9000 bytes
        if ulPacketSize > simParameters.maxRLCSDULength
            ulPacketSize = simParameters.maxRLCSDULength;
        end
        
        % Create an object for On-Off network traffic pattern and add it to the
        % specified UE. This object generates the uplink data traffic on the UE
        ulApp = networkTrafficOnOff('PacketSize', ulPacketSize, 'GeneratePacket', true, ...
            'OnTime', simParameters.NumFramesSim/100, 'OffTime', 0, 'DataRate', ulDataRate);
        UEs{ueIdx}.addApplication(ueIdx, simParameters.LCHConfig.LCID(ueIdx, lcIdx), ulApp);
        
        dlPacketSize = simParameters.DLPacketSizesUEs(ueIdx);
        dlDataRate = ceil(1000/simParameters.DLPacketPeriodicityUEs(ueIdx)) * dlPacketSize *8e-3;
        if dlPacketSize > simParameters.maxRLCSDULength
            dlPacketSize = simParameters.maxRLCSDULength;
        end
        
        % Create an object for On-Off network traffic pattern for the specified
        % UE and add it to the gNB. This object generates the downlink data
        % traffic on the gNB for the UE
        dlApp = networkTrafficOnOff('PacketSize', dlPacketSize, 'GeneratePacket', true, ...
            'OnTime', simParameters.NumFramesSim/100, 'OffTime', 0, 'DataRate', dlDataRate);
        gNB.addApplication(ueIdx, simParameters.LCHConfig.LCID(ueIdx, lcIdx), dlApp);
    end
end
% Setup the UL and DL packet distribution mechanism
simParameters.MaxReceivers = simParameters.NumUEs;
% Create DL packet distribution object
dlPacketDistributionObj = hNRPacketDistribution(simParameters, 0); % 0 for DL
% Create UL packet distribution object
ulPacketDistributionObj = hNRPacketDistribution(simParameters, 1); % 1 for UL
hNRSetUpPacketDistribution(simParameters, gNB, UEs, dlPacketDistributionObj, ulPacketDistributionObj);

% Enable PCAP logging
if simParameters.PCAPLogging
    % To generate unique file name for every simulation run
    ueCapturefileName = strcat('CellID-', num2str(simParameters.NCellID), '_ue-',num2str(simParameters.UEofInterest), '_', num2str(now));
    enablePacketLogging(UEs{simParameters.UEofInterest}.PhyEntity, ueCapturefileName);
    
    % Uncomment the below code to enable packet capture at gNB
    % gnbCapturefileName = strcat('CellID-', num2str(simParameters.NCellID), '_gNB-', num2str(now));
    % enablePacketLogging(gNB.PhyEntity, gnbCapturefileName);
end

Processing Loop

Simulation is run slot by slot. In each slot, these operations are executed:

  • Run the MAC and PHY layers of gNB

  • Run the MAC and PHY layers of UEs

  • Layer-specific logging and visualization

  • Advance the timer for the nodes. Every 1 ms it also sends trigger to application and RLC layers. Application layer and RLC layer execute their scheduled operations based on 1 ms timer trigger.

% To store these UE metrics for each slot: throughput bytes
% transmitted, goodput bytes transmitted, and pending buffer amount bytes.
% The number of goodput bytes is calculated by excluding the
% retransmissions from the total transmissions
UESlotMetricsUL = zeros(simParameters.NumUEs, 3);
UESlotMetricsDL = zeros(simParameters.NumUEs, 3);

% To store current UL and DL CQI values on the RBs for the UEs
uplinkChannelQuality = zeros(simParameters.NumUEs, simParameters.NumRBs);
downlinkChannelQuality = zeros(simParameters.NumUEs, simParameters.NumRBs);

% To store last received new data indicator (NDI) values for UL and DL HARQ processes
HARQProcessStatusUL = zeros(simParameters.NumUEs, 16);
HARQProcessStatusDL = zeros(simParameters.NumUEs, 16);

% Create an object for MAC (UL & DL) scheduling information visualization and logging
simSchedulingLogger = hNRSchedulingLogger(simParameters);
% Create an object for PHY metrics logging and visualization
simPhyLogger = hNRPhyLogger(simParameters);
symbolNum = 0;

% Run processing loop
for slotNum = 1:numSlotsSim
    
    % Run MAC and PHY of gNB
    run(gNB.MACEntity);
    run(gNB.PhyEntity);
    
    % Run MAC and PHY of UEs
    for ueIdx = 1:simParameters.NumUEs
        % Read the last received NDI flags for HARQ processes for
        % logging (Reading it before it gets overwritten by run function of MAC)
        HARQProcessStatusUL(ueIdx, :) = getLastNDIFlagHarq(UEs{ueIdx}.MACEntity, 1); % 1 for UL
        HARQProcessStatusDL(ueIdx, :) = getLastNDIFlagHarq(UEs{ueIdx}.MACEntity, 0); % 0 for DL
        run(UEs{ueIdx}.MACEntity);
        run(UEs{ueIdx}.PhyEntity);
    end
    
    % MAC logging
    % Read UL and DL assignments done by gNB MAC scheduler
    % at current time. Resource assignments returned by a scheduler (either
    % UL or DL) is empty, if either scheduler was not scheduled to run at
    % the current time or no resources got scheduled
    [resourceAssignmentsUL, resourceAssignmentsDL] = getCurrentSchedulingAssignments(gNB.MACEntity);
    % Read throughput and goodput bytes sent for each UE
    [UESlotMetricsDL(:, 1), UESlotMetricsDL(:, 2)] = getTTIBytes(gNB);
    UESlotMetricsDL(:, 3) = getBufferStatus(gNB); % Read pending buffer (in bytes) on gNB, for all the UEs
    for ueIdx = 1:simParameters.NumUEs
        % Read the UL channel quality at gNB for each of the UEs for logging
        uplinkChannelQuality(ueIdx,:) = getChannelQuality(gNB, 1, ueIdx); % 1 for UL
        % Read the DL channel quality at gNB for each of the UEs for logging
        downlinkChannelQuality(ueIdx,:) = getChannelQuality(gNB, 0, ueIdx); % 0 for DL
        % Read throughput and goodput bytes transmitted for this UE in the
        % current TTI for logging
        [UESlotMetricsUL(ueIdx, 1), UESlotMetricsUL(ueIdx, 2)] = getTTIBytes(UEs{ueIdx});
        UESlotMetricsUL(ueIdx, 3) = getBufferStatus(UEs{ueIdx}); % Read pending buffer (in bytes) on UE
    end
    % Log the scheduling logs
    logScheduling(simSchedulingLogger, symbolNum + 1, resourceAssignmentsUL, UESlotMetricsUL, uplinkChannelQuality, HARQProcessStatusUL, 1);
    logScheduling(simSchedulingLogger, symbolNum + 1, resourceAssignmentsDL, UESlotMetricsDL, downlinkChannelQuality, HARQProcessStatusDL, 0);
    
    % PHY logging
    % Read the DL BLER for each UE
    ueBLERStats = zeros(simParameters.NumUEs, 2);
    for ueIdx = 1:simParameters.NumUEs
        ueBLERStats(ueIdx, :) = getDLBLER(UEs{ueIdx}.PhyEntity);
    end
    % Read the UL BLER for each UE
    gNBBLERStats = getULBLER(gNB.PhyEntity);
    % Log the UL and DL error logs
    logBLERStats(simPhyLogger, ueBLERStats, gNBBLERStats);
    
    % Visualization
    % RB assignment visualization (if enabled)
    if simParameters.RBVisualization
        if mod(slotNum, numSlotsFrame) == 0
            plotRBGrids(simSchedulingLogger);
        end
    end
    % CQI grid visualization (if enabled)
    if simParameters.CQIVisualization
        if mod(slotNum, numSlotsFrame) == 0
            plotCQIRBGrids(simSchedulingLogger);
        end
    end
    % If the update periodicity is reached, plot scheduler metrics and PHY metrics visualization
    % at slot boundary
    if mod(slotNum, simParameters.MetricsStepSize) == 0
        plotMetrics(simSchedulingLogger);
        plotMetrics(simPhyLogger);
    end
    
    % Advance timer ticks for gNB and UEs by 14 symbols
    advanceTimer(gNB, 14);
    for ueIdx = 1:simParameters.NumUEs
        advanceTimer(UEs{ueIdx}, 14);
    end
    
    % Symbol number in the simulation
    symbolNum = symbolNum + 14;
end

Simulation Visualization

The five types of run-time visualization shown are:

  • Display of CQI values for UEs over the PUSCH/PDSCH bandwidth: For details, see the 'Channel Quality Visualization' figure description in NR PUSCH FDD Scheduling example.

  • Display of resource grid assignment to UEs: The 2D time-frequency grid shows the resource allocation to the UEs. You can enable this visualization in the Scenario Configuration section. For details, see the 'Resource Grid Allocation' figure description in NR PUSCH FDD Scheduling example.

  • Display of UL scheduling metrics plots: For details, see 'Uplink Scheduler Performance Metrics' figure description in NR FDD Scheduling Performance Evaluation example.

  • Display of DL scheduling metrics plots: For details, see 'Downlink Scheduler Performance Metrics ' figure description in NR FDD Scheduling Performance Evaluation example.

  • Display of DL and UL Block Error Rates: The two sub-plots displayed in 'Block Error Rate (BLER) Visualization' shows the block error rate (for each UE) observed in the uplink and downlink directions, as the simulation progresses. The plot is updated every metricsStepSize slots.

Simulation Logs

The parameters used for simulation and the simulation logs are saved in MAT-files for post simulation analysis and visualization. The simulation parameters are saved in a MAT-file with the file name as the value of configuration parameter simParameters.ParametersLogFile. The per time step logs, scheduling assignment logs, and BLER logs are saved in the MAT-file simParameters.SimulationLogFile. After the simulation, open the file to load DLTimeStepLogs, ULTimeStepLogs SchedulingAssignmentLogs, and RLCLogs in the workspace.

Time step logs: Both the DL and UL time step logs follow the same format. For details of log format, see the 'Simulation Logs' section of NR PUSCH FDD Scheduling.

Scheduling assignment logs: Information of all the scheduling assignments and related information is logged in this file. For details of log format, see the 'Simulation Logs' section of NR FDD Scheduling Performance Evaluation example.

Block Error Rate logs: Block error information observed in the uplink and downlink directions are logged in this file. This table shows the sample log entries.

Each row of the log represents one slot. The column contains the information vector of length equal to the number of UEs. Information about a UE is at an index equal to its RNTI.

At the end of the simulation, the achieved value for system performance indicators is compared to their theoretical peak values (considering zero overheads). Performance indicators displayed are achieved data rate (UL and DL), achieved spectral efficiency (UL and DL), and BLER observed for UEs (DL and UL). The peak values are calculated as per 3GPP TR 37.910.

simulationLogs = cell(1,1);
logInfo = struct('DLTimeStepLogs',[], 'ULTimeStepLogs',[], 'SchedulingAssignmentLogs',[] ,'BLERLogs',[]);
[dlStats, ulStats] = simSchedulingLogger.getPerformanceIndicators(simParameters.ULBandwidth, simParameters.DLBandwidth);
logInfo.BLERLogs = getBLERLogs(simPhyLogger); % Block Error rate logs
fprintf('Peak UL throughput: %0.2f Mbps. Achieved average UL Throughput: %0.2f Mbps', ulStats(1, 1), ulStats(2, 1));
Peak UL throughput: 31.11 Mbps. Achieved average UL Throughput: 7.67 Mbps
fprintf('\nPeak DL throughput: %0.2f Mbps. Achieved average DL Throughput: %0.2f Mbps', dlStats(1, 1), dlStats(2, 1));
Peak DL throughput: 31.11 Mbps. Achieved average DL Throughput: 8.09 Mbps
fprintf('\nPeak UL spectral efficiency: %0.2f bits/s/Hz. Achieved average UL spectral efficiency: %0.2f bits/s/Hz ', ulStats(3, 1), ulStats(4, 1));
Peak UL spectral efficiency: 6.22 bits/s/Hz. Achieved average UL spectral efficiency: 1.53 bits/s/Hz 
fprintf('\nPeak DL spectral efficiency: %0.2f bits/s/Hz. Achieved average DL spectral efficiency: %0.2f bits/s/Hz', dlStats(3, 1), dlStats(4, 1));
Peak DL spectral efficiency: 6.22 bits/s/Hz. Achieved average DL spectral efficiency: 1.62 bits/s/Hz
fprintf('\nBlock error rate for each UE in the uplink direction: %0.2f %0.2f %0.2f %0.2f', logInfo.BLERLogs{end, 5});
Block error rate for each UE in the uplink direction: 0.07 0.04 0.19 0.15
fprintf('\nBlock error rate for each UE in the downlink direction: %0.2f %0.2f %0.2f %0.2f \n', logInfo.BLERLogs{end, 3});
Block error rate for each UE in the downlink direction: 0.01 0.03 0.08 0.05 

You can run the script NRPostSimVisualization to get a post-simulation visualization of logs. For more details about the options to run this script, refer to the NR FDD Scheduling Performance Evaluation example

% Read the logs and save them in MAT-files
[logInfo.DLTimeStepLogs, logInfo.ULTimeStepLogs] = getSchedulingLogs(simSchedulingLogger);
logInfo.SchedulingAssignmentLogs = getGrantLogs(simSchedulingLogger); % Scheduling assignments log
simulationLogs{1} = logInfo;
save(simParameters.ParametersLogFile, 'simParameters'); % Save simulation parameters in a MAT-file
save(simParameters.SimulationLogFile, 'simulationLogs'); % Save simulation logs in a MAT-file

Further Exploration

You can use this example to further explore these options.

Custom scheduling

You can modify the existing scheduling strategy to implement a custom one. Refer to 'Further Exploration' section of NR FDD Scheduling Performance Evaluation example to see the steps involved.

Use passthrough physical layer

For MAC focused simulations, you can use the passthrough PHY layer by installing passthrough PHY layer object on nodes. For gNB create an object of type hNRGNBPassthroughPhy, and for UE create an object of type hNRUEPassthroughPhy. For details, see 'gNB and UEs setup' section of NR FDD Scheduling Performance Evaluation example.

Based on described simulation parameters, the example evaluates the performance of the system measured in terms of various metrics. Different visualizations show the run time performance of the system. A more thorough post simulation analysis by using the saved logs gives a detailed picture of the operations on a per slot basis.

Use RLC AM

You can also switch the operating mode of an RLC entity from UM to acknowledged mode (AM) by modifying the input structure fields EntityType and SeqNumFieldLength in the configureLogicalChannel function of hNRNode.m. For more details, see the 'Further Exploration' section of NR FDD Scheduling Performance Evaluation.

Appendix

The example uses these helper functions and 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