How to enable SUMO TraCI using SimuLTE and Veins? - omnet++

I am using SimuLTE and Veins simulating sending safety message via LTE. The content of the message depends on the real-time values of the traffic, e.g., mean speed. In order to get such values, I plan to use TraCICommandInterface supported by Veins. However, I could not find out how and where I can do this. To be specific, in Veins without SimuLTE, I know the vehicle node is a module of TraCIMobility, which has an application layer, where we can customize the functions for receiving/sending messages, such as wsm, and managed by TraCIScenarioManager. However in the simulation example provided by SimuLTE, the vehicle/node is a module of VeinInetMobility, which is managed by VeinInetManager. Neither of them are using TraCICommandInterface or TraCIMobility. Besides, the lte applications are not using the same layer as BaseWaveApplLayer, where we can take some action as soon as the vehicle/node updates the position. Can anyone help explain how I could possibly implement the following using SimuLTE and Veins:
In order to monitor the vehicle/node values using TraCI, which class should I modify to use TraCI? VeinsInetMobility, VeinsInetManager or else?
How can I take action in the application only when there is a position update to the vehicle/node?
What is the essential difference between VeinsInetMobility and TraCIMobility? Can I use the latter for LTE scenario?

In Veins 4.6, a TraCIMobility module is used to update the Veins channel models every time a node's position changes. Quite similarly, in Veins_INET of Veins 4.6, a VeinsInetMobility module is used to update the INET Framework channel models every time a node's position changes. Because SimuLTE uses INET Framework channel models, this is the class that must be used here (otherwise the INET channel models would not know, e.g, whether two nodes are too far away to communicate).
If you want to take action every time a SUMO time step has completed, you can just add this to the executeOneTimestep method of TraCIScenarioManager.
Note that if you ever want to interact with the SUMO vehicle via the VeinsInetMobility module (e.g., changing a vehicle's route) a few changes will be necessary: Veins_INET of Veins 4.6 does not track a node's external id (the ID that SUMO uses to refer to the corresponding vehicle), so this would need to be added to VeinsInetMobility (line 54) along with code to use it, similar to TraCIMobility (line 127).

Related

How to get Vehicle ID from SUMO in Veins

In my Veins simulation, I want to use SUMO vehicle ID as the ID of the vehicle (instead of using Veins module id). I tried different method but was not successful. I tried to obtain sumo id using mobility -> getExternalId() in DemoBaseApplLayer.cc file. Build was successful but it does not run. If i do, getParentModule->getId() - it works fine. But I need SUMO Id not module id for my work,
Is there a way to use SUMO vehicle Id as the id of the vehicle in Veins?
If you mean that the wireless node with node vector index 1 in OMNeT++ should correspond to a vehicle named vehicle_1 in SUMO this will not easily be possible. If all you want to do is inquire about which name SUMO uses to refer to a wireless node managed via TraCIMobility in OMNeT++ then its getExternalId method is exactly the right one to call. If using the method gives you a runtime error, please post the precise output and messages you are seeing, the precise software versions you are using, and the steps needed to reproduce your error on another machine.

How can I perform unicast communication in Veins?

While looking for various information on Stackoverflow, I read that Veins 5.x and above support Unicast communication.
I understood that unicast communication is possible through populateWSM(). However, I don't understand which LAddress::L2Type rcvId should be in the ID value of the second parameter.
Should I pass the ID value obtained through
getParentModule() -> getIndex()
Or is it necessary to pass the ID value of the left node list when running the simulation? If it's the latter, how can I get the ID value?
The demo implementation of Veins 5.1 uses the OMNeT++ module ID. For more robustness, I would recommend querying the MAC layer. See, for example, https://github.com/sommer/veins/blob/veins-5.1/src/veins/modules/application/ieee80211p/DemoBaseApplLayer.cc#L83

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.

How can I simulate the two simple scenarios in Veins?

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.

Resources