Building my own veins scenario - omnet++

I need to build a scenario from scratch.
Two vehicles moving on a straight road. There is a single rsu.
The rsu brodcasts the speed value every 10s. Vehicles should slow down to reach that value.
My question is
can i consider the msg as a beacon? If yes, how can i set the beacon msg in the rsu application? And if no, how to implement such scenario

You can have a look at the following answered questions, since they are somewhat similar to your question or at least give you some insight in how messages between vehicles are handled in Veins.
Please note that you should get a basic understanding of how OMNeT++ works first. You can use the TicToc tutorial to do that.
how to getting start to build a veins application
what policy is based vehicle rerouting in case of accident?
What exactly does handleParkingUpdate() do?
The necessity of handleSelfMsg in BaseWaveApplLayer

Related

Sumo/Veins not spawning all vehicles

I am using Omnet, SUmo and Veins to simulate Vanets. The issue I face is that with certain maps, not all cars in the route file are spawned, at least not when they are supposed to. From what I understand it is because there is "not enough space in the network". I find it weird because the map I currently have covers 5*4 Manhattan blocks and should be big enough to accommodate thirty vehicles.
When I use departLane and departPos with "free", cars spawn, but the simulation fails randomly. I used a much bigger map with thirty vehicles and that one worked fine.
Any ideas, thanks in advance.
At depart time SUMO does not check for general space in the network but on the given departLane (which defaults to the rightmost usable lane) of the first edge in the route that's why vehicles are delayed. You already found out what to do against it, use departLane="free".
As for the second problem please give at least the error message preferrably with a more detailled description and the SUMO version.

Setting weights for edges in SUMO using Omnet++

I am using Omnet++ 5.3, veins 4.7.1 and Sumo 0.32.0. I want to set weights to the edges in SUMO. Having done some reading, I realise that traci has a function called seteffort in the python version. I am unable to find a similar function to set weights in traci present in the veins version used for omnet++. Any help to achieve the task is appreciated. Thank you!
It is certainly possible to extend Veins by adding new methods to https://github.com/sommer/veins/blob/veins-5.0/src/veins/modules/mobility/traci/TraCICommandInterface.h following the code that is already there.
The specific method you mentioned, however, might not be a good idea: it is meant to change how every vehicle in the network perceives it. You might be more interested in changing how only a single vehicle chooses its route.

Messages not received by other vehicles because of building

I'm using veins 4.4, OMNeT++ 5.0 and SuMO 0.25, and my project is about intersection traffic control.
I have only one obstacle (building) on my map (by open street map), and my problem is that node 1 is not receiving messages from node 2 and vice versa while in other lanes communication is done perfectly without missing messages.
I think the problem is because of this obstacle. Can anyone help me to get rid of this problem?
The obstacle (which is likely representing a house next to a junction) is behaving as it should: it is obstructing radio communication. There are two ways to approach this: either this is intended, then you would need to design a system that can route data around the house in a multi-hop fashion; or this is unintended, then you would need to remove the building or its effect on radio communication.
If you do not want to have a building in your simulation, make sure that your simulation does not load the Obstacle Shadowing Model. If you load this model but no obstacles, the simulation will complain.

Disable/remove the NIC module of some vehicle in Veins

Dear OMNeT++/SUMO/Veins community,
There is a correct way to disable/remove the NIC module for some vehicle in the Veins?
I have lot of vehicles in my scenario and I want set only one part them with communication module, for example 50 %. For this I created one method that set half the vehicles to start the sendBeacon and other method to drop the beacon/data for half (same half that no start sendBeacon) the vehicles. I already see this question.
I think there is a correct way to do this, because in my code all the vehicle have the communication module and just not use or ignore the package that arrived.
I'd appreciate any help.
If you want only a certain fraction of vehicles to participate in the network simulation, you can set the penetration rate parameter in https://github.com/sommer/veins/blob/veins-4.4/src/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.ned#L58 to a value smaller than one.
For example, if you set the penetration rate to 0.5 only half of the cars will take part in the network simulation (but still in the road traffic simulation), thus modeling a network where half of the cars are not equipped with VANET technology.

How can I write Traffic Light logic based on Induction Loop data in Omnet++?

I have a simple traffic light intersection in which I have already set the traffic light logic. Suppose the vehicle density is increasing in one road and I want to retrieve this data in Omnet and use the C++ logic to direct the traffic lights to change state. Is it possible to do this in Omnet++?
In short I am looking to control the traffic using the network information obtained by running SUMO and coupling through SUMO. Is it possible to control the traffic through Omnet++? If yes, then can you tell me an example of how to do so?
Veins already includes some TraCI commands to retrieve the state of a SUMO simulation, as well as to change traffic lights. SUMO includes many more TraCI commands which should be able to do what you describe. You would just need to implement them in Veins as well, building on what is already there.

Resources