Search code examples
omnet++veins

Veins simulation,changing bitrate based on distance


I've been working on omnet++ veins to simulate a highway scenario and the relationship between vehicle and RSU(roadside unit).I'm trying to figure out how to dynamically change the bitrate of my RSU setting

*.**.nic.mac1609_4.bitrate = 6Mbps

Above is the original setting of bitrate,I'm hoping to adjust this value based on the distance between RSU and vehicle.Are there any module I can use to get the distance and furthermore respectively manipulate the bitrate between different vehicle nodes and RSU nodes


Solution

  • In Veins 4.7.1, you can set the modulation and coding scheme (MCS), so - by extension - the bitrate, via a call to the setMCS method of the MAC layer. Calculating the distance is supported via a method of the Coord class which is used to represent node positions.