added formulas
This commit is contained in:
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from math import log10, sqrt
|
||||
|
||||
from app.core.fresnel import wavelength
|
||||
from app.core.fresnel import earth_bulge, wavelength
|
||||
from app.core.surface import SurfaceProfile
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ def bullington_loss(
|
||||
tx_height_agl: float,
|
||||
rx_height_agl: float,
|
||||
freq_hz: float,
|
||||
k: float = 1.333,
|
||||
) -> float:
|
||||
"""Bullington-style equivalent edge loss for a terrain profile.
|
||||
|
||||
@@ -45,17 +46,34 @@ def bullington_loss(
|
||||
d1 = sample.distance_m
|
||||
d2 = total_distance - d1
|
||||
path_height = tx_elevation + (rx_elevation - tx_elevation) * (d1 / total_distance)
|
||||
h = sample.surface_m - path_height
|
||||
h = sample.surface_m + earth_bulge(d1, d2, k) - path_height
|
||||
max_v = max(max_v, knife_edge_v(h, d1, d2, freq_hz))
|
||||
|
||||
return knife_edge_loss(max_v)
|
||||
|
||||
|
||||
def bullington_equivalent_loss(
|
||||
profile: SurfaceProfile,
|
||||
tx_height_agl: float,
|
||||
rx_height_agl: float,
|
||||
freq_hz: float,
|
||||
k: float = 1.333,
|
||||
) -> float:
|
||||
return bullington_loss(profile, tx_height_agl, rx_height_agl, freq_hz, k=k)
|
||||
|
||||
|
||||
def deygout(
|
||||
profile: SurfaceProfile,
|
||||
tx_height_agl: float,
|
||||
rx_height_agl: float,
|
||||
freq_hz: float,
|
||||
k: float = 1.333,
|
||||
) -> float:
|
||||
"""Compatibility wrapper; use Bullington equivalent loss for multi-edge profiles."""
|
||||
return bullington_loss(profile, tx_height_agl, rx_height_agl, freq_hz)
|
||||
"""Compatibility wrapper; this is Bullington-style, not multi-edge Deygout."""
|
||||
return bullington_equivalent_loss(
|
||||
profile,
|
||||
tx_height_agl,
|
||||
rx_height_agl,
|
||||
freq_hz,
|
||||
k=k,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user