From 74ce27cc46fc8e545ff0f1d184d8d41c1e3d6bb1 Mon Sep 17 00:00:00 2001 From: Adam Wisher <37659188+mrwish7@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:07:33 +0000 Subject: [PATCH] TX search algorithm tweak Use dBW rather than kW in TX search algorithm to try to prevent over-weighting of more powerful transmitters --- tx_search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx_search.js b/tx_search.js index c154402..df8ea02 100644 --- a/tx_search.js +++ b/tx_search.js @@ -50,7 +50,7 @@ function processData(data, piCode, rdsPs) { for (const station of city.stations) { if (station.pi === piCode && !station.extra && station.ps && station.ps.toLowerCase().includes(rdsPs.replace(/ /g, '_').replace(/^_*(.*?)_*$/, '$1').toLowerCase())) { const distance = haversine(serverConfig.identification.lat, serverConfig.identification.lon, city.lat, city.lon); - const score = station.erp / distance.distanceKm; // Calculate score + const score = (10*Math.log10(station.erp*1000)) / distance.distanceKm; // Calculate score if (score > maxScore) { maxScore = score; txAzimuth = distance.azimuth;