Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.
/ readsb Public archive

Commit

Permalink
Increase position_valid expiry time and aircraft TTL
Browse files Browse the repository at this point in the history
Aircraft often drop in and out of reception. Being able to do relative
CPR and range checks even if no position was decoded for longer than 70
seconds is very useful to reception.
Due to the previously pos_reliable counter and the speed check this
should even decrease the number of wrong positions displayed while
increasing the number of aircraft relative decodes.
Especially useful for people with spotty reception or surface
positions.
  • Loading branch information
wiedehopf committed Oct 31, 2019
1 parent cad39be commit f056418
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 11 additions & 2 deletions track.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static struct aircraft *trackCreateAircraft(struct modesMessage *mm) {
F(nav_modes, 60, 70); // ADS-B or Comm-B
F(cpr_odd, 60, 70); // ADS-B only
F(cpr_even, 60, 70); // ADS-B only
F(position, 60, 70); // ADS-B only
F(position, 60, 10*60); // ADS-B only
F(nic_a, 60, 70); // ADS-B only
F(nic_c, 60, 70); // ADS-B only
F(nic_baro, 60, 70); // ADS-B only
Expand Down Expand Up @@ -418,7 +418,16 @@ static int doLocalCPR(struct aircraft *a, struct modesMessage *mm, double *lat,
if (a->pos_rc < *rc)
*rc = a->pos_rc;

range_limit = 50e3;
range_limit = 1852*100; // 100NM
// 100 NM in the 10 minutes of position validity means 600 knots which
// is fast but happens even for commercial airliners.
// It's not a problem if this limitation fails every now and then.
// A wrong relative position decode would require the aircraft to
// travel 360-100=260 NM in the 10 minutes of position validity.
// This is impossible for planes slower than 1560 knots/Mach 2.3 over the ground.
// Thus this range limit combined with the 10 minutes of position
// validity should not provide bad positions (1 cell away).

relative_to = 1;
} else if (!surface && (Modes.bUserFlags & MODES_USER_LATLON_VALID)) {
reflat = Modes.fUserLat;
Expand Down
5 changes: 1 addition & 4 deletions track.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@
#define DUMP1090_TRACK_H

/* Maximum age of tracked aircraft in milliseconds */
#define TRACK_AIRCRAFT_TTL 300000
#define TRACK_AIRCRAFT_TTL (10*60000)

/* Maximum age of a tracked aircraft with only 1 message received, in milliseconds */
#define TRACK_AIRCRAFT_ONEHIT_TTL 60000

/* Maximum validity of an aircraft position */
#define TRACK_AIRCRAFT_POSITION_TTL 60000

/* Minimum number of repeated Mode A/C replies with a particular Mode A code needed in a
* 1 second period before accepting that code.
*/
Expand Down

0 comments on commit f056418

Please sign in to comment.