How to Simulate Flooding Routing Projects Using OMNeT++

To simulate Flooding Routing using OMNeT++, which comprises making a network in which nodes are forward incoming packets to all neighbouring nodes, make certain that every node in the network eventually receives the packet. This approach is utilized in scenarios like network discovery, broadcasting, or particular kinds of reactive routing protocols within ad-hoc networks. Flooding can lead to excessive overhead, and one of the significant features of such simulations is to learn the performance influences such as redundant transmissions, bandwidth consumption, and network congestion. The following is a simple approach to simulate and execute the Flooding Routing in OMNeT++:

Steps to Simulate Flooding Routing Projects in OMNeT++

Step 1: Install OMNeT++ and INET Framework

Make certain that OMNeT++ and the INET framework are installed on the machine. INET framework offers the essential modules for defining network elements such as nodes, routers, and communication links.

  1. Download OMNeT++: OMNeT++ official website
  2. Download INET Framework: INET Framework

Step 2: Define the Network Topology in the NED File

Describe a network topology with several nodes, which can communicate with each other. Nodes will forward packets to all their neighbours in a flooding manner.

Here’s an instance of a network in which flooding routing will be applied:

network FloodingNetwork

{

submodules:

node1: StandardHost {

@display(“p=100,200”);

}

node2: StandardHost {

@display(“p=200,200”);

}

node3: StandardHost {

@display(“p=300,200”);

}

node4: StandardHost {

@display(“p=400,200”);

}

node5: StandardHost {

@display(“p=500,200”);

}

connections:

node1.ethg++ <–> Eth100M <–> node2.ethg++;

node2.ethg++ <–> Eth100M <–> node3.ethg++;

node3.ethg++ <–> Eth100M <–> node4.ethg++;

node4.ethg++ <–> Eth100M <–> node5.ethg++;

node2.ethg++ <–> Eth100M <–> node4.ethg++; // Cross link for additional routes

}

In this topology:

  • node1 will initiate a flood.
  • node2, node3, node4, and node5 will forward receive packets to all neighbours (except the sender).

Step 3: Implement Flooding Routing in C++

We want to execute the flooding protocol in which each node sends incoming packets to all its neighbours, excepting the node from which the packet was received.

Step 3.1: Create the Flooding Routing Class

Below is an example C++ class for a simple flooding routing algorithm:

class FloodingNode : public cSimpleModule

{

private:

std::set<long> receivedMessages;  // Store received message IDs to prevent re-flooding

protected:

virtual void initialize() override;

virtual void handleMessage(cMessage *msg) override;

void floodMessage(cMessage *msg);

void generateMessage();  // To simulate an initiating node sending a message

public:

FloodingNode() {}

~FloodingNode() {}

};

Define_Module(FloodingNode);

void FloodingNode::initialize()

{

if (strcmp(getName(), “node1”) == 0) {  // Start flooding from node1

generateMessage();

}

}

void FloodingNode::generateMessage()

{

cMessage *msg = new cMessage(“FloodedMessage”);

msg->setKind(simTime().inUnit(SIMTIME_MS));  // Set a unique message ID using timestamp

floodMessage(msg);  // Start the flood

}

void FloodingNode::floodMessage(cMessage *msg)

{

long messageId = msg->getKind();  // Use message kind as a unique ID

if (receivedMessages.find(messageId) != receivedMessages.end()) {

delete msg;  // Message has already been processed, discard it

return;

}

// Mark the message as received

receivedMessages.insert(messageId);

EV << getName() << ” received and flooding message: ” << messageId << “\n”;

// Forward to all output gates (flood to neighbors)

for (int i = 0; i < gateSize(“ethg$o”); ++i) {

cMessage *copy = msg->dup();  // Duplicate the message for each neighbor

send(copy, “ethg$o”, i);

}

delete msg;  // Clean up the original message after forwarding

}

void FloodingNode::handleMessage(cMessage *msg)

{

floodMessage(msg);  // Handle incoming message by flooding it to neighbors

}

Key ideas in this implementation:

  • Flooding Algorithm: To each node sends the message to all its neighbours (except the sender) by duplicating the message.
  • Duplicate Detection: Nodes that store received message IDs within the receivedMessages set to prevent re-flooding earlier seen messages.
  • Message Generation: node1 initiates the flooding by generating the initial message.

Step 4: Configure the Simulation in omnetpp.ini

Configure the simulation metrics in the omnetpp.ini file, containing link delays, data rates, and simulation time.

[Config FloodingSimulation]

network = FloodingNetwork

sim-time-limit = 100s

# Set link delay and data rate for the links

*.node*.eth[0].datarate = 100Mbps

*.node*.eth[0].delay = 10ms

Step 5: Run the Simulation

  1. Build and compile the project in OMNeT++.
  2. Run the simulation using OMNeT++’s GUI or command line.
  3. Observe Flooding Behavior: In the OMNeT++ GUI, monitor how node1 transmits a message and then how it propagates via the network as each node floods the message to its neighbours.

Step 6: Analyse Simulation Results

The simulation platform OMNeT++ makes .sca and .vec files that include simulation outcomes. We can examine key flooding-related performance parameters:

  • Message Redundancy: Track how many times each node receives a message because of redundant flooding.
  • Network Overhead: Calculate the total amount of transmissions and how they influence network performance (e.g., collisions or queue lengths).
  • Propagation Time: Estimate how long it takes for a message to propagate from the initiating node to all nodes within the network.
  • Network Saturation: Monitor how flooding influences network congestion, particularly in dense networks.

Step 7: Extend the Simulation

We can expand the simulation by inserting extra aspects or discovering new scenarios:

7.1: Simulate Large Networks

Expand the network by inserting more nodes to mimic larger and more complex topologies. We can be made grid networks or random topologies to monitor flooding behaviour within larger networks.

7.2: Optimize Flooding with TTL (Time-to-Live)

To avoid infinite flooding, we can execute a TTL (Time-to-Live) mechanism, in which each message carries a TTL value, which reduces at each hop. When TTL attains zero then the message is rejected.

void FloodingNode::floodMessage(cMessage *msg)

{

// Decrement TTL and stop flooding if TTL reaches zero

if (msg->getPar(“ttl”).intValue() == 0) {

delete msg;

return;

}

// Decrement the TTL value

msg->par(“ttl”) = msg->par(“ttl”).intValue() – 1;

// Continue flooding as before

}

7.3: Add Random Packet Loss

Launch random packet loss to mimic real-world network conditions in which nodes might not forward messages because of the network failures.

# Simulate packet loss in the network

*.node*.eth[0].lossRate = 0.05  # 5% packet loss

7.4: Analyze Network Performance Metrics

Estimate network performance by examining how flooding influences throughput, delay, and network load. We can launch performance parameters and visualizations to measure the influence of flooding.

Step 8: Visualize Flooding with OMNeT++ Animation

Utilize OMNeT++’s built-in animation aspects to visually monitor the flooding process. We can monitor packet flows among the nodes then envision how the flooding propagates via the network.

Step 9: Simulate Controlled Flooding (Optimizations)

We can test with optimizations such as controlled flooding in which nodes are forward packets only under specific conditions (e.g., based on node degree, energy, or distance).

Throughout this manual, we learnt more about the key concepts and simulation procedure with instances are useful to simulate and analyse the Flooding Routing Projects within OMNeT++ platform. If you acquire any query on this topic, we will surely clear it too. For optimal results in Flooding Routing Projects utilizing OMNeT++ simulation, please reach out to phdprime.com. We offer support in performance analysis tailored to your project needs, so do not hesitate to connect with us for personalized services.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2