Broadcasting of Messages in Veins example

2.2k views Asked by At

I noticed that in the Veins demo scenario a node broadcasts the data message it creates to each and every other node in the simulation.

I tried to modify that a bit. I modified the sendMessage() function in TraCIDemo11p.cc file by initializing the address of the recipient in the WSMusing the setRecipientAddress() function. But while running the simulation in Veins 3.0, I find that this message is still being broadcast to all the nodes apart from the target node.

  • How do I implement this p2p connection?
  • How do I generalize by adding an RSU to the scenario to implement a heterogeneous communication framework?
1

There are 1 answers

3
user4786271 On BEST ANSWER

In its basis the 802.11p standard, which is the main communication standard for Vehicular Communication (and also the one used in Veins), does broadcast.

So basically, whatever you send via a 802.11p network interface, it will always be broadcasted, however you can make-up some type of p2p by doing "source-destination checking" from the frames.

You can extend the WaveShortMessage to contain Source and Destination fields specific for your application, and then perform checks if the destination is receiving from the intended sender.


Lets say we have two nodes nodeSender and nodeReceiver who want to communicate.

nodeSender would need to include its own identifier (name, ID etc) in the message:

msgToSend->setSourceAddress("nodeSender")

nodeReceiver would need to check if the message it "hears" is from the intended sender. Because in reality it will be hearing from multiple senders due to the broadcast nature of 80211p

if(receivedMsg->getSourceAddress() == 'nodeSender')
{
    /* this is the message which I need */
else
{
    /* do nothing with the message from other senders */
}

You can use vehicles SUMO id as their unique identifier for the addresses. You can obtain that by querying the TraCIMobility module:

cModule *tmpMobility = getParentModule()->getSubmodule("veinsmobility");
mobility = dynamic_cast<Veins::TraCIMobility*>(tmpMobility);
ASSERT(mobility);
mySumoID = mobility->getExternalId();