@mytec: iter1.5.1 ready for testing

This commit is contained in:
2026-01-31 02:13:28 +02:00
parent 7595ba430d
commit 358846fe20
5 changed files with 69 additions and 31 deletions

View File

@@ -138,6 +138,14 @@ class LineOfSightService:
total_distance = profile[-1]["distance"]
if total_distance <= 0:
return {
"clearance_percent": 100.0,
"has_adequate_clearance": True,
"worst_point_distance": 0,
"fresnel_profile": profile
}
# Wavelength (lambda = c / f)
wavelength = 300.0 / frequency_mhz # meters
@@ -148,19 +156,16 @@ class LineOfSightService:
d = point["distance"]
terrain_elev = point["elevation"]
if d == 0 or d == total_distance:
if d <= 0 or d >= total_distance:
continue # Skip endpoints
# LOS height at this point
if total_distance > 0:
los_height = tx_total + (rx_total - tx_total) * (d / total_distance)
else:
los_height = tx_total
los_height = tx_total + (rx_total - tx_total) * (d / total_distance)
# 1st Fresnel zone radius at this point
d1 = d
d2 = total_distance - d
fresnel_radius = np.sqrt((wavelength * d1 * d2) / total_distance)
fresnel_radius = float(np.sqrt((wavelength * d1 * d2) / total_distance))
# Required clearance (60% of 1st Fresnel zone)
required_clearance = 0.6 * fresnel_radius
@@ -184,9 +189,9 @@ class LineOfSightService:
worst_distance = d
return {
"clearance_percent": worst_clearance_pct,
"clearance_percent": float(worst_clearance_pct),
"has_adequate_clearance": worst_clearance_pct >= 60.0,
"worst_point_distance": worst_distance,
"worst_point_distance": float(worst_distance),
"fresnel_profile": profile
}