Main Content


Statistics of gNB

Since R2023a

    Download Required: To use statistics, first download the Communications Toolbox Wireless Network Simulation Library add-on.


    stats = statistics(gnb) returns the statistics of the 5G New Radio (NR) base station (gNB) node, gnb, in a structure, stats. To obtain statistics for multiple gNB nodes, specify an array of nrGNB objects to the statistics function.


    stats = statistics(gnb,"all") adds a field, Destinations, to the structure for each NR stack layer that contains per-destination statistics.


    collapse all

    Initialize wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create a gNB node with these specifications.

    • Duplex mode — Time division duplex

    • Channel bandwidth — 20 MHz

    • Subcarrier spacing — 30 KHz

    gnb = nrGNB(ChannelBandwidth=20e6,DuplexMode="TDD",SubcarrierSpacing=30e3);

    Create a UE node with a transmit power of 20 dBm.

    ue = nrUE(TransmitPower=20);

    Configure these uplink power control parameters at the gNB node.

    • Nominal transmit power of UE per resource block — 7 dBm

    • Fractional power control multiplier— 2


    Add a random way point mobility model to the UE node.


    Establish a connection between the UE and gNB nodes.


    Create a voice over Internet protocol (VoIP) application traffic pattern object.

    traffic = networkTrafficVoIP(GeneratePacket=true);

    Add the data traffic source to the gNB node. Set the destination node as the UE node.


    Add the gNB node to the wireless network simulator.


    Add the UE node to the wireless network simulator.


    Specify the simulation time, in seconds.

    simulationTime = 0.3;

    Run the simulation for the specified simulation time.


    Obtain the statistics for the gNB and UE nodes.

    gnbStats = statistics(gnb);
    ueStats = statistics(ue);

    Input Arguments

    collapse all

    gNB Node, specified as an nrGNB object or an array of nrGNB objects.

    Output Arguments

    collapse all

    Statistics of the gNB node, returned as a structure for a single gNB node or an array of structures for multiple gNB nodes. For more information about this output, see NR Node Statistics.

    Version History

    Introduced in R2023a