如何基于静脉中的两辆车之间的距离来控制传输功率和速度 [英] How to control the transmission power and speed based on the distance between two vehicles in Veins
问题描述
我是有关静脉的初学者.现在,我正在尝试基于两辆行驶中的车辆彼此之间的距离(静脉4.5,Omnet 5.0和Sumo 0.29)来模拟它们之间的传输功率和速度的动态调整. 到目前为止,我已经建立了Sumo模型并在Omnet中运行该模型,但是没有任何编程,这意味着两辆车之间的传输功率和速度都已在.ini文件中设置.现在,我想实现一种算法来动态调整它们. 作为一个初学者,我几乎不知道如何开始这项工作. Veins教程没有告诉您如何应用Veins提供的功能.我现在基于.ned文件构建一个新的.cc文件.从MyVeinsApp.cc,我发现了一些我需要实现的方法.但是我仍然需要一些有关我的问题的编程说明. 1如何获取两辆正在行驶的车辆之间的实时距离? 2是否可以通过静脉4.5控制传输功率和速度?
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?
对于这些最初的问题我感到很抱歉.但是我真的不知道如何从一开始就在编程级别上逐步开发Veins模拟
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
非常感谢!
推荐答案
要获取两辆车之间的距离,可以使用
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.
这篇关于如何基于静脉中的两辆车之间的距离来控制传输功率和速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!