Rayleigh fading computation
Hi,
I am looking into the source code for computing Rayleigh fading in INET/INETMANET https://github.com/inet-framework/inet/blob/d93b7bc29def3ead5727f4de880a02be19810a44/src/inet/physicallayer/wireless/common/pathloss/RayleighFading.cc#L32-L39
double RayleighFading::computePathLoss(mps propagationSpeed, Hz frequency, m distance) const
{
m waveLength = propagationSpeed / frequency;
double freeSpacePathLoss = computeFreeSpacePathLoss(waveLength, distance, alpha, systemLoss);
double x = normal(0, 1);
double y = normal(0, 1);
return freeSpacePathLoss * 0.5 * (x * x + y * y);
}
I would like to understand where 0.5 term comes from on the line with the return statement. As far as I know, $\sqrt{x^2 + y^2}$ has a Rayleigh density when $x$ and $y$ are normal and independent random variables with zero mean and equal variance. Therefore I was expecting that line to look like
return freeSpacePathLoss * sqrt((x * x + y * y));
This has also been reported in the OMNeT++ discussions: https://github.com/omnetpp/omnetpp/discussions/1119.
This is definitely a bug. This code is inherited from the original Mobility framework back from 2008. It was merged into MiXiM and the eventually landed in INET framework. Here is the original paper