How can I simulate the two simple scenarios in Veins? - omnet++

I am a PhD student at INSA Lyon, France. I work on mobility in urban environments.
I installed Omnet ++ 4.6, Sumo 0.21.0 and Veins 3.0 to simulate vehicle mobility.
In fact, I've never used Omnet ++ in my previous work. I read the existing tutorials of Omnet ++ in the website and now I want to start to simulate these two small scenarios:
1 Scenario: I want to have a set of mobile vehicles that exchange information among themselves
2nd scenario: I want to have a set of mobile vehicles and a set of fixed RSU that exchange information
What can I change in the existing example of Veins to lead simulate these scenarios please?
Can you help me to do this please.
Thanks very much in advance.

If you are interested in using Road Side Units (RSUs) in your simulation, you might want to base your work on Veins 4a2 instead. Its example simulation already includes an RSU participating in data exchange: as soon as a vehicle stops, it sends a message. Each vehicle and RSU that receives a message re-broadcasts one message per simulation. Each vehicle that receives a message computes a different route to avoid the road where the message originated. See this answer for a screenshot of the resulting simulation.

Related

How to deploy 10 individual cars in Veins rather than changing the numbers in XML file

I am looking to deploy 10 cars in veins and how to connect each car. Is there any example in the veins tutorial?
Veins is able to spawn vehicles itself (and sync them to sumo). However, that is not covered in the examples yet. You should be able to find all the relevant code in the TraCIScenarioManager class.
In Veins 5.0, you can instantiate a TraCIVehicleInserter module in your simulation to have Veins automatically insert numVehicles (see https://github.com/sommer/veins/blob/veins-5.0/src/veins/modules/mobility/traci/TraCIVehicleInserter.ned#L43) vehicles in your simulation -- and to insert new ones whenever the number of active vehicles drops below the configured number.

How can I modify veins source code to build my first VANET simulation trigger by a RSU?

In a section of road (I exported a portion of map from osm), I have already placed a RSU and generate some random trips of some vehicles. I would like now simulate the exchanges of messages as described bellow:
- the RSU broadcasts periodically a message, like WSA or SAM (Service Announcement Message), and all vehicles that receive the message will respond to the RSU.
Hence, I would like to simulate packet loss according to the number of vehicles and number of exchanges messages handled by the RSU.
I don't know where to change the first sender of message in the original veins source code. In the original veins program, it is a node[0] that triggers the accident message.
Thank you in advance for your return.
You can find the source code of the application running in the Veins 5a1 example simulation in src/veins/modules/application/traci/TraCIDemo11p.cc
I would recommend to start learning about Veins by running the example simulation and playing around with the above mentioned file to see how/what the behavior of the simulation changes.
If you are new to OMNeT++ as well, you will likely find it very useful to start by learning plain OMNeT++ (that is, without Veins) first. The OMNeT++ Tic Toc tutorial is an excellent place to start here.

Accident Avoidance in Veins

I am implementing an Accident Avoidance scheme in Veins. I modified the TracIDemo11p.cc and changed the onData function as following -
void TraCIDemo11p::onData(WaveShortMessage* wsm) {
findHost()->getDisplayString().updateWith("r=16,green");
annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), traci->getPositionAt(simTime()), "blue"));
if (!sentMessage)
{
traci->commandSlowDown(0.0,4); //speed changes smoothly to 0 in 4sec
sendMessage(wsm->getWsmData());
}
}
I want the vehicles to decelerate and stop in 4 sec after receiving the message. But this thing is not happening. When accident occurs the first vehicle brakes immediately and the remaining vehicles stop as usual. Where am I going wrong? Please suggest.
As I wrote on the mailing list; I think that the cause of your problem is that SUMO automatically simulates the response of drivers to accidents or obstacles. If drivers see an accident, their response is to break with a specific pattern. SUMO is developed by the traffic science community to reflect this behavior with some degree of realism.
As far as I know, the commandSlowDown is intended as an additional feature, for example when you want to simulate vehicles slowing down for other reasons that SUMO does not simulate. In particular, you could use to slow down when you receive information about an accident that is further away (e.g., over multiple hops). I suspect that might be what you're trying to achieve, so are you sure that the other vehicles are receiving the message too?
The accident avoidance behavior overrides TraCI commands by default. You need to enable unsafe driving explicitly using the 'speed mode' command. See http://sumo.dlr.de/wiki/TraCI/Change_Vehicle_State#speed_mode_.280xb3.29

send the reputation values of nodes to the neighbour nodes

I want to send the reputation values of nodes to the neighbour nodes in OMNet++ utilizing Veins. I have installed veins4a. I have done the tictoc and run the veins successfully. Can anybody help me on how to send this type of information in Veins. Should i use extra message but UDP/TCP is not supported in the current version of Veins.
Is it possible to send this message using the WaveShortMessage.msg by adding extra information (like extension in this message)?
The best way to start might be to modify the existing example, which uses TraCIDemo11p as its application and WaveShortMessage as the message exchanged between cars. Feel free to add new fields to the message class (just like you did in the Tic Toc tutorial, but now in WaveShortMessage.msg) and to implement new ways of how the application reacts to received messages (again, just like in the Tic Toc tutorial, but now in TraCIDemo11p.cc).

Allow a RSU receive messages in Veins

I'm trying to implement a very simple scenery on Veins (OMNeT++ + SUMO) with just three vehicles and one unique fixed RSU, but I'm new in Veins and I'm not able to move very well, despite the tons of documents, FAQs and tutorials I've already read!
My start point is the default TraCI scenary demo, but here the vehicles send and receive, while the RSU just send in broadcast. I managed to fix manually my RSU (adding a MapName.add.xml file and import it from MapName.sumo.cfg, and later modifying RSU.ned and omnetpp.ini). So, at this point I can see my RSU on the simulation map, and the SUMO simulation end well. But for resolve my problem I need to allow RSU not only to send, but also to receive (I have to establish a V2I2V communication).
The copious material I found is sometimes similar to my goal, but dispersive and lacking, and none found any solution. How to edit this default scenery to reach this outcome? Would be extraordinary to have a complete and working code, or be driven by someone more experienced than me.
Many thanks!
The tutorial that comes with Veins 4a2 already includes an RSU that receives data. When it does, it changes its color to green. See TraCIDemoRSU11p::onData for how this is done.

Resources