How to Start 5G Network Projects Using NS3

To start 5G network projects using NS3 which encompasses to utilize modules such as the mmWave or 5G-LENA (5G New Radio) module that prolong functionality of NS3 supporting the 5G New Radio (NR) networks. These components permits to replicate and learn the characteristics of 5G like millimeter-wave communication, higher data rates, low-latency transmission, and advanced antenna sets up. Below is a step-by-step method to configuring a 5G network project in NS3.

Steps to Start 5G Network Projects in NS3

  1. Install NS-3 and the 5G Module

For 5G simulations, 5G-LENA module is depends on the LTE and NR protocols and for NS3 which is particularly invented. It contains support for NR Radio Access Networks (RAN) and the core network.

  1. Download NS3 if we don’t install it previously:

git clone https://gitlab.com/nsnam/ns-3-dev.git ns-3

cd ns-3

./waf configure –enable-examples –enable-tests

./waf build

  1. Download and Install the 5G-LENA Module: From the appropriate source, we replicate the 5G-LENA repository and incorporate this along with NS3. Also, if utilizing high-frequency bands, we may determine an mmWave module for more simulations.

git clone https://gitlab.com/5g-lena/nr.git src/nr

./waf configure –enable-examples –enable-tests

./waf build

  1. Confirm Installation by executing a n instance from the 5G-LENA or mmWave module:

./waf –run=nr-simple

  1. Understand 5G Network Components in NS3

We will replicate the following significant network modules in a 5G network:

  • gNB (Next Generation Node B): Denotes the 5G base station.
  • UE (User Equipment): Mobile devices associating to the 5G network.
  • Core Network (5GC): Core network components handling the connections among gNBs and external networks.
  • Channels: Diverse frequency channels that particularly for millimeter-wave (mmWave) frequencies, supporting high data rates.
  • Beamforming: Directional antennas, which enhance the signal quality by concentrating signals within a particular direction.
  1. Set Up a Basic 5G Network Topology

Initially, configure a basic 5G network including one gNB and numerous UEs. Before appending more difficult aspects, it supports to know the simple functionality.

Example: Basic 5G Network with One gNB and Multiple UEs

Here’s an instance to configure a basic 5G network to utilize a single gNB and several UEs.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/mobility-module.h”

#include “ns3/nr-module.h”

#include “ns3/point-to-point-helper.h”

#include “ns3/applications-module.h”

using namespace ns3;

int main(int argc, char *argv[]) {

CommandLine cmd;

cmd.Parse(argc, argv);

// Create nodes for gNB (base station) and UEs

NodeContainer gNbNode;

gNbNode.Create(1);

NodeContainer ueNodes;

ueNodes.Create(3);

// Set up the NR (5G) helper

Ptr<NrHelper> nrHelper = CreateObject<NrHelper>();

nrHelper->SetSchedulerTypeId(TypeId::LookupByName(“ns3::NrMacSchedulerTdmaRR”));

// Create the gNB and UE devices

NetDeviceContainer gNbDevice = nrHelper->InstallGnbDevice(gNbNode);

NetDeviceContainer ueDevices = nrHelper->InstallUeDevice(ueNodes);

// Set up mobility for gNB and UEs

MobilityHelper mobility;

mobility.SetMobilityModel(“ns3::ConstantPositionMobilityModel”);

mobility.Install(gNbNode);

mobility.SetPositionAllocator(“ns3::GridPositionAllocator”,

“MinX”, DoubleValue(0.0),

“MinY”, DoubleValue(0.0),

“DeltaX”, DoubleValue(10.0),

“DeltaY”, DoubleValue(10.0),

“GridWidth”, UintegerValue(3),

“LayoutType”, StringValue(“RowFirst”));

mobility.SetMobilityModel(“ns3::RandomWalk2dMobilityModel”,

“Bounds”, RectangleValue(Rectangle(-50, 50, -25, 50)));

mobility.Install(ueNodes);

// Install Internet stack

InternetStackHelper internet;

internet.Install(ueNodes);

// Assign IP addresses to UE devices

Ipv4AddressHelper ipv4;

ipv4.SetBase(“7.0.0.0”, “255.255.255.0”);

Ipv4InterfaceContainer ueIpIfaces = ipv4.Assign(ueDevices);

// Attach UEs to the gNB

nrHelper->AttachToClosestEnb(ueDevices, gNbDevice);

// Set up applications (UDP echo server on one UE, clients on others)

uint16_t port = 9;

UdpEchoServerHelper echoServer(port);

ApplicationContainer serverApp = echoServer.Install(ueNodes.Get(0));

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(ueIpIfaces.GetAddress(0), port);

echoClient.SetAttribute(“MaxPackets”, UintegerValue(10));

echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0)));

echoClient.SetAttribute(“PacketSize”, UintegerValue(1024));

ApplicationContainer clientApps;

clientApps.Add(echoClient.Install(ueNodes.Get(1)));

clientApps.Add(echoClient.Install(ueNodes.Get(2)));

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

Simulator::Run();

Simulator::Destroy();

return 0;

}

  1. Experiment with Different Frequency Bands and Bandwidth

5G networks can be functioned on both sub-6 GHz and mmWave frequency bands. For frequency and bandwidth, set up the 5G NR settings:

nrHelper->SetAttribute(“Frequency”, UintegerValue(28e9)); // 28 GHz for mmWave

nrHelper->SetAttribute(“Bandwidth”, UintegerValue(100e6)); // 100 MHz bandwidth

  1. Configure Beamforming for Directional Communication

Beamforming is a 5G network’s crucial aspects that specifically for mmWave. NS3’s 5G module assists beamforming directing signals, to enhance the quality and minimizing interference.

nrHelper->SetAttribute(“BeamformingMethod”, StringValue(“RealisticBeamforming”));

  1. Set Up Mobility Models

5G simulations frequently include the mobile UEs. We can utilize diverse mobility models replicating the pedestrian or vehicular movement.

Example:

mobility.SetMobilityModel(“ns3::ConstantVelocityMobilityModel”);

ueNodes.Get(0)->GetObject<ConstantVelocityMobilityModel>()->SetVelocity(Vector(10.0, 0.0, 0.0)); // 10 m/s in X direction

  1. Implement 5G-Specific Applications and Traffic Patterns

Replicate normal 5G traffic like high-throughput video streaming, ultra-reliable low-latency communication (URLLC), or massive machine-type communication (mMTC) utilizing the application layer of NS3.

For high-throughput traffic:

OnOffHelper onOffHelper(“ns3::UdpSocketFactory”, InetSocketAddress(ueIpIfaces.GetAddress(0), port));

onOffHelper.SetAttribute(“DataRate”, StringValue(“1Gbps”));

onOffHelper.SetAttribute(“PacketSize”, UintegerValue(1024));

ApplicationContainer app = onOffHelper.Install(gNbNode.Get(0));

app.Start(Seconds(1.0));

app.Stop(Seconds(10.0));

  1. Collect and Analyze Performance Metrics

5G simulations contain performance parameters such as throughput, latency, packet delivery, and signal strength. NS3 environment offers for examining these metrics to tracking and observe the tools.

Using FlowMonitor to Measure Performance

FlowMonitorHelper flowmon;

Ptr<FlowMonitor> monitor = flowmon.InstallAll();

monitor->SerializeToXmlFile(“5g-network-flowmon.xml”, true, true);

More performance parameters that certain to 5G containing beamforming success rate or mmWave packet delivery rate, based on the capability of the module it also probably accumulated.

  1. Visualize and Analyze Results
  • NetAnim: Envision the topology, UE movement, and packet flows within real-time.
  • Trace Analysis: For performance analysis, utilize trace files that are made by NS3.
  • Graphing Tools: Transfer data envisioning parameters such as throughput, latency, and packet delivery ratio.
  1. Experiment with Advanced 5G Features

When we have a simple 5G network configuration then test with more difficult situations:

  • Multiple gNBs and Handover: Configure several base stations learning the handover situations.
  • Dense Deployments: Append additional UEs then examine how network density affects the performance.
  • Network Slicing: For eMBB, URLLC, and mMTC traffic, we can execute slices to learn the resource allocation and QoS.

Through this entire process, you can acquire the step-by-step process regarding the 5G Network Projects, configured and analysed using NS3 tool. We will plan to share the more information on this topic.

To kick off your 5G Network Projects with the NS3 tool, we at phdprojects.org are here to provide you with innovative research guidance and the best research topics that match your interests. If you need more help, just send us an email to get great ideas and simulations