From 67e095bd471af04f9804f3f8912dcf65bc5d998c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 8 Apr 2026 13:32:18 -0500 Subject: [PATCH] Label beacon TX power as EIRP The power_mw field represents the beacon's effective radiated power, not just transmitter output. Relabel it as "TX power (EIRP)" on the form and detail list, "EIRP (mW)" in the index, and drop the now- meaningless tx_gain_dbi constant in RangeEstimate since the stored value already includes antenna gain. --- lib/microwaveprop/beacons/range_estimate.ex | 10 +++++----- lib/microwaveprop_web/live/beacon_live/form.ex | 2 +- lib/microwaveprop_web/live/beacon_live/index.ex | 2 +- lib/microwaveprop_web/live/beacon_live/show.ex | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/microwaveprop/beacons/range_estimate.ex b/lib/microwaveprop/beacons/range_estimate.ex index c26dd15b..532cc408 100644 --- a/lib/microwaveprop/beacons/range_estimate.ex +++ b/lib/microwaveprop/beacons/range_estimate.ex @@ -7,8 +7,10 @@ defmodule Microwaveprop.Beacons.RangeEstimate do Rx_dBm = EIRP_dBm + Rx_gain_dBi - FSPL(d, f) - atm_loss_per_km * d for the distance `d` at which the received power equals the tier threshold. - Free-space path loss uses the standard formula and atmospheric absorption - comes from the band's O₂/H₂O coefficients in `BandConfig`. + `EIRP_dBm` comes directly from the beacon's stored `power_mw` — the field + already represents EIRP (TX power × antenna gain). Free-space path loss uses + the standard formula and atmospheric absorption comes from the band's + O₂/H₂O coefficients in `BandConfig`. The result is then multiplied by a propagation-score factor derived from the latest `propagation_scores` row at the beacon's lat/lon — score 50 → 1.0x, @@ -32,8 +34,6 @@ defmodule Microwaveprop.Beacons.RangeEstimate do # Assume the receiving station is an average amateur microwave station # (dish/horn + low-noise preamp). @rx_gain_dbi 20.0 - # Beacons are typically omnidirectional. - @tx_gain_dbi 0.0 @doc """ Convert a power in milliwatts to dBm. Returns `-999.9` for non-positive input. @@ -68,7 +68,7 @@ defmodule Microwaveprop.Beacons.RangeEstimate do valid_time = detail && detail.valid_time f_mhz = beacon.frequency_mhz * 1.0 - eirp_dbm = mw_to_dbm(beacon.power_mw || 0.0) + @tx_gain_dbi + eirp_dbm = mw_to_dbm(beacon.power_mw || 0.0) atm_per_km = atm_loss_per_km(band_config) score_mult = 0.5 + score / 100.0 diff --git a/lib/microwaveprop_web/live/beacon_live/form.ex b/lib/microwaveprop_web/live/beacon_live/form.ex index b1161a2b..1cd69468 100644 --- a/lib/microwaveprop_web/live/beacon_live/form.ex +++ b/lib/microwaveprop_web/live/beacon_live/form.ex @@ -32,7 +32,7 @@ defmodule MicrowavepropWeb.BeaconLive.Form do <.input field={@form[:power_mw]} type="number" - label="Power (mW)" + label="TX power (EIRP) (mW)" step="any" required /> diff --git a/lib/microwaveprop_web/live/beacon_live/index.ex b/lib/microwaveprop_web/live/beacon_live/index.ex index d3e15edc..c160f681 100644 --- a/lib/microwaveprop_web/live/beacon_live/index.ex +++ b/lib/microwaveprop_web/live/beacon_live/index.ex @@ -28,7 +28,7 @@ defmodule MicrowavepropWeb.BeaconLive.Index do <:col :let={{_id, beacon}} label="Grid">{beacon.grid} <:col :let={{_id, beacon}} label="Lat">{beacon.lat} <:col :let={{_id, beacon}} label="Lon">{beacon.lon} - <:col :let={{_id, beacon}} label="Power (mW)">{beacon.power_mw} + <:col :let={{_id, beacon}} label="EIRP (mW)">{beacon.power_mw} <:col :let={{_id, beacon}} label="Height AGL (ft)">{beacon.height_ft} <:col :let={{_id, beacon}} label="On air"> diff --git a/lib/microwaveprop_web/live/beacon_live/show.ex b/lib/microwaveprop_web/live/beacon_live/show.ex index 9b47d76f..f56e63b4 100644 --- a/lib/microwaveprop_web/live/beacon_live/show.ex +++ b/lib/microwaveprop_web/live/beacon_live/show.ex @@ -79,7 +79,7 @@ defmodule MicrowavepropWeb.BeaconLive.Show do <:item title="Grid">{@beacon.grid} <:item title="Latitude">{@beacon.lat} <:item title="Longitude">{@beacon.lon} - <:item title="Power (mW)">{@beacon.power_mw} + <:item title="TX power (EIRP) (mW)">{@beacon.power_mw} <:item title="Height above ground (ft)">{@beacon.height_ft} <:item title="On the air">{if @beacon.on_the_air, do: "Yes", else: "No"}