The compute pipeline now actually runs: per-pixel path loss over LIDAR
terrain, antenna pattern lookup, real GeoTIFF + colored PNG output,
Leaflet imageOverlay rendering with opacity slider and dBm legend.
Propagation:
- Towerops.Coverages.Propagation: Friis FSPL + Bullington single-knife-edge
diffraction (ITU-R P.526). Pure Elixir, closed-form, no NIF dependency.
Clean signature so a future ITM/Longley-Rice backend can drop in.
- Towerops.Coverages.Profile: AAIGrid sampler with elevation_at, sample
along great circle, haversine distance.
- Towerops.Coverages.Raster: Float32 GeoTIFF via gdal_translate (with VRT
wrapper) and colored PNG via gdaldem color-relief. Outputs to
priv/static/coverage/<org>/<id>/, served by existing Plug.Static.
Worker:
- Towerops.Workers.CoverageWorker now does the full pipeline: bbox compute
-> Towerops.Lidar.get_elevation_grid -> per-pixel Task.async_stream
(parallel = schedulers) running antenna pattern lookup + propagation +
RSSI threshold check, write rasters. Configurable terrain source via
:coverage_terrain_module application env so tests can stub. Friendly
failure messages for :no_tile, :grid_too_large, :nodata,
:unknown_antenna, :missing_location.
Bundled antenna catalog (~95 entries):
- AntennaCatalog with compact specs for every antenna in the request list:
Cambium, ALPHA, Antel, ITELITE, KP Performance, L-com, MARS, MikroTik,
Mimosa, MTI, RADWIN, RF Elements, Ruckus, Tarana, Simulate, Ubiquiti.
- Antenna.from_spec/1 synthesizes 360+360 attenuation patterns from
gain+beamwidth (cosine-squared main lobe, smooth transition,
front-to-back floor with mild ripple). Real .ant files in priv/antennas/
override the catalog by slug. Test fixtures moved to test/support.
Schema (migration add_radio_fields_to_coverages):
- tx_power_dbm replaces eirp_dbm; EIRP is now derived as
tx_power + antenna.gain - cable_loss in Coverage.eirp_dbm/2 and shown
live in the form header.
- cable_loss_db, sm_gain_dbi, latitude_override, longitude_override,
height_above_rooftop_m, tx_clearance_m, foliage_tuning (0-100 slider).
- Coverage.location/1 returns {lat, lon} from override or parent site.
UI:
- form.html.heex: cnHeat-style grouped form (Identity / Location /
Mounting / RF / Coverage extent), foliage tuning range slider,
computed EIRP badge in the header.
- show.html.heex: Leaflet map area with L.imageOverlay heatmap,
opacity slider, dBm color legend, antenna marker with directional
wedge for azimuth.
- assets/js/app.ts: CoverageMap hook registered.
Tests: 24 new (propagation reference values, profile sampling,
worker end-to-end with stubbed terrain that writes real GeoTIFF + PNG,
org-mismatch job-cancel guard). Full suite: 10815 tests.
28 lines
1.1 KiB
Elixir
28 lines
1.1 KiB
Elixir
defmodule Towerops.Repo.Migrations.AddRadioFieldsToCoverages do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
alter table(:coverages) do
|
|
# Replace stored EIRP with TX power + cable loss; EIRP is now derived
|
|
# at display time as `tx_power_dbm + antenna.gain_dbi - cable_loss_db`.
|
|
remove :eirp_dbm, :float, null: false
|
|
add :tx_power_dbm, :float, null: false, default: 18.0
|
|
add :cable_loss_db, :float, null: false, default: 0.0
|
|
|
|
# Subscriber-module antenna gain at the receiver end (link-budget input).
|
|
add :sm_gain_dbi, :float, null: false, default: 0.0
|
|
|
|
# Optional lat/lon overrides; default uses the parent site's coordinates.
|
|
add :latitude_override, :float
|
|
add :longitude_override, :float
|
|
|
|
# Mounting offsets and clearance (stored SI; UI may render ft).
|
|
add :height_above_rooftop_m, :float, null: false, default: 0.0
|
|
add :tx_clearance_m, :float
|
|
|
|
# Foliage attenuation adjustment, 0..100 scale (0 = no extra attenuation,
|
|
# 100 = heavy foliage scaling).
|
|
add :foliage_tuning, :integer, null: false, default: 0
|
|
end
|
|
end
|
|
end
|