Implementing vertical handover in OMNeT++ involves several steps, including setting up the simulation environment, defining network and node models, implementing handover algorithms, and running the simulation. Vertical handover refers to the process of switching between different types of networks (e.g., from WiFi to LTE).
Step-by-Step Implementation:
Step 1: Install OMNeT++ and INET Framework
Step 2: Set Up Your Project
Step 3: Define Network Models Using NED
package handover;
import inet.node.inet.StandardHost;
import inet.node.wireless.AccessPoint;
import inet.node.cellular.cellular.NetworkNode;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.mobility.static.StaticMobility;
import inet.mobility.single.RandomWaypointMobility;
import inet.linklayer.ethernet.EthernetInterface;
import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
network VerticalHandoverNetwork
{
parameters:
int numHosts = default(5);
types:
channel radioChannel extends Ieee80211ScalarRadioMedium {}
submodules:
configurator: Ipv4NetworkConfigurator {
@display(“p=100,100”);
}
wifiAp: AccessPoint {
@display(“p=300,200”);
}
lteNode: NetworkNode {
@display(“p=500,200”);
}
host[numHosts]: StandardHost {
@display(“p=200+100*i,400”);
}
radioMedium: radioChannel {
@display(“p=400,100”);
}
connections:
for i=0..numHosts-1 {
host[i].ethg++ <–> radioMedium <–> wifiAp.wlan++;
host[i].ethg++ <–> radioMedium <–> lteNode.cellular++;
}
}
Step 4: Implement Handover Logic in C++
#include <omnetpp.h>
#include “inet/common/ModuleAccess.h”
#include “inet/networklayer/contract/ipv4/Ipv4Address.h”
#include “inet/applications/udpapp/UdpBasicApp.h”
#include “inet/linklayer/common/MacAddress.h”
using namespace omnetpp;
using namespace inet;
class HandoverHost : public cSimpleModule
{
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void performHandover();
void connectToWiFi();
void connectToLTE();
};
Define_Module(HandoverHost);
void HandoverHost::initialize()
{
// Initialization code
// Schedule handover check
scheduleAt(simTime() + par(“handoverCheckInterval”), new cMessage(“checkHandover”));
}
void HandoverHost::handleMessage(cMessage *msg)
{
if (strcmp(msg->getName(), “checkHandover”) == 0) {
performHandover();
scheduleAt(simTime() + par(“handoverCheckInterval”), msg);
}
}
void HandoverHost::performHandover()
{
// Perform handover decision based on criteria (e.g., signal strength, QoS)
// Example logic: If WiFi signal is weak, switch to LTE
double wifiSignalStrength = uniform(0, 1); // Placeholder for actual signal strength check
if (wifiSignalStrength < 0.5) {
connectToLTE();
} else {
connectToWiFi();
}
}
void HandoverHost::connectToWiFi()
{
// Code to connect to WiFi
EV << “Connecting to WiFi” << endl;
// Placeholder for actual WiFi connection logic
}
void HandoverHost::connectToLTE()
{
// Code to connect to LTE
EV << “Connecting to LTE” << endl;
// Placeholder for actual LTE connection logic
}
network VerticalHandoverNetwork
{
parameters:
int numHosts = default(5);
types:
channel radioChannel extends Ieee80211ScalarRadioMedium {}
submodules:
configurator: Ipv4NetworkConfigurator {
@display(“p=100,100”);
}
wifiAp: AccessPoint {
@display(“p=300,200”);
}
lteNode: NetworkNode {
@display(“p=500,200”);
}
host[numHosts]: HandoverHost {
@display(“p=200+100*i,400”);
}
radioMedium: radioChannel {
@display(“p=400,100”);
}
connections:
for i=0..numHosts-1 {
host[i].ethg++ <–> radioMedium <–> wifiAp.wlan++;
host[i].ethg++ <–> radioMedium <–> lteNode.cellular++;
}
}
Step 5: Configure Simulation Parameters
network = VerticalHandoverNetwork
sim-time-limit = 10s
**.handoverCheckInterval = 1s
Step 6: Build and Run the Simulation
Step 7: Analyse Results
This script demonstrate how to simulate the complete projects in OMNet++ for vertical handover that has generates the topology then apply the handover logic to deploy in the application to analyse the results. We also describe how the vertical handover is carried out with simulation and performance analysis support.