FSO-Link Lab — Emulator & Acceptance Toolkit (Class 1)
An educational, Class 1-safe free-space optical (FSO) link channel emulator and acceptance test toolkit. It produces measurable acceptance criteria and docs-as-code (Requirements Specification, Test Plan, Acceptance Report), and ships a microservice stack:
- sim: Python FastAPI for channel + BER modeling
- api: ASP.NET Core 8 minimal API façade
- ui: NGINX-served React app with a simple form & results view
docker compose up --build
API health → http://localhost:8085/health # adjust if you map a different port
Services
• UI: Static React (built via Vite) served by NGINX. Proxies /api/* to the API.
• API: .NET 8 minimal API; forwards /simulate to the Python sim service.
• SIM: FastAPI with a basic FSO channel model:
- optical FSPL (Friis-like),
- Tx/Rx aperture gains (circular aperture approx.),
- fog attenuation (Kruse-style),
- turbulence/scintillation (Rytov-variance penalty),
- pointing jitter penalty,
- OOK BER estimate.
API
POST /simulate→ JSON Request: { "distance_km": 1.0, "wavelength_nm": 1550, "tx_power_dbm": 10, "rx_aperture_cm": 10.0, "tx_aperture_cm": 10.0, "visibility_km": 5.0, "cn2": 1e-14, "pointing_jitter_urad": 30.0, "data_rate_mbps": 100.0, "modulation": "OOK" }
Response: { "snr_db": 18.4, "ber": 1.2e-5, "availability_estimate": 0.987, "components_db": { "fspl_db": 198.2, "aperture_gain_tx_db": 92.8, "aperture_gain_rx_db": 92.8, "fog_loss_db": 0.78, "turbulence_penalty_db": 1.10, "pointing_loss_db": 0.65 } }
Build local (without Docker)
SIM (Linux/macOS): cd src/sim && python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt && uvicorn app:app --host 0.0.0.0 --port 8000
SIM (Windows PowerShell): cd src\sim; py -3 -m venv .venv; .\.venv\Scripts\Activate.ps1; pip install -r requirements.txt; uvicorn app:app --host 0.0.0.0 --port 8000
API: cd src/api && dotnet run
UI: cd src/ui && npm i && npm run dev (dev server only; production build is served by NGINX in Docker)
Docs-as-Code
• RequirementsSpecification.md
• TestPlan.md
• AcceptanceReport.md
License
MIT — see LICENSE.