How to send messages on a radioMedium

283 views
Skip to first unread message

Shesha Sreenivasamurthy

unread,
Aug 25, 2022, 2:26:47 AM8/25/22
to OMNeT++ Users
I am very new to Inet and omnet. My goal is to send messages between  myhost[0] -> myshos[1] using 802.11 radioMedium. So I have created the following files.
I have implemented simplehost.cc and simplehost.h with initialize and handleMessage function. I am missing the part where the messages should go form myhost[0] -> Medium -> myhost[1] and viceversa. Can anyone give me some suggestions ?

=========
NED
========
simple SimpleHost
{
parameters:
gates:
input in;
output out;
}

network Wireless
{
parameters:
types:
submodules:
radioMedium: Ieee80211ScalarRadioMedium;
myhosts[2]: SimpleHost;
connections:
// I don't know how to connect gates to of my simpleHost to radioMedium
}

==============
omnetpp.ini
===============

[General]
network = Wireless
description = Two hosts communicating wirelessly

[Config Ieee80211ScalarRadioMedium]
description = "802.11 radio"

Shesha Sreenivasamurthy

unread,
Aug 28, 2022, 2:07:09 PM8/28/22
to OMNeT++ Users
I made some progress. But still have issues ... With the following setup, The network initializes ok but when I send message, I get the following error.

<!> Unsupported command -- in module (inet::physicallayer::Ieee80211Radio) WirelessNetwork.hostA.wlan[0].radio (id=60), at t=0s, event #1

Can anyone please help me here ?


===========
NED
==========
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.physicallayer.wireless.common.contract.packetlevel.IRadioMedium;
import inet.node.inet.WirelessHost;
import inet.visualizer.canvas.integrated.IntegratedCanvasVisualizer;
import inet.physicallayer.wireless.common.contract.packetlevel.IRadio;

simple SimpleHost
{
parameters:
gates:
input in @directIn;
output out;
}

network WirelessNetwork
{
parameters:
@display("bgb=600,600");
//numWlanInterfaces = default(1);
submodules:
visualizer: IntegratedCanvasVisualizer;
configurator: Ipv4NetworkConfigurator;
// UnitDiskRadioMedium Ieee80211RadioMedium
radioMedium: <default("Ieee80211RadioMedium")> like IRadioMedium {
@display("p=263.344,135.296");
}
// radio: <default("Ieee80211Radio")> like IRadio {
// @display("p=41,74");
// }
hostA: WirelessHost {
@display("p=60,195");
}
hostB: WirelessHost {
@display("p=450,195");
}
shostA: SimpleHost {
@display("p=60,350");
}
shostB: SimpleHost {
@display("p=450,350");
}
connections:
shostA.out --> hostA.radioIn++;
shostB.out --> hostB.radioIn++;
}

===============
omnetpp.ini
==============
[General]
description = Simple sim where two host communicate wirelessly
network = WirelessNetwork
sim-time-limit = 60s

*.host*.ipv4.arp.typename = "GlobalArp"
# WLAN Configuration
*.host*.wlan[0].typename = "AckingWirelessInterface"
*.host*.wlan[0].mac.useAck = false
*.host*.wlan[0].mac.fullDuplex = false
*.host*.wlan[0].radio.transmitter.communicationRange = 500m
*.host*.wlan[0].radio.receiver.ignoreInterference = true
*.host*.wlan[0].mac.headerLength = 23B
*.radioMedium.typename = "Ieee80211RadioMedium"
*.host*.wlan[0].radio.typename = "Ieee80211Radio"

*.host*.**.bitrate = 1Mbps

# Visualizer Configuration
**.radio.displayCommunicationRange = true
*.visualizer.mediumVisualizer.displaySignals = true
*.visualizer.physicalLinkVisualizer.displayLinks = true
*.visualizer.physicalLinkVisualizer.packetFilter = "UDPData*"
*.visualizer.mobilityVisualizer.displayVelocities = true
*.visualizer.mobilityVisualizer.displayMovementTrails = true

# Add Mobility to Hosts
*.hostA.mobility.typename = "LinearMobility"
*.hostA.mobility.speed = 0.1mps
*.hostA.mobility.initialMovementHeading = 200deg

==============
SimpleHost.cc
===============

void SimpleHost::initialize()
{
msgId = 0;

printf("********** NAME %s ***********\n", getName());
printf("HAS GATES %d\n", hasGates());

vector<string> mygates = getGateNames();
for (auto i = mygates.begin(); i != mygates.end(); ++i)
printf("GATES %s\n", (*i).c_str());

if (strcmp("shostA", getName()) == 0)
{
printf("I’m host 0, sending initial message\n");
inet::cMessage *msg = new inet::cMessage("InitialMsg");
send(msg, "out");
}
}

void SimpleHost::handleMessage(inet::cMessage *msg)
{
char msgStr [32];
printf("Received message ‘%s'\n", msg->getName());
printf("********** NAME 1 %s ***********\n", getName());
if (strcmp("shostA", getName()) == 0)
{
printf("I’m host 0, sending the message\n");
sprintf(msgStr, "HOSTA-MSG-%d", msgId++);
}
else if (strcmp("shostB", getName()) == 0)
{
printf("I’m host 1, sending the message\n");
sprintf(msgStr, "HOSTB-MSG-%d", msgId++);
}
inet::cMessage *newMsg = new inet::cMessage(msgStr);
send(newMsg, "out");
delete msg;
}

Alfonso Ariza Quintana

unread,
Aug 29, 2022, 4:00:04 AM8/29/22
to omn...@googlegroups.com
You are using the 802.11 radio with a mac that doesn't support this radio.
*.host*.wlan[0].typename = "AckingWirelessInterface" # here you select the interface type (mac and radio type)
*.host*.wlan[0].radio.typename = "Ieee80211Radio"  # Now you change the radio to 802.11 radio type



De: omn...@googlegroups.com <omn...@googlegroups.com> en nombre de Shesha Sreenivasamurthy <she...@gmail.com>
Enviado: domingo, 28 de agosto de 2022 20:07
Para: OMNeT++ Users <omn...@googlegroups.com>
Asunto: [Omnetpp-l] Re: How to send messages on a radioMedium
 
--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/5e977544-c453-4020-a8ed-d03becf9d89cn%40googlegroups.com.

Shesha Sreenivasamurthy

unread,
Aug 29, 2022, 9:52:08 AM8/29/22
to omn...@googlegroups.com
Thanks Alfonso.

I want to use 802.11. Where can I find compatible interfaces (Mac) for this radio type ?

Thanks,
Shesha

On Aug 29, 2022, at 1:00 AM, Alfonso Ariza Quintana <aari...@hotmail.com> wrote:


You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/rBNyxXMcxfM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/AM6PR0602MB3383123C4E4D9CF7917286848C769%40AM6PR0602MB3383.eurprd06.prod.outlook.com.
Reply all
Reply to author
Forward
0 new messages