|
INET Framework for OMNeT++/OMNEST
|
#include <PathLossReceptionModel.h>
Public Member Functions | |
| virtual void | initializeFrom (cModule *radioModule) |
| virtual double | calculateReceivedPower (double pSend, double carrierFrequency, double distance) |
| virtual double | mW2dBm (double mW) |
Protected Attributes | |
| double | pathLossAlpha |
| double | shadowingDeviation |
Path loss model which calculates the received power using a path loss exponent, the distance and log-normal distribution shadowing.
| double PathLossReceptionModel::calculateReceivedPower | ( | double | pSend, |
| double | carrierFrequency, | ||
| double | distance | ||
| ) | [virtual] |
Perform the calculation.
Implements IReceptionModel.
{
const double speedOfLight = 300000000.0;
double waveLength = speedOfLight / carrierFrequency;
if (shadowingDeviation == 0.0)
return pSend * waveLength * waveLength / (16 * M_PI * M_PI * pow(distance, pathLossAlpha));
else
{
// This code implements a shadowing component for the path loss reception model. The random
// variable has a normal distribution in dB and results to log-normal distribution in mW.
// This is a widespread and common model used for reproducing shadowing effects
// (Rappaport, T. S. (2002), Wireless Communications - Principles and Practice, Prentice Hall PTR).
double xs = normal(0.0, shadowingDeviation);
double mWValue = pSend * waveLength * waveLength / (16 * M_PI * M_PI * pow(distance, pathLossAlpha));
double dBmValue = mW2dBm(mWValue);
dBmValue += xs;
double mWValueWithShadowing = pow(10.0, dBmValue/10.0);
return mWValueWithShadowing;
}
}
| void PathLossReceptionModel::initializeFrom | ( | cModule * | radioModule | ) | [virtual] |
Parameters read from the radio module: pathLossAlpha.
Implements IReceptionModel.
{
pathLossAlpha = radioModule->par("pathLossAlpha");
shadowingDeviation = radioModule->par("shadowingDeviation");
cModule *cc = ChannelControl::get();
if (pathLossAlpha < (double) (cc->par("alpha")))
opp_error("PathLossReceptionModel: pathLossAlpha can't be smaller than in ChannelControl -- please adjust the parameters");
}
| double PathLossReceptionModel::mW2dBm | ( | double | mW | ) | [virtual] |
double PathLossReceptionModel::pathLossAlpha [protected] |
Referenced by calculateReceivedPower(), and initializeFrom().
double PathLossReceptionModel::shadowingDeviation [protected] |
Referenced by calculateReceivedPower(), and initializeFrom().