This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

NB-IoT NPDSCH Block Error Rate Simulation

This example shows how LTE Toolbox™ can be used to create a NB-IoT Narrowband Physical Downlink Shared Channel (NPDSCH) Block Error Rate (BLER) simulation under Additive White Gaussian Noise (AWGN).


3GPP Release 13 of LTE started to add support for Narrowband IoT applications. Release 13 defines a single NB-IoT UE Category, namely Cat-NB1, and Release 14 adds Cat-NB2 which allows for larger transport block sizes. This example focuses on Release 13 NB-IoT.

The example generates a NB-IoT NPDSCH BLER curve for a number of SNR points and transmission parameters. NPBCH, NPSS, NSSS and NPDSCH transmission gap are not considered in this example and NPDSCH and NRS (and CRS if applicable) are transmitted in all subframes.

Simulation Configuration

The simulation length is 50 DL-SCH transport blocks for a number of SNR points. A larger number of numTrBlks should be used to produce meaningful throughput results. SNR can be an array of values or a scalar.

numTrBlks = 50;                % Number of simulated transport blocks
SNR = -15:-11;                 % SNR range in dB

Setup Higher Layer Parameters

Setup the following higher layer parameters which are used to configure the NPDSCH in the next section:

  • The variable NPDSCHDataType indicates whether the NPDSCH is carrying the SystemInformationBlockType1-NB (SIB1-NB) or not, and whether the NPDSCH is carrying the broadcast control channel (BCCH) or not. The allowed values of NPDSCHDataType are 'SIB1NB', 'BCCHNotSIB1NB' and 'NotBCCH'. Note that SIB1-NB belongs to the BCCH.

  • The number of NPDSCH repetitions and the transport block size (TBS) are affected by whether NPDSCH is carrying SIB1-NB or not (see 3GPP TS 36.213 and [ 2 ]). NPDSCHDataType set to 'SIB1NB' indicates that the NPDSCH is carrying SIB1-NB; NPDSCHDataType set to either 'BCCHNotSIB1NB' or 'NotBCCH' indicates that the NPDSCH is not carrying SIB1-NB.

  • The NPDSCH repetition pattern and the scrambling sequence generation is affected by whether NPDSCH is carrying BCCH or not (see 3GPP TS 36.211 10.2.3 [ 1 ]). NPDSCHDataType set to either 'SIB1NB' or 'BCCHNotSIB1NB' indicates that the NPDSCH is carrying BCCH; NPDSCHDataType set to 'NotBCCH' indicates that the NPDSCH is not carrying BCCH.

NPDSCHDataType = 'NotBCCH';  % The allowed values are 'SIB1NB', 'BCCHNotSIB1NB' or 'NotBCCH'
  • The variable ISF configures the number of subframes for a NPDSCH according to 3GPP TS 36.213 Table [ 2 ]. Valid values for ISF are 0...7.

When the NPDSCH carries the SIB1-NB:

  • The variable SchedulingInfoSIB1 configures the number of NPDSCH repetitions according to 3GPP TS 36.213 Table and the TBS according to Table [ 2 ]. Valid values for SchedulingInfoSIB1 are 0...11.

When the NPDSCH does not carry the SIB1-NB:

  • The variable IRep configures the number of NPDSCH repetitions according to 3GPP TS 36.213 Table [ 2 ]. Valid values for IRep are 0...15.

  • The variable IMCS together with IRep configure the TBS according to 3GPP TS 36.213 Table [ 2 ]. Valid values for IMCS are 0...12.

ISF = 2;                       % Resource assignment field in DCI (DCI format N1 or N2)
SchedulingInfoSIB1 = 0;        % Scheduling information field in MasterInformationBlock-NB (MIB-NB)
IRep = 1;                      % Repetition number field in DCI (DCI format N1 or N2)
IMCS = 0;                      % Modulation and coding scheme field in DCI (DCI format N1 or N2)

eNB Configuration

Configure the starting frame and subframe numbers (enb.NFrame and enb.NSubframe) in the simulation for each SNR point, the narrowband physical cell ID enb.NNCellID, the number of NRS antenna ports (enb.NBRefP, one antenna port indicates port 2000 is used, two antenna ports indicates port 2000 and port 2001 are used), the NB-IoT operation mode enb.OperationMode which can be any value as follows:

  • 'Standalone': NB-IoT carrier deployed outside the LTE spectrum, e.g. the spectrum used for GSM or satellite communications

  • 'Guardband': NB-IoT carrier deployed in the guardband between two LTE carriers

  • 'Inband-SamePCI': NB-IoT carrier deployed in resource blocks of a LTE carrier, with enb.NBRefP the same as the number of CRS ports enb.CellRefP

  • 'Inband-DifferentPCI': NB-IoT carrier deployed in resource blocks of a LTE carrier, with enb.NBRefP different as enb.CellRefP

enb.CellRefP is configured when the operation mode is 'Inband-DifferentPCI'. The starting OFDM symbol index in a subframe for NPDSCH is configured using enb.ControlRegionSize, when the values of NPDSCHDataType and enb.OperationMode satisfy the following conditions:

  • NPDSCHDataType is either 'BCCHNotSIB1NB' or 'NotBCCH'

  • enb.OperationMode is either 'Inband-SamePCI' or 'Inband-DifferentPCI'

enb.NFrame = 0;                    % Simulation starting frame number
enb.NSubframe = 0;                 % Simulation starting subframe number
enb.NNCellID = 0;                  % NB-IoT physical cell ID
enb.NBRefP = 1;                    % Number of NRS antenna ports, should be either 1 or 2
enb.OperationMode = 'Standalone';  % The allowed values are 'Inband-SamePCI', 'Inband-DifferentPCI', 'Guardband' or 'Standalone'
if strcmpi(enb.OperationMode,'Inband-DifferentPCI')
    enb.CellRefP = enb.NBRefP;     % The allowed values are NBRefP or 4
if (strcmpi(NPDSCHDataType,'BCCHNotSIB1NB') || strcmpi(NPDSCHDataType,'NotBCCH')) && ...
        (strcmpi(enb.OperationMode,'Inband-SamePCI') || strcmpi(enb.OperationMode,'Inband-DifferentPCI'))
    enb.ControlRegionSize = 3;     % The allowed values are 0...13

NPDSCH Configuration

Obtain the following NPDSCH parameters from the higher layer configurations defined above:

  • The number of repetitions (NRep)

  • The number of subframes used for a NPDSCH when there is no repetition (NSF)

  • The transport block size (TBS)

These parameters can be obtained by using the class hNPDSCHInfo. hNPDSCHInfo also provides method displaySubframePattern to display the NPDSCH repetition pattern, which is shown in the next section.

Note: When NPDSCH does not carry the SIB1-NB, an error is triggered if the configured IRep and IMCS values lead to an empty TBS. This is the case when the TBS is not defined for a particular IRep and IMCS pair in 3GPP TS 36.213 table [ 2 ].

npdschInfo = hNPDSCHInfo;
npdschInfo.NPDSCHDataType = NPDSCHDataType;
npdschInfo.ISF = ISF;
if strcmpi(NPDSCHDataType,'SIB1NB') % NPDSCH carrying SIB1-NB
    npdschInfo.SchedulingInfoSIB1 = SchedulingInfoSIB1;
else % NPDSCH not carrying SIB1-NB
    npdschInfo.IRep = IRep;
    npdschInfo.IMCS = IMCS;
    % Verify the inputs of IRep and IMCS
    if isempty(npdschInfo.TBS)
        error(['Invalid [ITBS,ISF] (where ITBS=IMCS=' num2str(IMCS)...
            ', ISF=' num2str(ISF)  ') pair, empty TBS is returned, check valid pairs in the above table or 3GPP TS 36.213 table']);

Create the structure NPDSCH using the obtained number of repetitions (npdschInfo.NRep), the number of subframes of a NPDSCH (npdschInfo.NSF) from the class instance npdschInfo, input parameter NPDSCHDataType and the Radio Network Temporary Identifier RNTI. Note that NSF = 8 is used when NPDSCHDataType is 'SIB1NB'.

NPDSCH.NSF = npdschInfo.NSF;
NPDSCH.NRep = npdschInfo.NRep;

Verify the configured higher layer parameters using the DL-SCH code rate. The code rate is the ratio between the number of bits after CRC coding and the number of bits after rate matching. For the case when SIB1NB is set to true, the code rate R can be larger than or equal to 1, which is not a valid scenario. For example, such case happens when ISF is set to 0 and SchedulingInfoSIB1 is set to 3.

[~,info] = lteNPDSCHIndices(enb,NPDSCH);
rmoutlen = info.G;           % Bit length after rate matching, i.e. codeword length
trblklen = npdschInfo.TBS;   % Transport block size
R = (trblklen+24)/rmoutlen;  % DL-SCH channel coding rate, 24 denotes the number of CRC bits
if R >= 1
    error(['DL-SCH coding rate (' num2str(R) ') larger than or equal to 1 for the configured parameters.']);

Display Subframe Repetition Pattern

The variable displayPattern controls the display of the NPDSCH subframe repetition pattern. An example is shown in the following figure for the case when the NPDSCH carries the BCCH, the NPDSCH consists of npdschInfo.NSF = 3 different subframes, each color represents a subframe which represents 1 ms. Each subframe is repeated npdschInfo.NRep = 4 times, thus a total of 12 subframes are required to transmit the NPDSCH.

displayPattern = true;
% Display NPDSCH repetition pattern
if displayPattern == true

Block Error Rate Simulation Loop

This part of the example shows how to perform NB-IoT NPDSCH link level simulation and plot BLER results. The transmit and receive chain is depicted in the following figure. A random stream of bits with the size of the desired transport block undergoes CRC encoding, convolutional encoding and rate matching to obtain the NPDSCH bits, which are repeated according to a specific subframe repetition pattern. Scrambling, modulation, layer mapping and precoding are then applied to form the complex NPDSCH symbols. AWGN is added to these symbols after which channel decoding and demodulation are performed to recover the transport block. After de-scrambling, the repetitive subframes are soft-combined before rate recover. The transport block error rate is calculated for each SNR point. The evaluation of the block error rate is based on the assumption that all the subframes in a bundle is used to decode the transport block at the UE. A bundle is defined in the MAC layer (see 3GPP TS 36.321 [ 3 ]) as the NPDSCH.NSF NPDSCH.NRep subframes used to carry a transport block.

NSubframe = enb.NFrame*10+enb.NSubframe;      % Absolute subframe number at the starting point of the simulation
% Get total number of subframes to simulate
if strcmpi(NPDSCHDataType,'SIB1NB')
    TotSubframes = NPDSCH.NRep*8*numTrBlks;
    TotSubframes = NPDSCH.NRep*NPDSCH.NSF*numTrBlks;
bler = zeros(1,numel(SNR));                   % Initialize BLER result

% The temporary variable 'enb_init' is used to create the temporary
% variable 'enb' within the SNR loop to create independent simulation loops
% for the 'parfor' loop
enb_init = enb;

for snrIdx = 1:numel(SNR)
%parfor snrIdx = 1:numel(SNR)
% To enable the use of parallel computing for increased speed comment out
% the 'for' statement above and uncomment the 'parfor' statement below.
% This needs the Parallel Computing Toolbox. If this is not installed
% 'parfor' will default to the normal 'for' statement.

    % Set the random number generator seed depending to the loop variable
    % to ensure independent random streams

    fprintf('\nSimulating %d subframes at %gdB SNR\n',TotSubframes,SNR(snrIdx));

    enb = enb_init;    % Initialize eNodeB configuration
    txcw = [];         % Initialize the transmitted codeword
    numBlkErrors = 0;  % Number of transport blocks with errors
    estate = [];       % Initialize NPDSCH encoder state
    dstate = [];       % Initialize NPDSCH decoder state

    for subframeIdx=NSubframe:(NSubframe+TotSubframes)-1

        % Update subframe number
        enb.NSubframe = subframeIdx;

        % Update transport block when the transmitted codeword is empty
        if isempty(txcw)
            txTrBlk = randi([0 1],trblklen,1);
            txcw = lteNDLSCH(rmoutlen,txTrBlk);

        % Generate symbols for a subframe
        [txNpdschSymbols,estate] = lteNPDSCH(enb,NPDSCH,txcw,estate);

        % Get SNR in linear form, generate and add noise
        snr = 10.^(SNR(snrIdx)/10);
        npdschSize = size(txNpdschSymbols);
        noise = (1/2)*sqrt(1/snr)*complex(randn(npdschSize),randn(npdschSize));
        rxNpdschSymbols = txNpdschSymbols + noise;

        % Recover the codeword from the received NPDSCH symbols
        [rxcw,dstate] = lteNPDSCHDecode(enb,NPDSCH,rxNpdschSymbols,dstate);

        % Decode the transport block when all the subframes in a bundle
        % have been received
        if dstate.EndOfTx
           [trblkout,blkerr] = lteNDLSCHDecode(trblklen,rxcw);
           numBlkErrors = numBlkErrors + blkerr;
           % Re-initialize to enable the transmission of a new transport
           % block
           txcw = [];


    bler(snrIdx) = numBlkErrors/numTrBlks;

Simulating 300 subframes at -15dB SNR

Simulating 300 subframes at -14dB SNR

Simulating 300 subframes at -13dB SNR

Simulating 300 subframes at -12dB SNR

Simulating 300 subframes at -11dB SNR

Plot Block Error Rate vs SNR Results

semilogy(SNR, bler, '-ob');
grid on;
xlabel('SNR (dB)');

% Get figure title
if strcmpi(NPDSCHDataType,'SIB1NB')
    NPDSCH.NSF = 8;
title([' ' char(NPDSCH.NPDSCHDataType) ': TBS=' num2str(trblklen)...
    '; NSF=' num2str(NPDSCH.NSF) '; NRep=' num2str(NPDSCH.NRep) ...
    '; ' num2str(enb.NBRefP) ' NRS port(s)' ]);

The following plot shows the simulation run with numTrBlks set to 5000.


This example uses the helper class:

Selected Bibliography

  1. 3GPP TS 36.211 "Physical channels and modulation"

  2. 3GPP TS 36.213 "Physical layer procedures"

  3. 3GPP TS 36.321 "Medium Access Control (MAC) protocol specification"