Files
rfcp/docs/devlog/gpu_supp/SESSION-2026-02-04-RFCP-3.9-3.10-terrain-tools.md
2026-02-07 12:56:25 +02:00

261 lines
9.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RFCP Session 2026-02-04 — Complete Development Log
**Session:** February 4, 2026 (afternoon/evening)
**Duration:** ~6 hours active development
**Iterations completed:** 3.9.0 → 3.9.1 → 3.10.0 → 3.10.1 → 3.10.2 → 3.10.3 → 3.10.4 (pending)
---
## What Was Done This Session
### Infrastructure: terra.eliah.one Tile Server ✅
- **DNS:** terra.eliah.one → 2.56.207.143 (VPS A, Hayhost)
- **Caddy:** File server with browse at /opt/terra/tiles/
- **SRTM3 (90m):** 187 tiles, 514.5 MB — full Ukraine (N44-N51, E018-E041)
- **SRTM1 (30m):** 160 tiles, 3,957.3 MB — full Ukraine (N44-N51, E022-E041)
- **Sources:** viewfinderpanoramas.org (SRTM3, void-filled), AWS S3 elevation-tiles-prod (SRTM1)
- **Index:** /api/index → tile_index.json (version 2, dual dataset)
- **Public access verified:** https://terra.eliah.one/srtm1/ and /srtm3/
### Iteration 3.9.1: Terra Integration ✅
- terrain_service.py updated with prioritized SRTM sources:
1. terra.eliah.one/srtm1/ (30m, preferred)
2. terra.eliah.one/srtm3/ (90m, fallback)
3. AWS S3 skadi mirror (public fallback)
- New endpoints: /api/terrain/status, /api/terrain/download, /api/terrain/index
- Auto-downloads tiles on first use, cached permanently on disk
- 173 tiles loaded (4,278.6 MB) confirmed in Data Cache panel
### Iteration 3.10.0: Link Budget + Fresnel Zone + Interference ✅
- **Link Budget Calculator:** Full TX→RX path analysis panel
- EIRP calculation, FSPL, terrain loss, received power, link margin
- RX point placement on map (orange marker, dashed line)
- ✓ LINK OK / ✗ FAIL status with margin display
- **Fresnel Zone Visualization:** On Terrain Profile chart
- First Fresnel zone ellipse overlay (semi-transparent)
- Red highlighting where terrain intrudes zone
- Frequency-aware (zone size changes with MHz)
- Clearance calculation with recommendation text
- **Interference Modeling (C/I):** Backend ready
- Carrier-to-interference ratio per grid point
- Co-frequency site grouping
- GPU-accelerated (CuPy vectorized)
### Iteration 3.10.1: UI Bugfixes (partial) ✅
- Elevation opacity control
- Data Cache panel with region downloads
- Various dark theme text fixes
### Iteration 3.10.2: Tool Mode System ✅
- **ActiveTool state:** 'none' | 'ruler' | 'rx-placement' | 'site-placement'
- Single map click handler dispatches to active tool
- Cursor management (default/crosshair/cell per tool)
- Ruler snap-to-site (20px threshold)
- Event propagation fixes (partial — terrain profile still leaks)
### Iteration 3.10.3: Calculator Button + Ruler Limit ✅
- Calculator button added to right toolbar
- Ruler limited to 2 points max (point-to-point only)
- Third click starts new measurement
### Iteration 3.10.4: Pending Fixes 🔧
- Terrain Profile click-through (needs stopImmediatePropagation on native event)
- TX Height hardcoded to 2m in Link Budget (should read from site config)
---
## Current State — What Works
### Core Features ✅
- Multi-site RF coverage planning with multi-sector antennas
- GPU-accelerated coverage calculation (RTX 4060, CuPy/CUDA)
- 9 propagation models (Free-Space, terrain_los, buildings, materials, dominant_path, street_canyon, reflections, water_reflection, vegetation, atmospheric)
- Performance: 11.2s Full preset (17.4x speedup from v3.8.0)
- Geographic-scale heatmap with Leaflet tile rendering
### Terrain Integration ✅
- SRTM elevation data (30m and 90m resolution)
- Bilinear interpolation for sub-pixel accuracy
- Memory-mapped I/O with LRU cache (20 tiles)
- Auto-detection SRTM1 vs SRTM3 by file size
- Terrain-aware coverage calculation (Line of Sight, terrain loss)
- Terrain Profile viewer with elevation chart
### Analysis Tools ✅
- **Link Budget Calculator** — point-to-point path analysis
- **Fresnel Zone Visualization** — on terrain profile chart
- **Ruler/Distance Measurement** — 2-point with snap-to-site
- **Terrain Profile** — elevation cross-section between 2 points
- **Coverage Statistics** — Excellent/Good/Fair/Weak breakdown
- **Session History** — compare calculation runs
### Data Management ✅
- Export: CSV, GeoJSON coverage data
- Import/Export: Site configurations (JSON)
- Data Cache: Regional tile pre-download (Ukraine, Eastern Ukraine, Donbas, Central, Western, Kyiv)
- 173 terrain tiles (4.3 GB) cached locally
### Infrastructure ✅
- Frontend: React 18 + TypeScript + Vite + Leaflet
- Backend: Python FastAPI + CuPy GPU pipeline
- Tile Server: terra.eliah.one (Caddy file_server)
- Packaging: PyInstaller + Electron (Windows installer)
- Desktop app: RFCP - RF Coverage Planner (native window)
---
## Known Bugs (for 3.10.4+)
| # | Bug | Severity | Root Cause |
|---|-----|----------|------------|
| 1 | Terrain Profile click places ruler point | Medium | stopPropagation not blocking Leaflet's native DOM listener. Need `e.nativeEvent.stopImmediatePropagation()` or move popup outside Leaflet container |
| 2 | TX Height shows 2m in Link Budget | Low | Hardcoded default, not reading from site config field |
| 3 | Cursor still shows hand in some cases | Low | Leaflet default grab cursor not fully overridden |
| 4 | Elevation Colors opacity slider | Low | May need correct layer reference binding |
---
## Roadmap — Updated February 4, 2026
### ✅ COMPLETED (Iterations 1-3.10.3)
**Phase 1: Foundation** (Dec 2024)
- React + TypeScript + Vite + Leaflet setup
- Basic site management, coverage calculation
**Phase 2: Core Features** (Jan 2025, Iterations 1-10.1)
- Multi-site, multi-sector, geographic heatmap
- Coverage statistics, keyboard shortcuts
- Code audit, production polish
**Phase 3: GPU Acceleration** (Feb 2-3, 2026, Iterations 3.1-3.8)
- CuPy/CUDA pipeline: 195s → 11.2s (17.4x)
- PyInstaller build with CUDA bundling
- Windows native backend (no WSL2)
**Phase 4: Terrain Integration** (Feb 4, 2026, Iterations 3.9-3.10)
- SRTM tile server (terra.eliah.one)
- 347 tiles, 4.5 GB, full Ukraine coverage
- Terrain-aware propagation, terrain profiles
- Link budget calculator, Fresnel zones
- Tool mode system, interference modeling
### 🔧 REMAINING ON CURRENT STACK
**3.10.4: Final Bugfixes** (1-2 hours)
- Terrain Profile click propagation fix
- TX Height from site config
- Cursor cleanup
- Elevation opacity fix
**3.11: Polish & QA** (optional, 2-3 hours)
- Interference C/I heatmap toggle on frontend
- Coverage comparison mode (before/after)
- Keyboard shortcuts help modal (?)
- Settings persistence (localStorage)
- Input validation improvements
**3.12: Offline Package** (optional, 2-3 hours)
- SRTM3 tiles bundled in installer (~180 MB gzipped)
- SRTM1 as optional "HD Terrain Pack" download
- First-run extraction to data/terrain/
- Full offline operation without internet
### 🔮 FUTURE (New Stack — When Inspired)
**Stack Migration: Tauri + SvelteKit + Rust**
- Native performance without Electron overhead
- Rust backend replacing Python FastAPI
- GPU compute via wgpu or Vulkan
- Smaller installer (<100 MB vs current ~1.6 GB)
- Already tested Tauri for UMTC Wiki project
**Advanced RF Features:**
- 3D terrain visualization (Three.js or WebGPU)
- Drive test data import and comparison
- Multiple frequency band planning
- Custom propagation model editor
- Real-time collaboration (via Matrix?)
**Field Deployment:**
- Live USB with BitLocker encryption
- Offline-first with full Ukraine terrain
- Integration with UMTC tactical mesh
- LoRa/IoT device position planning
---
## Tech Specs Quick Reference
### Backend
```
Location: D:\root\rfcp\backend
Framework: FastAPI + Uvicorn
GPU: CuPy + CUDA (RTX 4060)
Python: 3.x with numpy, scipy, httpx
Build: PyInstaller ONEDIR (~1.6 GB with CUDA)
Start: python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
```
### Frontend
```
Location: D:\root\rfcp\frontend
Framework: React 18 + TypeScript + Vite
Map: Leaflet + custom geographic heatmap
State: Zustand
Build: npm run build → dist/
Bundle: 163KB gzipped
```
### Tile Server
```
Domain: terra.eliah.one
Server: VPS A (2.56.207.143), Caddy file_server
Path: /opt/terra/tiles/srtm1/ and /opt/terra/tiles/srtm3/
Index: /api/index → tile_index.json
Health: /health → "ok"
Tiles: 187 SRTM3 (515 MB) + 160 SRTM1 (3.9 GB)
```
### Key Files
```
terrain_service.py — SRTM tile loading, bilinear interpolation, elevation profiles
gpu_service.py — CuPy/CUDA coverage calculation pipeline
coverage_service.py — Propagation models, coverage orchestration
routes/terrain.py — /api/terrain/status, /download, /index
routes/coverage.py — /api/link-budget, /api/fresnel-profile
frontend/src/store/tools.ts — ActiveTool state management
frontend/src/components/panels/LinkBudgetPanel.tsx
frontend/src/components/map/TerrainProfile.tsx
frontend/src/components/map/MeasurementTool.tsx
```
---
## Performance Benchmarks
| Preset | Resolution | Points | Time | GPU |
|--------|-----------|--------|------|-----|
| Standard | 200m | 1,975 | 7.4s | ✅ |
| Full | 50m | 6,639-6,662 | 11.2-11.7s | ✅ |
| 50km radius | 200m | 4,966 | ~30s | ✅ |
**GPU:** NVIDIA RTX 4060 (CUDA)
**Speedup:** 17.4x vs CPU-only (v3.7.0 baseline)
---
## Session Notes
Продуктивна сесія. За ~6 годин:
- Підняли tile server з нуля (terra.eliah.one)
- 347 тайлів terrain data для всієї України
- Інтегрували terrain в backend (auto-download, status API)
- Додали Link Budget Calculator, Fresnel Zone, Interference modeling
- Впровадили Tool Mode System для вирішення click conflicts
- Виправили купу UX багів
Продукт близький до завершення на поточному стеку. Основна функціональність працює, залишились polish баги та optional фічі. Рефактор на Tauri+SvelteKit+Rust — коли буде натхнення, не терміново.
Half Sword скачаний і чекає. 🗡️