# NR Cell Performance Evaluation with MIMO

This example models a 5G New Radio (NR) cell with multiple-input multiple-output (MIMO) antenna configuration and evaluates the network performance. You can customize the scheduling strategy to leverage the MIMO capabilities and analyze the performance. This example performs downlink (DL) and uplink (UL) channel measurements using multi-port channel state information reference signals (CSI-RS) and sounding reference signals (SRS), respectively. The gNB uses the measured channel characteristics to make MIMO scheduling decisions.

### Introduction

MIMO improves network performance by improving the cell throughput and reliability. The example performs layer mapping and precoding to utilize MIMO in the DL and UL directions.

This example models:

• Single-codeword DL spatial multiplexing to perform multi-layer transmission. Single-codeword limits the number of transmission layers to 4.

• Single-codeword UL spatial multiplexing. The 3GPP specification allows only single-codeword in UL direction which limits the number of transmission layers to 4.

• Precoding to map the transmission layers to antenna ports. The example assumes one-to-one mapping from antenna ports to physical antennas.

• DL channel quality measurement by UEs based on the multi-port CSI-RS received from the gNB. The same CSI-RS configuration applies to all the UEs.

• UL channel quality measurement by gNB based on the multi-port SRS received from the UEs. The example does not support UL rank estimation and provides the rank to be used for estimating UL precoding matrix as a configuration parameter.

• DL rank indicator (RI), precoding matrix indicator (PMI), and channel quality indicator (CQI) reporting by UEs. The example supports Type-1 single-panel codebook for PMI.

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

Nodes send the control packets (buffer status report (BSR), DL assignment, UL grants, PDSCH feedback, and CSI report) out of band, without the need of resources for transmission and assured error-free reception.

### MIMO

The key aspects of MIMO include spatial multiplexing, precoding, channel measurement and reporting.

#### Spatial multiplexing

Spatial multiplexing utilizes MIMO to perform multi-layer transmission. The minimum of number of transmit and receive antennas limits the number of layers (or maximum rank). The layer mapping process maps the modulated symbols of the codeword onto different layers. It maps every ${\mathit{n}}_{}^{\mathrm{th}}$ symbol of the codeword to ${\mathit{n}}_{}^{\mathrm{th}}$ layer. For instance, this figure shows the mapping of a codeword onto four layers.

Furthermore, in the DL direction, NR specification also allows two codewords and up to a maximum of 8 transmission layers. The example currently only supports single codeword for both DL and UL.

#### Precoding

Precoding, which follows the layer mapping, maps the transmission layers to antenna ports. Precoding applies a precoding matrix to the transmission layers and outputs data streams to the antenna ports.

#### Channel measurement and reporting

It consists of DL channel measurement and reporting by the UEs and UL channel measurement by gNB.

#### DL channel measurement and reporting

CSI reporting is the process by which a UE, for DL transmissions, advises a suitable number of transmission layers (rank), PMI, and CQI values to the gNB. The UE estimates these values by performing channel measurements on its configured CSI-RS resources. For more details, see the 5G NR Downlink CSI Reporting example. The gNB scheduler uses this advice to decide the number of transmission layers, precoding matrix, and modulation and coding scheme (MCS) for PDSCHs.

#### UL channel measurement

gNB uses SRS to measure UL channel characteristics in a way analogous to CSI-RS based DL channel measurements. The UL channel measurements serve as an important input to the scheduler to decide the number of transmission layers, precoding matrix and MCS for PUSCHs.

### 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 radio link control (RLC), medium access control (MAC), and physical layer (PHY). For more details, see the NR Cell Performance Evaluation with Physical Layer Integration example.

### Scenario Configuration

Configure simulation parameters in the simParameters structure.

rng('default'); % Reset the random number generator
simParameters = []; % Clear the simParameters variable
simParameters.NumFramesSim = 10; % Simulation time in terms of number of 10 ms frames
simParameters.SchedulingType = 0; % Set the value to 0 (slot based scheduling) or 1 (symbol based scheduling)

Specify the number of UEs in the cell, assuming that UEs have sequential radio network temporary identifiers (RNTIs) from 1 to simParameters.NumUEs. If you change the number of UEs, ensure that the number of rows in simParameters.UEPosition is equal to the value of simParameters.NumUEs.

simParameters.NumUEs = 4;
% Assign position to the UEs assuming that the gNB is at (0, 0, 0). N-by-3
% matrix where 'N' is the number of UEs. Each row has (x, y, z) position of a
% UE (in meters)
simParameters.UEPosition = [300 0 0;
700 0 0;
1200 0 0;
3000 0 0];
% Validate the UE positions
validateattributes(simParameters.UEPosition, {'numeric'}, {'nonempty', 'real', 'nrows', simParameters.NumUEs, 'ncols', 3, 'finite'}, 'simParameters.UEPosition', 'UEPosition');

Specify the antenna counts at the gNB and UEs.

simParameters.GNBTxAnts = 16;
simParameters.GNBRxAnts = 8;
simParameters.UETxAnts = 4*ones(simParameters.NumUEs, 1);
simParameters.UERxAnts = 2*ones(simParameters.NumUEs, 1);
% Validate the number of transmitter and receiver antennas at UE
validateattributes(simParameters.UETxAnts, {'numeric'}, {'nonempty', 'integer', 'nrows', simParameters.NumUEs, 'ncols', 1, 'finite'}, 'simParameters.UETxAnts', 'UETxAnts')
validateattributes(simParameters.UERxAnts, {'numeric'}, {'nonempty', 'integer', 'nrows', simParameters.NumUEs, 'ncols', 1, 'finite'}, 'simParameters.UERxAnts', 'UERxAnts')

Set the channel bandwidth to 5 MHz and the subcarrier spacing (SCS) to 15 kHz as defined in 3GPP TS 38.104 Section 5.3.2.

simParameters.NumRBs = 25;
simParameters.SCS = 15; % kHz
simParameters.DLCarrierFreq = 2.646e9; % Hz
simParameters.ULCarrierFreq = 2.535e9; % Hz
% The UL and DL carriers are assumed to have symmetric channel
% bandwidth
simParameters.DLBandwidth = 5e6; % Hz
simParameters.ULBandwidth = 5e6; % Hz

Specify the SRS configuration for each UE. The example assumes full-bandwidth SRS and transmission comb number as 4, so up to 4 UEs are frequency multiplexed in the same SRS symbol by giving different comb offset. When number of UEs are more than 4, they are assigned different SRS slot offsets.

srsConfig = cell(1, simParameters.NumUEs);
combNumber = 4; % SRS comb number
for ueIdx = 1:simParameters.NumUEs
% Ensure non-overlapping SRS resources when there are more than 4 UEs by giving different offset
srsPeriod = [10 3+floor((ueIdx-1)/4)];
srsBandwidthMapping = nrSRSConfig.BandwidthConfigurationTable{:,2};
csrs = find(srsBandwidthMapping <= simParameters.NumRBs, 1, 'last') - 1;
% Set full bandwidth SRS
srsConfig{ueIdx} = nrSRSConfig('NumSRSPorts', 4, 'SymbolStart', 13, 'SRSPeriod', srsPeriod, 'KTC', combNumber, 'KBarTC',  mod(ueIdx-1, combNumber), 'BSRS', 0, 'CSRS', csrs);
end
simParameters.SRSConfig = srsConfig;

Specify the CSI-RS configuration.

csirs = nrCSIRSConfig('NID', 1, 'NumRB', simParameters.NumRBs, 'RowNumber', 11, 'SubcarrierLocations', [1 3 5 7], 'SymbolLocations', 0, 'CSIRSPeriod', [5 2]);
simParameters.CSIRSConfig = {csirs};

Specify the CSI report configuration.

csiReportConfig.PanelDimensions = [8 1]; % [N1 N2] as per 3GPP TS 38.214 Table 5.2.2.2.1-2
csiReportConfig.CQIMode = 'Subband'; % 'Wideband' or 'Subband'
csiReportConfig.PMIMode = 'Subband'; % 'Wideband' or 'Subband'
csiReportConfig.SubbandSize = 4; % Refer TS 38.214 Table 5.2.1.4-2 for valid subband sizes
% Set codebook mode as 1 or 2. It is applicable only when the number of transmission layers is 1 or 2 and
% number of CSI-RS ports is greater than 2
csiReportConfig.CodebookMode = 1;
simParameters.CSIReportConfig = {csiReportConfig};

Set the UL rank to be used for precoding matrix and MCS calculation. The example does not support UL rank estimation. For each UE, set a number less than or equal to the minimum of UE's transmit antennas and gNB's receive antennas.

simParameters.ULRankIndicator = 2*ones(1, simParameters.NumUEs);

Specify the signal-to-interference-plus-noise ratio (SINR) to a CQI index mapping table for a block error rate (BLER) of 0.1. The lookup table corresponds to the CQI table as per 3GPP TS 38.214 Table 5.2.2.1-3.

simParameters.DownlinkSINR90pc = [-3.4600 1.5400 6.5400 11.0500 13.5400 16.0400 17.5400 20.0400 22.0400 24.4300 26.9300 27.4300 29.4300 32.4300 35.4300];
simParameters.UplinkSINR90pc = [-5.4600 -0.4600 4.5400 9.0500 11.5400 14.0400 15.5400 18.0400 20.0400 22.4300 24.9300 25.4300 27.4300 30.4300 33.4300];

Specify the transmit power and antenna gain.

simParameters.UETxPower = 23; % Tx power for all the UEs in dBm
simParameters.GNBTxPower = 34; % Tx power for gNB in dBm
simParameters.GNBRxGain = 11; % Rx gain for gNB in dBi

Specify the scheduling strategy and the maximum limit on the RBs allotted for PDSCH and PUSCH. The transmission limit applies only to new transmissions and not to the retransmissions.

simParameters.SchedulerStrategy = 'PF'; % Supported scheduling strategies: 'PF', 'RR', and 'BestCQI'
simParameters.RBAllocationLimitUL = 15; % For PUSCH
simParameters.RBAllocationLimitDL = 15; % For PDSCH

#### Logging and visualization configuration

The CQIVisualization and RBVisualization parameters control the display of the CQI visualization and the RB assignment visualization respectively. To enable these visualization plots, set these parameters to true.

simParameters.CQIVisualization = false;
simParameters.RBVisualization = false;

Set the enableTraces to true to log the traces. If the enableTraces is set to false, then CQIVisualization and RBVisualization are disabled automatically and traces are not logged in the simulation. To speed up the simulation, set the enableTraces to false.

enableTraces = true;

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

simParameters.NumMetricsSteps = 10;

Write the logs to MAT-files. The example uses these logs for post-simulation analysis and visualization.

parametersLogFile = 'simParameters'; % For logging the simulation parameters
simulationLogFile = 'simulationLogs'; % For logging the simulation traces
simulationMetricsFile = 'simulationMetrics'; % For logging the simulation metrics

#### Application traffic configuration

Set the periodic DL and UL application traffic pattern for UEs.

dlAppDataRate = 40e3*ones(simParameters.NumUEs, 1); % DL application data rate in kilo bits per second (kbps)
ulAppDataRate = 40e3*ones(simParameters.NumUEs, 1);  % UL application data rate in kbps
% Validate the DL application data rate
validateattributes(dlAppDataRate, {'numeric'}, {'nonempty', 'vector', 'numel', simParameters.NumUEs, 'finite', '>', 0}, 'dlAppDataRate', 'dlAppDataRate');
% Validate the UL application data rate
validateattributes(ulAppDataRate, {'numeric'}, {'nonempty', 'vector', 'numel', simParameters.NumUEs, 'finite', '>', 0}, 'ulAppDataRate', 'ulAppDataRate');

### Derived Parameters

Compute the derived parameters based on the primary configuration parameters specified in the previous section and set some example-specific constants.

simParameters.DuplexMode = 0; % FDD (Value as 0) or TDD (Value as 1)
simParameters.NCellID = 1; % Physical cell ID
simParameters.Position = [0 0 0]; % Position of gNB in (x,y,z) coordinates

Configure the channel model

channelModelUL = cell(1, simParameters.NumUEs);
channelModelDL = cell(1, simParameters.NumUEs);
waveformInfo = nrOFDMInfo(simParameters.NumRBs, simParameters.SCS);
for ueIdx = 1:simParameters.NumUEs
% Configure the uplink channel model
channel = nrCDLChannel;
channel.DelayProfile = 'CDL-C';
channel.Seed = 73 + (ueIdx - 1);
channel.CarrierFrequency = simParameters.ULCarrierFreq;
channel.SampleRate = waveformInfo.SampleRate;
channelModelUL{ueIdx} = channel;

% Configure the downlink channel model
channel = nrCDLChannel;
channel.DelayProfile = 'CDL-C';
channel.Seed = 73 + (ueIdx - 1);
channel.CarrierFrequency = simParameters.DLCarrierFreq;
channel.SampleRate = waveformInfo.SampleRate;
channelModelDL{ueIdx} = channel;
end

Compute the slot duration for the selected SCS and the 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

Set the interval at which the example updates metrics visualization in terms of number of slots. Because this example uses a time granularity of one slot, the MetricsStepSize field must be 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

Specify one logical channel for each UE, and set the logical channel configuration for all nodes (UEs and gNBs) in the example.

numLogicalChannels = 1;
simParameters.LCHConfig.LCID = 4;

Specify the RLC entity type in the range [0, 3]. The values 0, 1, 2, and 3 indicate RLC UM unidirectional DL entity, RLC UM unidirectional UL entity, RLC UM bidirectional entity, and RLC AM entity, respectively.

simParameters.RLCConfig.EntityType = 2;

Create RLC channel configuration structure.

rlcChannelConfigStruct.LCGID = 1; % Mapping between logical channel and logical channel group ID
rlcChannelConfigStruct.Priority = 1; % Priority of each logical channel
rlcChannelConfigStruct.PBR = 8; % Prioritized bitrate (PBR), in kilobytes per second, of each logical channel
rlcChannelConfigStruct.BSD = 10; % Bucket size duration (BSD), in ms, of each logical channel
rlcChannelConfigStruct.EntityType = simParameters.RLCConfig.EntityType;
rlcChannelConfigStruct.LogicalChannelID = simParameters.LCHConfig.LCID;

Set the mapping type as per the configured scheduling type.

if ~isfield(simParameters, 'SchedulingType') || simParameters.SchedulingType == 0 % If no scheduling type is specified or slot based scheduling is specified
simParameters.PUSCHMappingType = 'A';
simParameters.PDSCHMappingType = 'A';
else % Symbol based scheduling
simParameters.PUSCHMappingType = 'B';
simParameters.PDSCHMappingType = 'B';
end

### gNB and UEs Setup

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

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
simParameters.ChannelModel = channelModelUL;
gNB.PhyEntity = hNRGNBPhy(simParameters); % Create the PHY instance
configurePhy(gNB, simParameters); % Configure the PHY
setPhyInterface(gNB); % Set the interface to PHY

% Create the set of UE nodes
UEs = cell(simParameters.NumUEs, 1);
ueParam = simParameters;
for ueIdx=1:simParameters.NumUEs
ueParam.Position = simParameters.UEPosition(ueIdx, :); % Position of the UE
ueParam.UERxAnts = simParameters.UERxAnts(ueIdx);
ueParam.UETxAnts = simParameters.UETxAnts(ueIdx);
ueParam.SRSConfig = simParameters.SRSConfig{ueIdx};
ueParam.CSIReportConfig = simParameters.CSIReportConfig{1}; % Assuming same CSI Report configuration for all UEs
ueParam.ChannelModel = channelModelDL{ueIdx};
UEs{ueIdx} = hNRUE(ueParam, ueIdx);
UEs{ueIdx}.PhyEntity = hNRUEPhy(ueParam, ueIdx); % Create the PHY instance
configurePhy(UEs{ueIdx}, ueParam); % Configure the PHY
setPhyInterface(UEs{ueIdx}); % Set up the interface to PHY

% Set up logical channel at gNB for the UE
configureLogicalChannel(gNB, ueIdx, rlcChannelConfigStruct);
% Set up logical channel at UE
configureLogicalChannel(UEs{ueIdx}, ueIdx, rlcChannelConfigStruct);

% Set up application traffic
% 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('GeneratePacket', true, ...
'OnTime', simParameters.NumFramesSim*10e-3, 'OffTime', 0, 'DataRate', dlAppDataRate(ueIdx));
% 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('GeneratePacket', true, ...
'OnTime', simParameters.NumFramesSim*10e-3, 'OffTime', 0, 'DataRate', ulAppDataRate(ueIdx));
end

Set up the packet distribution mechanism.

simParameters.MaxReceivers = simParameters.NumUEs + 1; % Number of nodes
% Create packet distribution object
packetDistributionObj = hNRPacketDistribution(simParameters);
hNRSetUpPacketDistribution(simParameters, gNB, UEs, packetDistributionObj);

### Processing Loop

Run the simulation symbol by symbol to execute these operations.

• Run the gNB.

• Run the UEs.

• Log and visualize metrics for each layer.

• Advance the timer for the nodes and send a trigger to application and RLC layers every millisecond. The application and RLC layers execute their scheduled operations based on a 1 ms timer trigger.

Create objects to log and visualize MAC traces and PHY traces.

if enableTraces
% Create an object for MAC traces logging
simSchedulingLogger = hNRSchedulingLogger(simParameters);
% Create an object for PHY traces logging
simPhyLogger = hNRPhyLogger(simParameters);
% Create an object for CQI and RB grid visualization
if simParameters.CQIVisualization || simParameters.RBVisualization
gridVisualizer = hNRGridVisualizer(simParameters, 'MACLogger', simSchedulingLogger);
end
end

Create an object for MAC and PHY metrics visualization.

nodes = struct('UEs', {UEs}, 'GNB', gNB);
metricsVisualizer = hNRMetricsVisualizer(simParameters, 'Nodes', nodes, 'EnableSchedulerMetricsPlots', true, 'EnablePhyMetricsPlots', true);

Run the processing loop.

slotNum = 0;
numSymbolsSim = numSlotsSim * 14; % Simulation time in units of symbol duration (assuming normal cyclic prefix)

tickGranularity = 1;
% Execute all the symbols in the simulation
for symbolNum = 1 : tickGranularity : numSymbolsSim
if mod(symbolNum - 1, 14) == 0
slotNum = slotNum + 1;
end
% Run the gNB
run(gNB);

% Run the UEs
for ueIdx = 1:simParameters.NumUEs
run(UEs{ueIdx});
end

if enableTraces
% MAC logging
logCellSchedulingStats(simSchedulingLogger, symbolNum, gNB, UEs);
% PHY logging
logCellPhyStats(simPhyLogger, symbolNum, gNB, UEs);
end

% Visualization
% Check slot boundary
if symbolNum > 1 && ((simParameters.SchedulingType == 1 && mod(symbolNum, 14) == 0) || (simParameters.SchedulingType == 0 && mod(symbolNum-1, 14) == 0))
% If the update periodicity is reached, plot scheduler metrics and PHY metrics at slot boundary
if mod(slotNum, simParameters.MetricsStepSize) == 0
plotLiveMetrics(metricsVisualizer);
end
end

% Advance timer ticks for gNB and UEs
for ueIdx = 1:simParameters.NumUEs
end
end

Get the simulation metrics and save it in a MAT-file. The simulation metrics are saved in a MAT-file with the file name as simulationMetricsFile.

metrics = getMetrics(metricsVisualizer);
save(simulationMetricsFile, 'metrics');

At the end of the simulation, the achieved value for system performance indicator 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. The number of layers used for the peak DL and UL data rate calculation is taken as the average value of the maximum layers possible for each UE in the respective direction. The maximum number of DL layers possible for a UE is minimum of its Rx antennas and gNB's Tx antennas. Similarly, the maximum number of UL layers possible for a UE is minimum of its Tx antennas and gNB's Rx antennas.

displayPerformanceIndicators(metricsVisualizer);
Peak UL Throughput: 124.42 Mbps. Achieved Cell UL Throughput: 26.59 Mbps
Achieved UL Throughput for each UE: [9.27           10         6.89         0.43]
Achieved Cell UL Goodput: 26.59 Mbps
Achieved UL Goodput for each UE: [9.27           10         6.89         0.43]
Peak UL spectral efficiency: 24.88 bits/s/Hz. Achieved UL spectral efficiency for cell: 5.32 bits/s/Hz

Peak DL Throughput: 62.21 Mbps. Achieved Cell DL Throughput: 29.72 Mbps
Achieved DL Throughput for each UE: [9.58         5.3        9.57        5.27]
Achieved Cell DL Goodput: 29.26 Mbps
Achieved DL Goodput for each UE: [9.58        4.85        9.57        5.27]
Peak DL spectral efficiency: 12.44 bits/s/Hz. Achieved DL spectral efficiency for cell: 5.85 bits/s/Hz

Block error rate for each UE in the uplink direction: [0  0  0  0]
Block error rate for each UE in the downlink direction: [0       0.038           0           0]

### Simulation Visualization

The five types of run-time visualization shown are:

• Display of CQI values for UEs over the PUSCH or 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 parametersLogFile. The per time step logs, scheduling assignment logs, and BLER logs are saved in the MAT-file simulationLogFile. After the simulation, open the file to load DLTimeStepLogs, ULTimeStepLogs, SchedulingAssignmentLogs, BLERLogs 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 example.

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.

BLER logs: Block error information observed in the DL and UL direction. For details of log format, see the 'Simulation Logs' section in the NR Cell Performance Evaluation with Physical Layer Integration example.

if enableTraces
simulationLogs = cell(1,1);
if simParameters.DuplexMode == 0 % FDD
logInfo = struct('DLTimeStepLogs', [], 'ULTimeStepLogs', [], 'SchedulingAssignmentLogs', [], 'BLERLogs', [], 'AvgBLERLogs', []);
else % TDD
logInfo = struct('TimeStepLogs', [], 'SchedulingAssignmentLogs', [], 'BLERLogs', [], 'AvgBLERLogs', []);
end
logInfo.SchedulingAssignmentLogs = getGrantLogs(simSchedulingLogger); % Scheduling assignments log
save(parametersLogFile, 'simParameters'); % Save simulation parameters in a MAT-file
save(simulationLogFile, 'simulationLogs'); % Save simulation logs in a MAT-file
end

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.

### Further Exploration

You can use this example to further explore custom scheduling.

#### Custom scheduling

You can modify the existing scheduling strategy to implement a custom one. Plug In Custom Scheduler in System-Level Simulation example explains how to create a custom scheduling strategy and plug it into system-level simulation. MIMO configuration appends more fields to the scheduling assignment structure. Populate the fields of scheduling assignments with values for precoding matrix, number of layers as per your custom scheduling strategy. For more information about the information fields of a scheduling assignment, see the description of the scheduleDLResourcesSlot and scheduleULResourcesSlot functions in the hNRScheduler.m helper file.

The DL scheduler in the example selects the rank and precoding matrix which a UE reports in the CSI. You can also customize this behavior to select any rank and precoding matrix by overriding the function selectDLRankAndPrecodingMatrix in your custom scheduler. For more details, see the description of the selectDLRankAndPrecodingMatrix function in the hNRScheduler.m file. You can do similar customization for UL direction by overriding selectULRankAndPrecodingMatrix function in the hNRScheduler.m.

#### Importing ray-traces

You can modify this example to customize the CDL channel model parameters by using the output of a ray tracing analysis. Refer to the CellPerformanceWithRayTrace.m script, which demonstrates this workflow. The script follows the CDL Channel Model Customization with Ray Tracing example to configure the 'Custom' delay profile of nrCDLChannel object.

## 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.