How to Start Hierarchical Star Topology Projects Using OMNeT++

To start a Hierarchical Star Topology project in OMNeT++, we will generate a network in which the nodes are arranged in a star structure, nevertheless by several layers. A Hierarchical Star Topology consists of:

Steps to Start Hierarchical Star Topology Projects Using OMNeT++

  1. Central nodes (called hubs) which serve as a higher-level star for the central nodes.
  2. Leaf nodes linked to the hubs in a star-like manner.
  3. Multiple layers in which the hubs themselves may be linked to other hubs and the architecture may grow in tiers, resembling a hierarchy.

OMNeT++ offers the flexibility to pattern like complex topologies, in which we can explain the layers of hubs and their associated leaf nodes. Here’s a step-by-step guide to help you set up a Hierarchical Star Topology project:

Steps to Start Hierarchical Star Topology Projects Using OMNeT++

  1. Install OMNeT++

If OMNeT++ is not yet installed on your system, we can download it from the official website and follow the installation procedures: OMNeT++ Download.

  1. Create a New OMNeT++ Project
  1. Open OMNeT++ IDE.
  2. Select to File > New > OMNeT++ Project.
  3. Choose the Simple Network as the project template.
  4. Name your project (e.g., HierarchicalStarTopology).
  5. Click Finish to create the new project.
  1. Define the Hierarchical Star Topology in NED Files

In OMNeT++, the topology is state using NED files (Network Description). Here’s how to define a Hierarchical Star Topology.

Example: HierarchicalStar.ned

This sample builds a 3-level hierarchical star network by one central hub at the top level, that has multiple sub-hubs (lower-level hubs), and every of those hubs is linked to leaf nodes.

network HierarchicalStar

{

parameters:

int numHubs = 3;  // Number of hubs at each level

int numLeafNodes = 3;  // Number of leaf nodes per hub

submodules:

// Level 1 Hub (Central Hub)

hub1: Hub;

// Level 2 Hubs (Connected to Level 1 Hub)

hub2[numHubs]: Hub;

// Level 3 Leaf Nodes (Connected to Level 2 Hubs)

leafNode[numHubs * numLeafNodes]: LeafNode;

connections:

// Connect the central hub (level 1) to the level 2 hubs

hub1.out –> hub2[0].in;

hub1.out –> hub2[1].in;

hub1.out –> hub2[2].in;

// Connect each level 2 hub to its leaf nodes (level 3)

for i=0..numHubs-1 {

for j=0..numLeafNodes-1 {

hub2[i].out –> leafNode[i*numLeafNodes + j].in;

}

}

}

Explanation of the NED File:

  • numHubs: The number of hubs at every level for the process.
  • numLeafNodes: The amount of leaf nodes are linked to every hub.
  • hub1: The central hub at level 1 that linked the level 2 hubs.
  • hub2[]: These signify the level 2 hubs for every linked to numLeafNodes leaf nodes at level 3.
  • leafNode[]: These characterize the leaf nodes are linked to the second-level hubs.

Every Hub module links to the respective hubs and leaf nodes using out and in gates.

  1. Define Hub and LeafNode Modules

Next, we require to necessity of behavior for the Hub and LeafNode in C++. This component will maintain the packet reception and transmission.

Example: Hub.ned

simple module Hub

{

parameters:

@display(“i=device/router”);

gates:

input in;

output out;

}

Example: LeafNode.ned

simple module LeafNode

{

parameters:

@display(“i=device/sensor”);

gates:

input in;

output out;

}

In this example, both Hub and LeafNode are simple modules by input (in) and output (out) gates. The Hub component is expected to transmit the packets and we linked the hubs or leaf nodes, and the LeafNode module is a simple destination which can receive packets.

  1. Define Behavior in C++ (Handle Packet Transmission)

Presently, write the C++ code we handle the packet transmission in every module.

Example: Hub.cc

#include <omnetpp.h>

class Hub : public cSimpleModule

{

protected:

virtual void initialize() override;

virtual void handleMessage(cMessage *msg) override;

};

Define_Module(Hub);

void Hub::initialize()

{

// Initialize module state

}

 

void Hub::handleMessage(cMessage *msg)

{

// Forward the message to the connected hub or leaf node

send(msg, “out”);

}

Example: LeafNode.cc

#include <omnetpp.h

class LeafNode : public cSimpleModule

{

protected:

virtual void initialize() override;

virtual void handleMessage(cMessage *msg) override;

};

Define_Module(LeafNode);

void LeafNode::initialize()

{

// Initialize module state

}

void LeafNode::handleMessage(cMessage *msg)

{

// Simply print received message (or process it)

EV << “LeafNode ” << getIndex() << ” received message: ” << msg->getName() << “\n”;

delete msg;  // Clean up the message after handling

}

Explanation:

  • Hub: The Hub module transmits the received communication to the outcome of gate (out).
  • LeafNode: The LeafNode simply receives communication and can be design the dat or take movements.
  1. Configure Simulation Parameters in omnetpp.ini

We need to set the replication setup like as the duration replication limit and transmission delays.

Example: omnetpp.ini

[General]

network = HierarchicalStar

sim-time-limit = 100s

**.hub*.out.delay = 0.5s

**.leafNode*.out.delay = 0.5s

  • sim-time-limit: Limits the replication duartion to 100 seconds.
  • delay: Setting the communication for delay the hubs and leaf nodes.
  1. Compile the Project

Once you have built a NED and C++ files, build your project:

  1. Right-click the project in the Project Explorer and choose the Build Project.
  2. OMNeT++ will compile the project and generate the executable.
  1. Run the Simulation

Next create the project, process the replication:

  1. Right-click on the project and choose Run As > OMNeT++ Simulation.
  2. It initializes the replication, and we can follow on how the packets are transmitted by the hierarchical star topology.
  1. Visualize and Analyze Results

We can envision for replication and examine the performance using the OMNeT++ GUI or scavetool.

  • Simulation GUI: Follow the network dynamics and packet flow.
  • Results Analysis: Examine the performance parameter metrics such as packet delivery time, throughput, and network effectiveness.
  1. Extend the Simulation

After we have the essential for hierarchical star topology setting, we can extend the replication with:

  • Customizing Routing Algorithms: Apply the several routing mechanisms for packet forwarding.
  • Traffic Models: Research by various designs for the congestion such as bursty, random, etc. estimate the network performance.
  • Failure Simulation: Improve the connection/node failure designs to validate the network robustness.
  • QoS and Priority Handling: Apply the Quality of Service (QoS) for various kinds of congestion.

At the end of this manual, we clearly explained and deliver the details and shown examples of how to simulate Hierarchical star Topology projects in OMNeT++ tool by using the above discussed techniques. If clarification is needed, it will be included in an additional project manual.