Search code examples
omnet++veins

Display issue in the log module of Omnet++ simulator


I use veins-4a2. First, I have executed a scnario with only vehicles. Now I have added RSU in my example. I need that every RSU receives data, displays a message in the module log of Omnet++. Like I did for nodes when they receives data, I have add the bold line in onData() function of the TraCIDemp11p like this:

void TraCIDemoRSU11p::onData(WaveShortMessage* wsm) {

    findHost()->getDisplayString().updateWith("r=16,green");

    annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), mobi->getCurrentPosition(), "blue"));

    **EV << " I am an RSU and I have received a data !  \n";**

    //if (!sentMessage) sendMessage(wsm->getWsmData());
}

My problem is that "I am an RSU and I have received a data ! " isn't displayed in the log module. When an RSU receives a data, this is what is displayed in the log module of omnet++:

** Event #4802  t=9.004337832007  RSUExampleScenario.node[4].nic.phy80211p (PhyLayer80211p, id=161), on `data' (Mac80211Pkt, id=669)
node[4]::PhyLayer80211p: AirFrame encapsulated, length: 1326

Solution

  • I don't know if you are aware of how onData works.

    In the default veins, the onData is only called where one package with name data arrived in one car/node or RSU (through the handleLowerMsg).

    In your case in a RSU, so are needed:

    1. The cars/nodes need the appl.sendData with true

    2. Calls for send packages with name data

    3. Range of communication with the cars/nodes and the RSU. The default is 1 km of diameter.

    A good test is create a small grid with the randomTrips.py and set the RSU in center, where all nodes can achieve it.

    -Big for one comment, so I make a new answer - Good luck!