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

你说的曾经没有我的故事 提交于 2019-12-11 04:38:58

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/43433392/how-to-control-the-transmission-power-and-speed-based-on-the-distance-between-tw

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!