Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rayleigh fading computation #956

Closed
dragos-bth opened this issue Mar 6, 2024 · 1 comment · Fixed by #958
Closed

Rayleigh fading computation #956

dragos-bth opened this issue Mar 6, 2024 · 1 comment · Fixed by #958
Assignees
Labels
Milestone

Comments

@dragos-bth
Copy link

Hi,

I am looking into the source code for computing Rayleigh fading in INET/INETMANET

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);
}

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: omnetpp/omnetpp#1119.

@rhornig
Copy link
Member

rhornig commented Mar 6, 2024

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

@rhornig rhornig added the Bug label Mar 6, 2024
@rhornig rhornig added this to the INET 4.6 milestone Mar 11, 2024
@rhornig rhornig self-assigned this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants