Skip to content

Commit

Permalink
2nd round of sync ac selection
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Sep 24, 2020
1 parent 42a921b commit cbb354f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion mlat/server/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,35 @@ def update_interest(self, receiver):
ntotal = {}
new_sync_set = set()
total_rate = 0

# select SYNC aircraft round1
for rp, r1, ac, rate in ratepair_list:
if ac in new_sync_set:
continue # already added

if len(new_sync_set) >= config.MAX_SYNC_AC:
if len(new_sync_set) >= config.MAX_SYNC_AC or total_rate > 3 * config.MAX_SYNC_AC:
break

if ntotal.get(r1, 0.0) < 1.0:
# use this aircraft for sync
new_sync_set.add(ac)
total_rate += rate
# update rate-product totals for all receivers that see this aircraft
for rp2, r2, ac2, rate in ac_to_ratepair_map[ac]:
ntotal[r2] = ntotal.get(r2, 0.0) + rp2

# select SYNC aircraft round2 < 2.0 instead of < 1.0 ntotal
for rp, r1, ac, rate in ratepair_list:
if ac in new_sync_set:
continue # already added

if len(new_sync_set) >= config.MAX_SYNC_AC or total_rate > 3 * config.MAX_SYNC_AC:
break

if ntotal.get(r1, 0.0) < 2.0:
# use this aircraft for sync
new_sync_set.add(ac)
total_rate += rate
# update rate-product totals for all receivers that see this aircraft
for rp2, r2, ac2, rate in ac_to_ratepair_map[ac]:
ntotal[r2] = ntotal.get(r2, 0.0) + rp2
Expand Down

0 comments on commit cbb354f

Please sign in to comment.