Applicable versions
NetSim StandardNetsim Pro


Applicable Releases
v13.3


The first step would be to create a 5G scenario. Let us take a scenario with 1 gNB and 1 UE with the following properties

gNB - UE distance = 1800m

Band = n78, C band. BW = 10 MHz

Pathloss Model: 3GPP Urban macro

The application flow is configured such that we have "full buffer" DL traffic at the gNB



then enable fading to model a time-varying channel; set the BLER target in the gNB properties as shown below. 



In NetSim, the 5G Code Block Log file provides details such as the HARQ process ID, Transport Block Size (TBS), Modulation, Code Rate, CBS size, BLER value, CBG ID, CBG status, etc in a CSV file with time stamps and related gNB ID, UE ID, etc. 


Enable Code Block logging, by going to the Logs option and enabling the LTENR Code Block Log checkbox as shown below.




After simulation completion the LTENR_CodeBlock_Log.csv file can be accessed from the Simulation Results window under the Log files drop-down as shown.



To generate a plot of BLER vs Time from the Code Block log file, follow the steps explained below. 


NetSim tracks the i-BLER or the init BLER, which is calculated on first transmissions only. The outer loop link adaptation algorithm in NetSim uses HARQ ACK/NACKs - from first transmissions when the NDI flag is true - to step up/down the fed-back SINR by a delta up/down.  See https://www.tetcos.com/help/v13.3/Technology-Libraries/5G-NR.html#outer_loop_link_adaptation_olla for an explanation of how OLLA works in NetSim. 


Go to Developer Tab and click on Visual Basic. The Developer tab isn't displayed by default, but you can add it to the ribbon. (For steps please refer Show the Developer tab - Microsoft Support )

 

 

Insert a module in Developer Window.

 

 

Copy and Paste the VB source code provided below and click on the Run button. In this code, BLER is computed at every jumping window of size 100 TBs. 

 


Sub Ploting_BLER_vsTime()

    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=13, Criteria1:= _
        "="
    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=24, Criteria1:= _
        "0"
    Cells.Select
    Selection.Copy
    Sheets.Add After:=ActiveSheet
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("J8").Select
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 1


Dim i, j, k As Integer

Dim x As Long
Dim tbserr As Boolean
x = 2
i = Cells(x, 9).Value
j = Cells(x, 10).Value
k = Cells(x, 11).Value
tbserr = False
Cells(1, 26).Value = "isTBS_Error"
Do While Cells(x, 1).Value <> ""
    If i = Cells(x, 9).Value And j = Cells(x, 10).Value And k = Cells(x, 11).Value Then
        If Cells(x, 25).Value = "Error" Then
            tbserr = True
        End If
        
    Else
        If tbserr = True Then
            Cells(x - 1, 26) = 1
        Else
            Cells(x - 1, 26) = 0
        End If
        i = Cells(x, 9).Value
        j = Cells(x, 10).Value
        k = Cells(x, 11).Value
        tbserr = False
        If Cells(x, 25).Value = "Error" Then
            tbserr = True
        End If
    End If
    x = x + 1
Loop
If tbserr = True Then
       Cells(x - 1, 26) = 1
Else
       Cells(x - 1, 26) = 0
End If
Cells(1, 1).Value = "Time(sec)"
x = 2
Do While Cells(x, 1).Value <> ""
   
    Cells(x, 1).Value = Cells(x, 1).Value / 1000
    x = x + 1
Loop

Dim r As Range
Dim wsht As Worksheet
Dim tb3 As ListObject
Set r = Selection.CurrentRegion
Set wsht = ActiveSheet
Set tb3 = wsht.ListObjects.Add(SourceType:=xlSrcRange, Source:=r, XlListObjecthasheaders:=x1Yes)

    ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=26, Criteria1:= _
        "<>"
    ActiveWindow.ScrollColumn = 1
    Columns("A:A").Select
    Selection.Copy
    Sheets.Add After:=ActiveSheet
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("B1").Select
    Sheets("Sheet2").Select
    ActiveWindow.ScrollColumn = 11
    Columns("Z:Z").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Worksheets("Sheet2").Name = "Intermediate Calculations"
Worksheets("Sheet3").Name = "i-BLER vs Time"
' k is used as sum here
Cells(1, 3).Value = "TBS_Convergence"
x = 2
k = 0
i = 0
Do While Cells(x, 1).Value <> ""
    If i < 100 Then
        k = k + Cells(x, 2).Value
        i = i + 1
    Else
        Cells(x - 1, 3).Value = k / 100
        k = 0
        i = 1
        k = k + Cells(x, 2).Value
        
    End If
    x = x + 1
Loop

Set r = Selection.CurrentRegion
Set wsht = ActiveSheet
Set tb3 = wsht.ListObjects.Add(SourceType:=xlSrcRange, Source:=r, XlListObjecthasheaders:=x1Yes)
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=3, Criteria1:= _
        "<>"
Cells(1, 3).Value = "i-BLER"
Dim rng As Range
Set rng = Selection.CurrentRegion
'
    Range("B301").Select
    Selection.ListObject.ListColumns(2).Delete
    ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmooth).Select
    ActiveChart.SetSourceData Source:=rng
    ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
    ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
    ActiveChart.SetElement (msoElementChartTitleNone)
    ActiveChart.Axes(xlValue).HasTitle = True
    ActiveChart.Axes(xlValue).AxisTitle.Caption = "i-BLER"
    ActiveChart.Axes(xlCategory).HasTitle = True
    ActiveChart.Axes(xlCategory).AxisTitle.Caption = "Time (sec)"
    ActiveSheet.ChartObjects(1).Chart.HasTitle = True
    ActiveSheet.ChartObjects(1).Chart.ChartTitle.Text = "i-BLER vs Time(sec)"

End Sub



A table and plot for init BLER vs Time will be created. Shown below are plots for BLER target = 0.1 and BLER target = 0.2

 



Fig: OLLA algorithm makes necessary adjustments to maintain the average init BLER equal to the BLER target. Target BLER = 0.1 in the top plot, and Target BLER = 0.2 in the bottom plot.

 

The experiment file associated with the example considered above for generating plots is attached along with. Users can download, import and run simulations to understand the procedure. 

 

Useful links


1. NetSim 5G overview: https://www.tetcos.com/5g.html 

2. NetSim 5G  (v13.3) detailed documentation: https://www.tetcos.com/help/v13.3/Technology-Libraries/5G-NR.html 

3. NetSim 5G OLLA-BLER implementation: https://www.tetcos.com/help/v13.3/Technology-Libraries/5G-NR.html#outer_loop_link_adaptation_olla