Ns3 Projects for B.E/B.Tech M.E/M.Tech PhD Scholars.  Phone-Number:9790238391   E-mail: ns3simulation@gmail.com

How to Implement Network Multi RAT in ns3

To implement the Network Multi-Radio Access Technology (Multi-RAT) in ns3 has encompasses to setup the network topology where nodes can interact using multiple wireless technologies like Wi-Fi and LTE. The given below are the detailed procedures on Multi-RAT network in ns3:

Step-by-Step Implementation:

Step 1: Set Up the Simulation Environment

  • Make certain ns3 is installed in the system.

Step 2: Create the Network Topology

  • Generate the simple network topology using ns3 with both Wi-Fi and LTE technologies.

Step 3: Write the Script

  • The given below is the sample of how to create and configure a Multi-RAT network in ns3:

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

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

#include “ns3/wifi-module.h”

#include “ns3/lte-module.h”

#include “ns3/mobility-module.h”

#include “ns3/applications-module.h”

#include “ns3/ipv4-static-routing-helper.h”

#include “ns3/ipv4-list-routing-helper.h”

#include “ns3/flow-monitor-helper.h”

using namespace ns3;

NS_LOG_COMPONENT_DEFINE (“MultiRATExample”);

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

{

CommandLine cmd;

cmd.Parse (argc, argv);

// Create nodes

NodeContainer wifiNodes;

wifiNodes.Create (2); // One AP and one STA

NodeContainer lteNodes;

lteNodes.Create (1); // One eNodeB

NodeContainer ueNodes;

ueNodes.Add (wifiNodes.Get (1)); // The STA is also the LTE UE

// Set up Wi-Fi

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();

wifiPhy.SetChannel (wifiChannel.Create ());

WifiHelper wifi;

wifi.SetRemoteStationManager (“ns3::AarfWifiManager”);

WifiMacHelper wifiMac;

Ssid ssid = Ssid (“ns-3-ssid”);

wifiMac.SetType (“ns3::StaWifiMac”,

“Ssid”, SsidValue (ssid),

“ActiveProbing”, BooleanValue (false));

NetDeviceContainer staDevice = wifi.Install (wifiPhy, wifiMac, wifiNodes.Get (1));

wifiMac.SetType (“ns3::ApWifiMac”,

“Ssid”, SsidValue (ssid));

NetDeviceContainer apDevice = wifi.Install (wifiPhy, wifiMac, wifiNodes.Get (0));

// Set up LTE

Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();

Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();

lteHelper->SetEpcHelper (epcHelper);

Ptr<Node> pgw = epcHelper->GetPgwNode ();

// Install Mobility Model

MobilityHelper mobility;

mobility.SetPositionAllocator (“ns3::GridPositionAllocator”,

“MinX”, DoubleValue (0.0),

“MinY”, DoubleValue (0.0),

“DeltaX”, DoubleValue (5.0),

“DeltaY”, DoubleValue (10.0),

“GridWidth”, UintegerValue (3),

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

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

mobility.Install (wifiNodes);

mobility.Install (lteNodes);

// Install LTE Devices

NetDeviceContainer enbDevice = lteHelper->InstallEnbDevice (lteNodes.Get (0));

NetDeviceContainer ueDevice = lteHelper->InstallUeDevice (ueNodes);

// Install the IP stack on the UEs

InternetStackHelper internet;

internet.Install (wifiNodes);

internet.Install (ueNodes);

Ipv4InterfaceContainer wifiInterfaces;

Ipv4AddressHelper address;

address.SetBase (“10.1.1.0”, “255.255.255.0”);

wifiInterfaces = address.Assign (apDevice);

wifiInterfaces = address.Assign (staDevice);

Ipv4StaticRoutingHelper ipv4RoutingHelper;

Ptr<Ipv4StaticRouting> staticRouting = ipv4RoutingHelper.GetStaticRouting (ueNodes.Get (0)->GetObject<Ipv4> ());

staticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);

lteHelper->Attach (ueDevice, enbDevice.Get (0));

// Set up applications

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (wifiNodes.Get (0));

serverApps.Start (Seconds (1.0));

serverApps.Stop (Seconds (10.0));

UdpEchoClientHelper echoClient (wifiInterfaces.GetAddress (0), 9);

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

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

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

ApplicationContainer clientApps = echoClient.Install (wifiNodes.Get (1));

clientApps.Start (Seconds (2.0));

clientApps.Stop (Seconds (10.0));

// Enable Flow Monitor

FlowMonitorHelper flowmon;

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

// Run simulation

Simulator::Stop (Seconds (10.0));

Simulator::Run ();

// Print statistics

monitor->CheckForLostPackets ();

Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());

std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)

{

Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);

std::cout << “Flow ID: ” << i->first << ” Src Addr ” << t.sourceAddress << ” Dst Addr ” << t.destinationAddress << std::endl;

std::cout << “Tx Packets = ” << i->second.txPackets << std::endl;

std::cout << “Rx Packets = ” << i->second.rxPackets << std::endl;

std::cout << “Throughput: ” << i->second.rxBytes * 8.0 / 10.0 / 1024 / 1024 << ” Mbps” << std::endl;

}

Simulator::Destroy ();

return 0;

}

Explanation:

  1. Create Nodes:
    • Create Wi-Fi and LTE nodes. The Wi-Fi STA node is also used as an LTE UE.
  1. Configure Wi-Fi:
    • Set up the Wi-Fi PHY and MAC layers.
    • Create a Wi-Fi AP and STA.
  1. Configure LTE:
    • Set up the LTE helper and EPC helper.
    • Install LTE devices on the eNodeB and UE.
  1. Install Mobility Model:
    • Set a constant position for all nodes.
  1. Install Internet Stack:
    • Install the Internet stack on all nodes.
  1. Assign IP Addresses:
    • Assign IP addresses to the Wi-Fi interfaces.
    • Set the default route for the UE.
  1. Attach LTE Devices:
    • Attach the UE to the eNodeB.
  1. Set Up Applications:
    • Create a UDP Echo server on the Wi-Fi AP.
    • Create a UDP Echo client on the Wi-Fi STA.
  1. Enable Flow Monitor:
    • Install Flow Monitor to collect performance metrics.
  1. Run Simulation:
    • Run the simulation and print the collected statistics.

Step 4: Compile and Run the Script

  1. Save the script as multi-rat-example.cc in the scratch directory of your ns-3 installation.
  2. Compile the script using the following commands:

./waf configure

./waf build

./waf –run multi-rat-example

Step 5: Analyse the Results

  • After running the simulation, the script will output performance metrics such as the number of transmitted and received packets, and throughput. Further we can evaluate data to understand the performance of the Multi-RAT network.

In this script, we had completed learn and understand about how the Multi-RAT network will successfully implemented and evaluated in ns3 tool. Also we provide the further support related to Multi-RAT network.

Our developers are implementing the code for your project using ns3tool to support Network Multi-Radio Access Technology (Multi-RAT). We have all the tools and resources needed for this task.