To implement the Delay-Tolerant Network (DTN) data management in OMNeT++, it requires a scenario in which the data will handle and transmit through the network that can experience occasional connectivity, high latency or partitioned communication paths. We can operate this design in environment like traditional network protocols flops because of long delays or regular disconnections. Stay in touch with omnet-manual.com for good guidance.
Here, we present the step-by-step guide on how to implement DTN data management in OMNeT++ using the INET framework:
Step-by-Step Implementation:
Set up a network topology where nodes may become disconnected or have periodical connectivity. These nodes will execute DTN protocols for handling and transferring data.
Example NED File (DTNNetwork.ned):
package mynetwork;
import inet.node.inet.StandardHost;
import inet.mobility.static.StaticMobility;
network DTNNetwork
{
parameters:
int numNodes = default(5); // Number of DTN nodes
submodules:
dtnNode[numNodes]: StandardHost {
@display(“p=100,100;is=square,red”);
}
}
In this example:
Executing DTN data management by generating new module which contains defining how data is stored, forwarded, and retransmitted over nodes, even in the presence of delays and disruptions.
Example: DTN Data Management Protocol (DTNProtocol.ned)
package mynetwork;
import inet.applications.base.ApplicationBase;
simple DTNProtocol extends ApplicationBase
{
gates:
input upperLayerIn;
output upperLayerOut;
input lowerLayerIn;
output lowerLayerOut;
}
DTNProtocol.cc (Basic Implementation)
#include “inet/common/INETDefs.h”
#include “inet/applications/base/ApplicationBase.h”
#include “inet/common/queue/FIFOQueue.h”
Define_Module(DTNProtocol);
void DTNProtocol::initialize(int stage) {
ApplicationBase::initialize(stage);
if (stage == INITSTAGE_LOCAL) {
storageCapacity = par(“storageCapacity”).intValue();
maxRetries = par(“maxRetries”).intValue();
dataQueue = new cQueue(“dataQueue”);
retryCounter = 0;
}
}
void DTNProtocol::handleMessageWhenUp(cMessage *msg) {
if (msg->isSelfMessage()) {
handleSelfMessage(msg);
} else if (msg->getArrivalGate() == upperLayerIn) {
storeData(msg);
} else {
handleLowerLayerMessage(msg);
}
}
void DTNProtocol::storeData(cMessage *msg) {
if (dataQueue->getLength() < storageCapacity) {
dataQueue->insert(msg);
EV << “Data stored in DTN node. Queue size: ” << dataQueue->getLength() << “\n”;
} else {
EV << “Storage full. Dropping data.\n”;
delete msg; // Drop the message if storage is full
}
}
void DTNProtocol::handleSelfMessage(cMessage *msg) {
if (!dataQueue->isEmpty()) {
cMessage *dataMsg = check_and_cast<cMessage *>(dataQueue->pop());
sendData(dataMsg);
}
scheduleAt(simTime() + 1, msg); // Schedule the next transmission attempt
}
void DTNProtocol::sendData(cMessage *msg) {
if (canTransmit()) {
sendDown(msg);
retryCounter = 0; // Reset retry counter on successful transmission
} else {
dataQueue->insertBefore(msg, dataQueue->head()); // Reinsert the message at the front of the queue
retryCounter++;
if (retryCounter > maxRetries) {
EV << “Max retries reached. Dropping data.\n”;
delete msg;
retryCounter = 0;
}
}
}
void DTNProtocol::handleLowerLayerMessage(cMessage *msg) {
// Handle data received from other DTN nodes
EV << “Data received at DTN node: ” << msg->getName() << “\n”;
processReceivedData(msg);
}
void DTNProtocol::processReceivedData(cMessage *msg) {
// Example: Store received data or forward it based on some logic
if (dataQueue->getLength() < storageCapacity) {
dataQueue->insert(msg);
} else {
EV << “Storage full, processing or dropping received data.\n”;
delete msg;
}
}
bool DTNProtocol::canTransmit() {
// Placeholder for actual transmission logic (e.g., check for connectivity)
return uniform(0, 1) > 0.5; // Randomly allow transmission in this example
}
In this example:
In the omnetpp.ini file, we need to setup the simulation to use the custom DTN protocol.
Example Configuration in omnetpp.ini:
network = DTNNetwork
**.dtnNode[*].applications[0].typename = “DTNProtocol”
**.dtnNode[*].applications[0].storageCapacity = 10
**.dtnNode[*].applications[0].maxRetries = 3
Run the simulation and observe the DTN data management process. You can trail metrics like the number of successfully transmitted data packets, the amount of data stored in queues, and the number of reattempts.
Example Configuration for Monitoring Metrics:
network = DTNNetwork
**.dtnNode[*].applications[0].numDataStored.recordScalar = true
**.dtnNode[*].applications[0].numDataTransmitted.recordScalar = true
**.dtnNode[*].applications[0].numRetries.recordScalar = true
This configuration logs the number of data packets stored, transmitted, and retried, helping you assess the efficiency of the DTN protocol.
After running the simulation, define the efficiency of the DTN protocol by evaluating the outputs. Consider factors such as:
You can extend the simple DTN protocol with additional features like:
Example: Priority-based Data Management
void DTNProtocol::storeData(cMessage *msg) {
// Check priority before storing data
int priority = msg->par(“priority”).intValue();
if (priority > priorityThreshold || dataQueue->getLength() < storageCapacity) {
dataQueue->insert(msg);
EV << “Data stored with priority: ” << priority << “\n”;
} else {
EV << “Dropping low-priority data.\n”;
delete msg;
}
}
After completing the simulations, document the DTN strategies examined, the results obtained, and any optimizations made. This will help in understanding the trade-offs involved in handling data in delay-tolerant networks.
In this manual, we guided you by offering the simulation process, executing INET framework’s protocol, assessment steps and finally the extension of techniques which makes it easier to understand the implementation of network DTN data management.