Setting weights for edges in SUMO using Omnet++ - 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.

Related

How to print collisions in real time on the OMNet ++ console?

I am doing the geographic routing in VEINS. However, in a moment the message is not transmitted by a node.
I suspect this is caused by a collision. I know that it is possible to take collision statistics at the end of the simulation.
But, I was wondering if there is any method I can use to print the collision on the OMNeT ++ console in real time.
Development environment used: SUMO 1.2.0, VEINS 5.0 and OMNet++ 5.5.1.
I suggest taking a look at the various visualizers in INET. For example you can set up a packet drop visualizer. See the related showcase.
You can also visualize the actual electromagnetic signal if you want to see it on lower level.

Building my own veins scenario

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

How to control the transmission power and speed based on the distance between two vehicles in Veins

I am a beginner about Veins. Now I am trying to simulate dynamic adjustment of the transmission power and speed between 2 running vehicles based on their distance with each other with Veins 4.5, Omnet 5.0 and Sumo 0.29.
So far I have built the Sumo model and run the model in Omnet but without any programming which means the transmission power and speed between 2 vehicles are all set in the .ini file. Now I want to implement an algorithm to adjust them dynamically.
As a beginner I barely know how to start this job. The Veins tutorial didn't tell how to apply the functions provided by Veins. I now build a new .cc file based on our .ned file. And from MyVeinsApp.cc I found some methods I need to implement. But still I need some programming instructions about my problem.
1 how to get the realtime distance between 2 running vehicles?
2 is it possible to control the transmission power and speed with Veins 4.5?
I am sorry for these initial questions.But I really don't know how to develop a Veins simulation from the very beginning step by step at the programming level
Thank you very much!
To get the distance between two vehicles you can use the built-in function distance() from Coord (see this post).
To control the transmit power you can use the parameter txPower from Mac1609_4.
For changing the speed of the vehicle you can check this post.

How to determine existing a RSU at a junction?

i want to determine Is there a RSU at a junction? Is a method or a way to achieve my goal?
Can any one please helpe me.
Veins 4.4 offers a function to get a list of all junctions and, for each of those, a function to get a junction's position. This should allow for a good approximation of whether an RSU can serve a junction.
If you want to be more precise, you would need to know the junction's exact geometry. It is known to SUMO (though not yet exposed via the TraCI API), but you can easily extend the API by a function to do this yourself.

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