How to start Mixed Topology projects using OMNeT++
To start a Mixed Topology project in OMNeT++, we will design a network that integrates several categories of topologies, like as an association for star, ring, bus, or mesh networks. This type of topology can be useful in replication in which several type of network links coexist, like as hybrid network architectures, multi-layer networks, or heterogeneous communication systems.
Here’s a step-by-step guide to creating a Mixed Topology project using OMNeT++:
Steps to start Mixed Topology projects using OMNeT++
- Install OMNeT++
If you have not installed OMNeT++ previously, download and install it from the official OMNeT++ website. Observe the installation procedures based on your platform.
- Create a New OMNeT++ Project
- Start OMNeT++ IDE.
- Choose File > New > OMNeT++ Project.
- Select Simple Network as the template.
- It offers the name for your project, such as MixedTopology.
- Click Finish to create the new project.
- Define the Mixed Topology in NED Files
In this step, we will explain the Mixed Topology using NED (Network Description) files. For sample, you might have a star topology linked to a mesh topology, or associate the bus and ring topologies in a single network.
Example: MixedTopology.ned
ned
Copy code
network MixedTopology
{
submodule centralHub: NetworkNode;
submodule node1: NetworkNode;
submodule node2: NetworkNode;
submodule node3: NetworkNode;
submodule node4: NetworkNode;
submodule node5: NetworkNode;
submodule node6: NetworkNode;
submodule node7: NetworkNode;
submodule node8: NetworkNode;
connections:
// Star topology (central hub with multiple nodes)
centralHub.out –> node1.in;
centralHub.out –> node2.in;
centralHub.out –> node3.in;
centralHub.out –> node4.in;
centralHub.out –> node5.in;
// Mesh topology (connections between nodes)
node6.out –> node7.in;
node6.out –> node8.in;
node7.out –> node8.in;
node7.out –> node6.in;
node8.out –> node6.in;
// Mixed connection between star and mesh nodes
node1.out –> node6.in;
node2.out –> node7.in;
node3.out –> node8.in;
}
simple module NetworkNode
{
parameters:
@display(“i=device/server”);
gates:
input in;
output out;
}
Explanation of the NED File:
- MixedTopology: Outline the overall network through together star and mesh topologies.
- centralHub: Characterize the central hub in a star topology.
- node1 to node5: Nodes are associated to the central hub such as forming a star.
- node6 to node8: Nodes are linked in a mesh topology like as fully connected with each other.
- connections:
- The star topology links the central hub for instance centralHub to several nodes for sample node1 to node5.
- The mesh topology links the node6, node7, and node8 in a fully connected manner, in which every node is connected to each other.
- Mixed connections among nodes for the star topology and the mesh topology permits to replicate the hybrid network interactions.
- Implement Node Behavior in C++
Next describing the network topology in NED, we will apply the behavior of every node using C++. The nodes will maintain the message transmissions, receiving messages, and sending them as appropriate according to the topology.
Example: NetworkNode.cc
#include <omnetpp.h>
class NetworkNode : public cSimpleModule
{
private:
cMessage *msg; // Message object for transmission
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void transmitData();
void receiveData(cMessage *msg);
public:
~NetworkNode();
};
Define_Module(NetworkNode);
void NetworkNode::initialize()
{
msg = new cMessage(“dataMessage”);
if (getIndex() == 0) {
transmitData(); // Start transmitting from node 0 (for example)
}
}
void NetworkNode::handleMessage(cMessage *msg)
{
if (msg == this->msg) {
// Transmit data to other nodes
transmitData();
} else {
// Handle received messages (printing them for now)
receiveData(msg);
}
}
void NetworkNode::transmitData()
{
cMessage *newMsg = new cMessage(“data”);
int nextNode = (getIndex() + 1) % 5; // Circular transmission (next node)
send(newMsg, “out”, nextNode); // Send to the next node in the network
// Simulate periodic transmission
scheduleAt(simTime() + 1.0, msg);
}
void NetworkNode::receiveData(cMessage *msg)
{
EV << “Node ” << getIndex() << ” received data: ” << msg->getName() << “\n”;
delete msg;
}
NetworkNode::~NetworkNode()
{
cancelAndDelete(msg);
}
Explanation of the C++ Code:
- initialize(): Every node initialize the transmitting data after the replication starts. The transmission begins from node 0.
- handleMessage(): Maintain the received messages. Designed for simplicity, the nodes just sending the message.
- transmitData(): This process maintain the periodic transmission of data to other nodes. In this sample, nodes forward messages to the next node in a cyclic manner such as circular.
- receiveData(): This technique basic patterns out the received data for currently. In an additional advanced replication, we would likely run the data or route it according to the topology.
- Destructor: Drop and eliminate the message after the node is complete by it.
- Configure Simulation Parameters
After the nodes and network are setting, the replication parameters are set-up in the omnetpp.ini setting file. We can require things such the replication duration, message intervals, and other parameters.
Example: omnetpp.ini
[General]
network = MixedTopology
sim-time-limit = 100s
**.node*.messageInterval = 1s
**.node*.out.delay = 0.5s
Explanation:
- network: Detailed the NED file to use for sample MixedTopology.ned.
- sim-time-limit: Expresses the maximum number of replication duration such as100 seconds in this case.
- messageInterval: Requires the interval among the message transmissions for every node like as 1 second.
- out.delay: Group of delay on the outgoing communication for every node such as 0.5 seconds.
- Compile the Project
Next important the NED and C++ files, compile the project:
- Right-click on your project and choose Build Project.
- OMNeT++ will compile the code, and an executable will be created.
- Run the Simulation
We process for the replication:
- Right-click on the project folder and choose Run As > OMNeT++ Simulation.
- The replication will initialize, and we can follow on how messages broadcast over the varied topology. We can see the replication outcomes in real-time using OMNeT++’s replication GUI.
- Analyze Results
Next replicate the process, we can examine the outcomes using OMNeT++’s built-in tools:
- Simulation GUI: We can envision the flow for communication and nodes’ behaviors.
- Scavetool: Use this tool we examine the replication of outcomes like as communication delivery duration, message loss, or throughput.
- Extend the Simulation
We improve the various topology replication, you can:
- Add Different Traffic Types: various kinds of designs for the data congestion for sample control messages, data messages among many topologies.
- Fault Tolerance: Replicate the failures in part of the network such as node failures or link failures and view on how the network adapts.
- Advanced Routing: Apply modify the routing procedure according to the mixed topology, considering various paths, congestion, and latency.
- Performance Metrics: Enhance further performance metrics, like as throughput, packet loss, and network latency.
By following these steps, you’ll be able to create and simulate a Mixed Topology in OMNeT++ involving various network topologies such as star, mesh, and ring. This can be extended for more complex scenarios and offer insights into how different types of networks interact within a single simulation.
In this presented manual elaborately provide the complete procedures to help you to simulate the Mixed Topology over the network using the tool of OMNeT++. Further information concerning this process is provided in additional script.