Search code examples
omnet++veinsinet

How to get the position of a destination node?


I have been working on a position-based protocol using veins-inet and I want to get the position of the destination node. In my code, I got the IP Address of the destination from the datagram.

const L3Address& destAddr = datagram->getDestinationAddress();

and I want to get the current position of this node. I already checked the following question

How to get RSU coordinate from TraCIDem11p.cc? But it seems that it refers to the node by using the node ID. Is there a way to get the position of the node by referring to its IP Address?

I am using instant veins-4.7.1


Solution

  • A very simple solution would be to have each node publish its current L3Address and Coord to a lookup table whenever it moves. This lookup table could be located in a shared module or every node could have its own lookup table. Remember, you are writing C++ code, so even a simple singleton class with methods for getting/setting information is enough to coordinate this.

    If, however, the process of "a node figures out where another node is" is something you would like to model (e.g., this should be a process that takes some time, can fail, causes load on the wireless channel, ...) you would first need to decide how this information would be transferred in real life, then model this using messages exchanged between nodes.