getModuleByPath() Problem

611 views
Skip to first unread message

rport...@gmail.com

unread,
May 1, 2013, 5:05:48 AM5/1/13
to omn...@googlegroups.com
Hi,

My thesis is about creating a routing protocol for a VANET simulation. I have used SUMO 0.13.1 and Omnet++ 4.2.2 along with the interface of inetmanet-2.0.

I am trying the below code to take the current position of a node in a routing table. Can anyone please tell me if I'm doing it correctly?

RoutingTable *N;

N=RoutingTable.get();

        for (int  i = 0; i < N->getNumRoutes()-2; i++)
        {
                cModule *MOD = simulation.getModuleByPath((N->getRoute(i))->getFullPath().c_str());

                srcX = MobilityAccess().get(MOD)->getCurrentPosition().x;
                srcY = MobilityAccess().get(MOD)->getCurrentPosition().y;

                etc....

        }


When I build the project I get errors from the file csma802154.cc (which is part of the inetmanet)  as can be seen by the attached picture.
Are those errors because of that inetmanet file has bugs, or is it because of my coding?
Please, how can I solve these problems?
Is there another way to get the position of a node from its route located in the Routing table?

I would appreciate all the help!



Error.png

Alfonso Ariza Quintana

unread,
May 1, 2013, 7:39:08 AM5/1/13
to omn...@googlegroups.com
https://github.com/aarizaq/inetmanet-2.0/blob/integration/src/util/WirelessNumHops.cc


Date: Wed, 1 May 2013 02:05:48 -0700
From: rport...@gmail.com
To: omn...@googlegroups.com
Subject: [Omnetpp-l] getModuleByPath() Problem
--
--
Sent from the OMNeT++ mailing list. To configure your membership,
visit http://groups.google.com/group/omnetpp
 
---
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Rebecca Portelli

unread,
May 1, 2013, 9:37:02 AM5/1/13
to omn...@googlegroups.com
Hi Alfonso,

Thanks for the reply. I have typed make clean to the directory that inetmanet is in, in the terminal and the problem for getModuleByPath() method went away. I'm not sure if it will give me problems in the future.

However, can you please explain if my code is correct or not?  My intention is that it should check the routing table N and for the current route that the pointer is pointing to, it should get the module of a node from that route. Then it will store the current position x and y into the double variables srcX and srcY respectively.

So is the code above correct to do this please?

Also, I would really like to ask you to help me with running the simulation from the omnetpp.ini file. I'm getting the below error in the console area of inetmanet. There are no problems displayed after the build but the below error keeps coming up for all the examples found in the inetmanet 2.0 software. Can you please tell me what the error means, how to solve it, and how to be able to run my thesis or traci or traci-launchd examples please?

<!> Warning: opp_run: Cannot check library ../../src/inet: ../../src//libinet.so: cannot open shared object file: No such file or directory


<!> Error during startup: Cannot load library '../../src//libinet.so': ../../src//libinet.so: cannot open shared object file: No such file or directory.
OMNeT++ Discrete Event Simulation  (C) 1992-2011 Andras Varga, OpenSim Ltd.
Version: 4.2.2, build: 120327-7947143, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer

End.
Starting...

$ cd /home/user/TESTING/inetmanet-2.0/examples/thesis
$ opp_run -r 0 -c General -n ..:../../src -l ../../src/inet omnetpp.ini


Simulation terminated with exit code: 1
Working directory: /home/user/TESTING/inetmanet-2.0/examples/thesis
Command line: opp_run -r 0 -c General -n ..:../../src -l ../../src/inet omnetpp.ini

Environment variables:
LD_LIBRARY_PATH=/home/user/omnetpp-4.2.2/lib::/home/user/TESTING/inetmanet-2.0/src:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386::/home/user/omnetpp-4.2.2/lib
PATH=/home/user/omnetpp-4.2.2/bin::/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/user/omnetpp-4.2.2/bin
OMNETPP_IMAGE_PATH=/home/user/omnetpp-4.2.2/images


Please I really need your help with this problem in order for me to generate the output that I need for my thesis.


You received this message because you are subscribed to a topic in the Google Groups "omnetpp" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/uavPHeB-5P8/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.

Alfonso Ariza Quintana

unread,
May 1, 2013, 1:36:22 PM5/1/13
to omn...@googlegroups.com

The problem is that the MobilityModule is a module of the node and in simulation.getModuleByPath you need to pass the name of the node,
N->getRoute(i))->getFullPath().c_str() doesn't return the name of the node, the name that can return is related to the entry


Date: Wed, 1 May 2013 15:37:02 +0200
Subject: Re: [Omnetpp-l] getModuleByPath() Problem
From: rport...@gmail.com
To: omn...@googlegroups.com

Rebecca Portelli

unread,
May 2, 2013, 2:41:36 AM5/2/13
to omn...@googlegroups.com
I thought that was the problem.
Any suggestion please to how to get the name of the node from its route in the routing table?

The example of the .cc file that you gave me is related to the cTopology module. How will I be able to pass the current route from the routing table to a type cTopology Node * in order to use getNode() ... I have to know which route belongs to which topology node. But I can't understand how?

Even if instead I try to implement: cModule* mm = getParentModule()->getParentModule()->getSubmodule("node",dest);
where dest is int, and then
TraCIMobilityAccess().get(mm); etc..


I still have to know what dest is, but how can I get that from the route of a routing table?



Alfonso Ariza Quintana

unread,
May 2, 2013, 4:14:28 AM5/2/13
to omn...@googlegroups.com

 

PosNode::PosNode()

{

    // TODO Auto-generated constructor stub

    // fill in routing tables with static routes

    cTopology topo("topo");

    topo.extractByProperty("node");

    cModule *mod = dynamic_cast<cModule*> (getOwner());

    for (mod = dynamic_cast<cModule*> (getOwner())->getParentModule(); mod != 0; mod = mod->getParentModule())

    {

            cProperties *properties = mod->getProperties();

            if (properties && properties->getAsBool("node"))

                break;

    }

    vectorList.clear();

    for (int i = 0; i < topo.getNumNodes(); i++)

    {

        cTopology::Node *destNode = topo.getNode(i);

        IMobility *mod;

        mod = MobilityAccess().get(destNode->getModule());

        if (mod == NULL)

            opp_error("node or mobility module not found");

        nodeInfo info;

        info.mob = mod;

        info.itable = IPvXAddressResolver().findInterfaceTableOf(destNode->getModule());

        vectorList.push_back(info);

        for (int j = 0 ; j < vectorList[i].itable->getNumInterfaces(); j++)

        {

            InterfaceEntry *e = vectorList[i].itable->getInterface(j);

            if (e->getMacAddress().isUnspecified())

                continue;

            if (e->isLoopback())

                continue;

            related[e->getMacAddress()] = i;

            IPv4Address adr = e->ipv4Data()->getIPAddress();

            if (!adr.isUnspecified())

                relatedIp [adr] = i;

        }

 

    }

}

 

int PosNode::getIdNode(const IPv4Address &add)
{
    std::map<IPv4Address,int>::iterator it = relatedIp.find(add);
    if (it != relatedIp.end())
        return it->second;
    opp_error("Node not found with IP Address %s", add.str().c_str());
    return -1;
}

 

Coord PosNode::getIdNode(const IPv4Address &add)
{
    int modeId = getIdNode(add);
    return vectorList[modeId].mob->getCurrentPosition();

Rebecca Portelli

unread,
May 5, 2013, 1:00:58 PM5/5/13
to omn...@googlegroups.com
Sorry for the late reply.

Thanks for all the great help!  I really appreciate everything!

Reply all
Reply to author
Forward
0 new messages