From the already existing stack overflow discussion, I knew transmission range is related to power, noise, and sensitivity in the old version of veins.
Change the transmission signal strength for a specific set of vehicles during the run-time
My Question is In the latest version of Veins 5.1, the global transmission range is considered for both RSU and Veins. How can I make it specific? Like I want to specify the range of RSU to 1000m for txPower1 =20mW and
Vehicles to 300m for txPower2 =15.5mW
*.connectionManager.maxInterfDist = 1000m \added for RSU *.connectionManager.maxInterfDistNodes = 300m \added for vehicles
Checked the maxInterfDist in connection manger.cc. By default maximum range is considered for maxInterfDist for both RSU and vehicles.
Also in BaseConnectionManger.cc file, maxInterfDist is used.
Do I need to add another method for vehicles which return the distance (maxInterDistfNodes) and hence used another parameter in Omnet.ini file to define the power and sensitivity? If so please guide me where to make changes and how?
.omnet.ini
*.connectionManager.maxInterfDist = 1000m
*.connectionManager.maxInterfDistNodes = 300m
*.**.nic.mac1609_4.txPower = 20mW
BaseConnection Manager.cc
'''BaseConnectionManager::isInRange(BaseConnectionManager::NicEntries::mapped_type pFromNic, BaseConnectionManager::NicEntries::mapped_type pToNic)
{
double dDistance = 0.0;
if(useTorus)
{
dDistance = sqrTorusDist(pFromNic->pos, pToNic->pos, *playgroundSize);
}
else
{
dDistance = pFromNic->pos.sqrdist(pToNic->pos);
}
return (dDistance <= maxDistSquared);
}'''
connectionManager.cc
'''double ConnectionManager::calcInterfDist()
{
if (hasPar("maxInterfDist"))
{
double interfDistance = par("maxInterfDist").doubleValue();
ccEV << "max interference distance:" << interfDistance << endl;
return interfDistance;
}
else
{
throw cRuntimeError("ConnectionManager: No value for maximum
interference distance (maxInterfDist) provided.");
}
}'''
I made additions as per given in the above link but it shows the error that mac could not be defined like this.
May be my questions seems to be silly, but I need guidance. Please help.
Many Thanks
Congratulations on your editing, you are getting used to use the fundamentals of veins&omnet++. It is sad that I can not test it right now as I am setting the simulations in my other operating system but I can discuss and give few remarks basing on my modest experience:
I would suggest the following: (they may contain errors as they are not tested)
1- in ".h" of the Car+RSU files:
#include "veins/base/utils/FindModule.h"//added
#include "veins/modules/mac/ieee80211p/Mac1609_4.h"//added
and
Mac1609_4* mac;//added
2- in ".cc" of the Car+RSU files, in their "initialize()", more precisely in their "if(stage==0)" add:
mac = FindModule<Mac1609_4*>::findSubModule(getParentModule());//added
3- you just now have to add, after the step "2-" instruction, the following:
mac->setTxPower(/*what corresponds the needed transmission power for the node type*/);
And I still recommend to let the other files non-altered as it is a good-habit in codding especially with new languages/platforms/etc. (at least for me as I do not consider my self old enough with veins). Thus: you may return the connectionmanager to its initial state (you can make a back-up to your whole src folder before proceeding as it was working)
Once again: my long writing text is just to give you my ideas and some tips that worked with me (with just few modifications to the goal) we are always enhancing our abilities with experience as you perfectly did with solving that issue with your code above.
All the best luck :)