How to Simulate DYMO Protocol Projects Using NS3

To simulate the DYMO (Dynamic MANET On-demand) routing protocol in NS3, which is an on-demand reactive routing protocol created for mobile ad-hoc networks (MANETs). It finds a routes dynamically when required, same to AODV (Ad hoc On-Demand Distance Vector), however with some improvements.

The simulation environment NS3 does not have a built-in execution of DYMO, however we can install external modules such as the NS3-DYMO module or we use a prebuilt NS3 execution of DYMO. This instruction will help to simulate DYMO within NS3 by using a third-party module or alternative methods.

Steps to Simulate DYMO Protocol in NS3

  1. Install NS3 and NS3-DYMO Module

We require to install NS3 and the DYMO extension module to replicate the DYMO protocol. We follow these steps to incorporate a DYMO module into NS3.

Installing NS3-DYMO Module

  1. Clone the DYMO Module Repository: We can clone a repository, which includes the execution of DYMO for NS3. Example:

git clone https://github.com/ashkanpajooh/ns3-dymo.git

  1. Copy the DYMO Files into NS3: Copy the DYMO module files into the src/ directory of the NS3 installation:

cp -r ns3-dymo/dymo /path/to/your/ns3/src/

  1. Rebuild NS3: Rebuild NS3 to consist of the DYMO module:

cd /path/to/your/ns3/

./waf configure

./waf build

Now we have DYMO combined with NS3.

  1. Create a Simulation Script Using DYMO Protocol

When the DYMO module is installed, we can utilise this in the NS3 simulations likewise to how we can use other routing protocols such as AODV or OLSR.

Example Simulation Using DYMO Protocol in NS3

  1. Include Necessary Headers

These headers are needed for setting up the wireless network, mobility, DYMO routing, and traffic applications.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/wifi-module.h”

#include “ns3/mobility-module.h”

#include “ns3/dymo-module.h”  // DYMO routing protocol

#include “ns3/applications-module.h”

#include “ns3/netanim-module.h”

  1. Create and Install Nodes

We make a nodes, which will perform as wireless devices in the MANET using the DYMO protocol.

NodeContainer nodes;

nodes.Create(10);  // Create 10 nodes for the DYMO network

  1. Configure Wireless Communication (Wi-Fi)

We can use WifiHelper and YansWifiChannelHelper to configure the wireless communication among the nodes. These tools are help set up the wireless channel and PHY layer for ad-hoc communication.

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();

wifiPhy.SetChannel(wifiChannel.Create());

WifiHelper wifi;

wifi.SetStandard(WIFI_PHY_STANDARD_80211g);  // Use the 802.11g Wi-Fi standard

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

WifiMacHelper wifiMac;

wifiMac.SetType(“ns3::AdhocWifiMac”);  // Set up the MAC for ad-hoc communication

NetDeviceContainer devices = wifi.Install(wifiPhy, wifiMac, nodes);

  1. Install the Internet Stack and DYMO Protocol

We install the Internet stack (TCP/IP) and set up DYMO as the routing protocol.

InternetStackHelper internet;

DymoHelper dymo;  // Use DYMO as the routing protocol

internet.SetRoutingHelper(dymo);  // Set DYMO as the routing protocol

internet.Install(nodes);

  1. Assign IP Addresses

Allocate an IP addresses to the wireless devices (nodes).

Ipv4AddressHelper address;

address.SetBase(“10.1.1.0”, “255.255.255.0”);  // Assign IP addresses in the 10.1.1.0/24 range

Ipv4InterfaceContainer interfaces = address.Assign(devices);

  1. Set Up Mobility Model for Nodes

We can use MobilityHelper to describe how nodes are move in the simulation. We can use a RandomWaypointMobilityModel to replicate the movement of the nodes within a random pattern.

MobilityHelper mobility;

mobility.SetPositionAllocator(“ns3::RandomRectanglePositionAllocator”,

“X”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=500.0]”),

“Y”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=500.0]”));

mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”,

“Speed”, StringValue(“ns3::UniformRandomVariable[Min=1.0|Max=10.0]”),

“Pause”, StringValue(“ns3::ConstantRandomVariable[Constant=2.0]”),

“PositionAllocator”, StringValue(“ns3::RandomRectanglePositionAllocator”));

mobility.Install(nodes);

  1. Set Up Traffic Applications

We can use UDP Echo applications to generate traffic among the nodes. One node will perform as a server, and another will be performed as a client.

  • Server (UDP Echo Server):

uint16_t port = 9;

UdpEchoServerHelper echoServer(port);

ApplicationContainer serverApp = echoServer.Install(nodes.Get(0));  // Server on node 0

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(20.0));

  • Client (UDP Echo Client):

UdpEchoClientHelper echoClient(interfaces.GetAddress(0), port);  // Client sending packets to node 0

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

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

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

ApplicationContainer clientApp = echoClient.Install(nodes.Get(5));  // Client on node 5

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(20.0));

  1. Enable Tracing and Animation

Allow packet capture (PCAP) to examine the communication among the nodes and use NetAnim to envision the simulation.

wifiPhy.EnablePcapAll(“dymo_simulation”);  // Enable PCAP tracing for all nodes

AnimationInterface anim(“dymo_simulation.xml”);  // Enable NetAnim animation

  1. Run the Simulation

Set the simulation stop time and run the simulation.

Simulator::Stop(Seconds(20.0));  // Set the simulation stop time

Simulator::Run();  // Run the simulation

Simulator::Destroy();  // Clean up after the simulation

  1. Full Example Script for DYMO Simulation

The following is a comprehensive simulation script using DYMO as the routing protocol in an NS3-based MANET.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/wifi-module.h”

#include “ns3/mobility-module.h”

#include “ns3/dymo-module.h”

#include “ns3/applications-module.h”

#include “ns3/netanim-module.h”

using namespace ns3;

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

// Step 1: Create nodes for the DYMO network

NodeContainer nodes;

nodes.Create(10);  // Create 10 nodes

// Step 2: Configure Wi-Fi communication

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();

wifiPhy.SetChannel(wifiChannel.Create());

WifiHelper wifi;

wifi.SetStandard(WIFI_PHY_STANDARD_80211g);

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

WifiMacHelper wifiMac;

wifiMac.SetType(“ns3::AdhocWifiMac”);

NetDeviceContainer devices = wifi.Install(wifiPhy, wifiMac, nodes);

// Step 3: Install DYMO routing protocol and Internet stack

InternetStackHelper internet;

DymoHelper dymo;  // Use DYMO as the routing protocol

internet.SetRoutingHelper(dymo);

internet.Install(nodes);

// Step 4: Assign IP addresses

Ipv4AddressHelper address;

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

Ipv4InterfaceContainer interfaces = address.Assign(devices);

// Step 5: Set up mobility model for nodes

MobilityHelper mobility;

mobility.SetPositionAllocator(“ns3::RandomRectanglePositionAllocator”,

“X”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=500.0]”),

“Y”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=500.0]”));

mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”,

“Speed”, StringValue(“ns3::UniformRandomVariable[Min=1.0|Max=10.0]”),

“Pause”, StringValue(“ns3::ConstantRandomVariable[Constant=2.0]”),

“PositionAllocator”, StringValue(“ns3::RandomRectanglePositionAllocator”));

mobility.Install(nodes);

// Step 6: Set up UDP Echo Server on node 0

uint16_t port = 9;

UdpEchoServerHelper echoServer(port);

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

serverApp.Start(Seconds(1.0));

serverApp.Stop(Seconds(20.0));

// Step 7: Set up UDP Echo Client on node 5

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

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

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

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

ApplicationContainer clientApp = echoClient.Install(nodes.Get(5));

clientApp.Start(Seconds(2.0));

clientApp.Stop(Seconds(20.0));

// Step 8: Enable tracing and animation

wifiPhy.EnablePcapAll(“dymo_simulation”);

AnimationInterface anim(“dymo_simulation.xml”);

// Step 9: Run the simulation

Simulator::Stop(Seconds(20.0));

Simulator::Run();

Simulator::Destroy();

return 0;

}

  1. Running the Simulation
  • We compile and run the script using NS3’s waf build system:

./waf build

./waf –run dymo_simulation

  1. Analyzing Results
  • PCAP Traces: We can use Wireshark to examine the packet traces are generated by the simulation. The pcap files are made during the simulation include details of the packets exchanged among the nodes.
  • NetAnim Visualization: The .xml file can be opened in NetAnim to envision node movement and packet transmission in real-time.
  1. Extending the Simulation

We can expand this simulation by:

  • Inserting more nodes to make a larger MANET.
  • Altering the mobility model to replicate the real-world scenarios (e.g., using SUMO for vehicle mobility).
  • Utilising various traffic patterns (e.g., TCP, video streaming, or file transfers) to examine DYMO’s performance under numerous conditions.
  • Investigating with QoS settings and changing packet sizes, intervals, and mobility speeds.

This approach will instruct you on how to simulate and analyse the DYMO protocol projects using NS3 tool through the above simulation approach. We will offer further specifies based on your requirements.

To simulate DYMO Protocol Projects Using NS3, all you have to do is send us all of your research details via email, and we will respond promptly, providing you with valuable and optimal results. We have all of the tools and resources you need to complete your work. You can approach us without hesitation and speak with one of our experts to clear your doubts.We will assist with network evaluation for your projects.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2