From 6c7f6e602c0947e77cfae79b2a5b6bd0beff256d Mon Sep 17 00:00:00 2001 From: Florian Thienel Date: Sun, 19 May 2024 15:04:00 +0200 Subject: [PATCH] take the spot quality into account when calculating the value of a bandmap entry --- core/bandmap/bandmap.go | 1 + core/bandmap/entries.go | 6 +++++- core/core.go | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/bandmap/bandmap.go b/core/bandmap/bandmap.go index 80433d1..29305e9 100644 --- a/core/bandmap/bandmap.go +++ b/core/bandmap/bandmap.go @@ -42,6 +42,7 @@ var defaultWeights = core.BandmapWeights{ AgeSeconds: -0.001, Spots: 0.001, Source: 0, + Quality: 0.01, } type Bandmap struct { diff --git a/core/bandmap/entries.go b/core/bandmap/entries.go index 2339570..d34e768 100644 --- a/core/bandmap/entries.go +++ b/core/bandmap/entries.go @@ -366,7 +366,11 @@ func (l *Entries) calculateWeightedValue(entry *Entry, now time.Time, weights co ageSeconds := now.Sub(entry.LastHeard).Seconds() spots := float64(entry.SpotCount) sourcePriority := float64(entry.Source.Priority()) - weight := 1 + (ageSeconds * weights.AgeSeconds) + (spots * weights.Spots) + (sourcePriority * weights.Source) + qualityFactor := 0.0 + if entry.Quality > core.BustedSpotQuality { + qualityFactor = float64(entry.Quality) + } + weight := 1 + (ageSeconds * weights.AgeSeconds) + (spots * weights.Spots) + (sourcePriority * weights.Source) + (qualityFactor * weights.Quality) return value * weight } diff --git a/core/core.go b/core/core.go index 88831e6..eb6e086 100644 --- a/core/core.go +++ b/core/core.go @@ -958,6 +958,7 @@ type BandmapWeights struct { AgeSeconds float64 Spots float64 Source float64 + Quality float64 } type VFO interface {