@mytec: iter1.6 ready for testing

This commit is contained in:
2026-01-31 12:10:55 +02:00
parent 5821de9a8f
commit 7a5b27bd87
13 changed files with 773 additions and 101 deletions

View File

@@ -22,11 +22,21 @@ class ReflectionService:
- Single bounce (most common)
- Double bounce (around corners)
- Ground reflection
- Water surface reflection
"""
MAX_BOUNCES = 2
GROUND_REFLECTION_COEFF = 0.3 # Depends on surface
# Ground types and reflection coefficients
GROUND_REFLECTION = {
"urban": 0.3,
"suburban": 0.4,
"rural": 0.5,
"water": 0.8,
"desert": 0.6,
}
async def find_reflection_paths(
self,
tx_lat: float, tx_lon: float, tx_height: float,
@@ -124,9 +134,10 @@ class ReflectionService:
self,
tx_lat, tx_lon, tx_height,
rx_lat, rx_lon, rx_height,
frequency_mhz
frequency_mhz,
is_water: bool = False
) -> Optional[ReflectionPath]:
"""Calculate ground reflection path"""
"""Calculate ground/water reflection path"""
from app.services.terrain_service import TerrainService
@@ -146,19 +157,19 @@ class ReflectionService:
# Path loss
path_loss = self._free_space_loss(total_dist, frequency_mhz)
# Ground reflection loss (~5-10 dB typically)
ground_reflection_loss = -10 * np.log10(self.GROUND_REFLECTION_COEFF)
# Reflection coefficient: water is much more reflective
coeff = self.GROUND_REFLECTION.get("water" if is_water else "rural", 0.4)
reflection_loss = -10 * np.log10(coeff)
# Phase difference can cause constructive or destructive interference
# Simplified: assume average case
total_loss = path_loss + ground_reflection_loss
total_loss = path_loss + reflection_loss
surface_type = "water" if is_water else "ground"
return ReflectionPath(
points=[(tx_lat, tx_lon), (mid_lat, mid_lon), (rx_lat, rx_lon)],
total_distance=total_dist,
total_loss=total_loss,
reflection_count=1,
materials=["ground"]
materials=[surface_type]
)
def _specular_reflection_point(