Skip to content

Commit

Permalink
take the spot quality into account when calculating the value of a ba…
Browse files Browse the repository at this point in the history
…ndmap entry
  • Loading branch information
ftl committed May 19, 2024
1 parent 2931a9f commit 6c7f6e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/bandmap/bandmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var defaultWeights = core.BandmapWeights{
AgeSeconds: -0.001,
Spots: 0.001,
Source: 0,
Quality: 0.01,
}

type Bandmap struct {
Expand Down
6 changes: 5 additions & 1 deletion core/bandmap/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ type BandmapWeights struct {
AgeSeconds float64
Spots float64
Source float64
Quality float64
}

type VFO interface {
Expand Down

0 comments on commit 6c7f6e6

Please sign in to comment.