Problem with dynamic creation of MobileManetRoutingHost

97 views
Skip to first unread message

Eric Gamess

unread,
Jun 28, 2011, 4:09:05 PM6/28/11
to omnetpp
Hello,

My goal is to study the behavior of AODV in a 3x3 grid network, that
is, there are
9 wireless stations that are positioned on a grid and separated by 200
meters.
The stations are static. There is only one source station and one
destination
station. Source and destination stations are specified at run time
(the user
enter the ID of the source and the ID of the destination, a number
between 0 and 8).
I am putting the files bellow. The Controller module is in charge of
creating the stations.

When I run it as it is (source=2 and destination=3), I receive an
error message
that say "AdHocNetwork.sta[1].networkLayer.ifIn[0].channel not
initialized. Did you
forget to invoke callInitialize() ... "

So, I commented out the for-loop that is in the bottom of file
Controller.cc to
force the call of the initialize method. When I run it now, I have
another
error message "initialize() already call for this module"

Any idea???? Thank you for helping.

My array "sta" has three types of module (MyWirelessHost,
MyWirelessHostSrc,
and MyWirelessHostDst). Is this a problem???? These types are all
derived from
MobileManetRoutingHost.

Eric.

----------------- omnetpp.ini
[General]
network = AdHocNetwork
tkenv-plugin-path = ../../../etc/plugins
**.debug = true
**.coreDebug = false

AdHocNetwork.src = ask
AdHocNetwork.dst = ask

# parameters: AODV
**.wait_on_reboot = 0

----------------- MyNedFile.ned
package inet.examples.eric27;

import inet.world.ChannelControlExtended;
import inet.nodes.adhoc.MobileManetRoutingHost;
import inet.networklayer.autorouting.FlatNetworkConfigurator;


simple Controller
{
parameters:
@display("i=block/control_s");
}


module MyWirelessHost extends MobileManetRoutingHost
{
parameters:
manetrouting.manetmanager.routingProtocol = "AODV";

mobilityType = "NullMobility";

wlan.mgmt.frameCapacity = 10;

wlan.mac.maxQueueSize = 14;
wlan.mac.bitrate = 54.0 Mbps;
wlan.mac.basicBitrate = 6.0 Mbps;
wlan.mac.rtsThresholdBytes = 2346 B;
wlan.mac.retryLimit = 7;
wlan.mac.cwMinData = 7;
wlan.mac.cwMinBroadcast = 31;

wlan.radio.channelNumber = 0;
wlan.radio.transmitterPower = 2.0 mW;
wlan.radio.bitrate = 54.0 Mbps;
wlan.radio.thermalNoise = -110.0 dBm;
wlan.radio.pathLossAlpha = 2.0;
wlan.radio.shadowingDeviation = 0.0 dB;
wlan.radio.snirThreshold = 4.0 dB;
wlan.radio.sensitivity = -90.00 dBm;

@display("r=,,#707070");
@display("i=device/pocketpc_s");
}


module MyWirelessHostSrc extends MyWirelessHost
{
parameters:
numUdpApps = 1;
udpAppType = "UDPBasicApp";
udpApp[0].localPort = 3000;
udpApp[0].destPort = 3000;
udpApp[0].messageLength = 1000 B;
udpApp[0].messageFreq = 10.0 s;
udpApp[0].destAddresses = ""; // I WILL PUT THE DESTINATION
AFTER,
// ONCE THE USER
SPECIFIES IT
}


module MyWirelessHostDst extends MyWirelessHost
{
parameters:
numUdpApps = 1;
udpAppType = "UDPSink";
udpApp[0].localPort = 3000;
}


network AdHocNetwork
{
parameters:
int sizeOfGrid = 3;
int src;
int dst;
double playgroundSizeX = 200*(sizeOfGrid-1)+200;
double playgroundSizeY = 200*(sizeOfGrid-1)+250;

submodules:
channelcontrol: ChannelControlExtended
{
parameters:
playgroundSizeX = playgroundSizeX;
playgroundSizeY = playgroundSizeY;

pMax = 2.0 mW;
sat = -110.0 dBm;
alpha = 2.0;
carrierFrequency = 2.4 GHz;
numChannels = 1;

@display("p=200,50");
}

configurator: FlatNetworkConfigurator
{
parameters:
networkAddress = "190.169.74.0";
netmask = "255.255.255.0";
@display("p=400,50");
}

controller: Controller
{
parameters:
@display("p=550,50");
}

connections allowunconnected:
}


----------------- Controller.cc
#include <omnetpp.h>


class Controller : public cSimpleModule
{
public:
virtual void initialize();
};

Define_Module(Controller);


void Controller::initialize()
{
int src=getParentModule()->par("src");
int dst=getParentModule()->par("dst");
int sizeOfGrid=getParentModule()->par("sizeOfGrid");

cModuleType *otherType, *srcType, *dstType;
otherType=cModuleType::get("inet.examples.eric27.MyWirelessHost");
srcType=cModuleType::get("inet.examples.eric27.MyWirelessHostSrc");
dstType=cModuleType::get("inet.examples.eric27.MyWirelessHostDst");
int total=sizeOfGrid*sizeOfGrid;
cModule **array=new cModule*[total];

for(int index=0; index<total; index++)
{
int row=index/sizeOfGrid;
int col=index%sizeOfGrid;
double x=100.0+200.0*col; // x-position of sta[index]
double y=150.0+200.0*row; // y-position of sta[index]
cModule *sta;

if(index==src)
{ // Creation of the source sta
sta=srcType->create("sta", getParentModule(), total, index);
sta->finalizeParameters();
sta->buildInside();

// char destString[100];
// sprintf(destString, "sta[%d]", dst);
// cPar &par=sta->getSubmodule("udpApp", 0)-
>par("destAddresses");
// par.setStringValue(destString);
}
else if(index==dst)
{ // Creation of the destination
sta
sta=dstType->create("sta", getParentModule(), total, index);
sta->finalizeParameters();
sta->buildInside();
}
else
{ // Creation of other sta
sta=otherType->create("sta", getParentModule(), total,
index);
sta->finalizeParameters();
sta->buildInside();
}

// Changing the coordinates of sta[index]
cModule *mobility=sta->getSubmodule("mobility");
mobility->par("x")=x;
mobility->par("y")=y;

array[index]=sta;
}


// DOES NOT WORK EVEN IF I UNCOMMENT THIS FOR-LOOP
// for(int index=0; index<total; index++)
// array[index]->callInitialize();

// Specify the destination of the UDP datagram
char destString[100];
sprintf(destString, "sta[%d]", dst);
cPar &par=array[src]->getSubmodule("udpApp", 0)-
>par("destAddresses");
par.setStringValue(destString);

delete array;
}

Alfonso Ariza Quintana

unread,
Jun 29, 2011, 7:29:01 AM6/29/11
to omn...@googlegroups.com
sta->scheduleStart(simTime());


-----Mensaje original-----
From: Eric Gamess
Sent: Tuesday, June 28, 2011 10:09 PM
To: omnetpp
Subject: [Omnetpp-l] Problem with dynamic creation of MobileManetRoutingHost

Hello,

Eric.

----------------- MyNedFile.ned
package inet.examples.eric27;

mobilityType = "NullMobility";

wlan.mgmt.frameCapacity = 10;

@display("p=200,50");
}

connections allowunconnected:
}


----------------- Controller.cc
#include <omnetpp.h>

Define_Module(Controller);

array[index]=sta;
}

delete array;
}

--
You received this message because you are subscribed to the Google Groups
"omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to
omnetpp+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/omnetpp?hl=en.

Eric Gamess

unread,
Jun 29, 2011, 12:18:54 PM6/29/11
to omnetpp
Hi Alfonso,

Thank you for your answer.

> sta->scheduleStart(simTime());

I tried your solution, and I had the same problem. I put sta-
>scheduleStart(simTime()); in the main FOR-LOOP, just after changing
the mobility coordinates, and I had the same problem
"AdHocNetwork.sta[1].networkLayer.ifIn[0].channel not initialized. Did
you forget to invoke callInitialize() ... "

I also put the following FOR-LOOP instead of the one that is commented
(second FOR-LOOP), and I had the same problem
"AdHocNetwork.sta[5].networkLayer.ifIn[0].channel not initialized. Did
you forget to invoke callInitialize() ... "

for(int index=0; index<total; index++)
array[index]->scheduleStart(simTime());

Any other idea???? I think I need to do a multi-stages initialization.
For example, I need to be sure that IP addresses are assigned by
FlatNetworkConfigurator to the stations before I try to initialize the
stations, because the source station need to resolve "sta[dst]" to an
IP address at initialization time. Any help????

Thank you very much.

Eric.

Eric Gamess

unread,
Jun 29, 2011, 5:53:31 PM6/29/11
to omnetpp
Hi all,

I just observed a difference!!!!

In the initialization of my dynamic stations, something is missing.
Here it is part of the initialization of a dynamic station:
Initializing module AdHocNetwork.sta[0], stage 0
Initializing module AdHocNetwork.sta[0].notificationBoard, stage 0
Initializing module AdHocNetwork.sta[0].interfaceTable, stage 0
Initializing module AdHocNetwork.sta[0].routingTable, stage 0

When the stations are created manually, I have one additional line at
the beginning (the first line):
Initializing channel AdHocNetwork.sta[0].networkLayer.ifIn[0].channel,
stage 0
Initializing module AdHocNetwork.sta[0], stage 0
Initializing module AdHocNetwork.sta[0].notificationBoard, stage 0
Initializing module AdHocNetwork.sta[0].interfaceTable, stage 0
Initializing module AdHocNetwork.sta[0].routingTable, stage 0

So, what is happening???? Why the dynamic version does not have this
initial line????
Thank you for your response.

Eric.

Mauricio

unread,
Nov 25, 2015, 10:40:05 AM11/25/15
to OMNeT++ Users
Hi Eric,

Do you found the solution? I'm having the same problem!
Reply all
Reply to author
Forward
0 new messages