Skip to content

[BUG] Typo in a formula in itur.models.itu530.multipath_loss #82

@krzygorz

Description

@krzygorz

Describe the bug
itur.models.itu530.multipath_loss returns wrong results for A in the shallow fading region. This is due to a missing bracket in step 3b. Here's how to fix it:

        def step_3b(p_0, At, A):
            ...
            q_t = ((qa_p - 2) /
-                   (1 + 0.3 * 10 ** (-At / 20) * 10 ** (-0.016 * At)) -
+                  ((1 + 0.3 * 10 ** (-At / 20)) * 10 ** (-0.016 * At)) -
                   4.3 * (10**(-At / 20) + At / 800))
            ...

And here's the relevant fragment of the recommendation:
screenshot of ITU-R P.530 equation 16

To Reproduce
With the original code, plot of p_W vs fade depth contains a discontinuity, which probably shouldn't happen (the curves in figure 3 of the recommendation are smooth):

import numpy as np
import matplotlib.pyplot as plt
from itur.models import itu530
A = np.linspace(0,30,100)
p = itu530.multipath_loss(lat=22.443907, lon=-74.220397, h_e=40, h_r=40, d=20, f=18, A=A)
plt.plot(A,p)
plt.xlabel("fade depth [dB]")
plt.ylabel("% avg worst month")
plt.yscale("log")
plt.show()

image

Expected behavior
After applying the suggested change, the discontinuity becomes negligibly small (still, shouldn't it be perfectly smooth???)
image

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions