Remove comm-b "consistency" bonuses, look at inconsistent data only.

Rescale penalties so badly inconsistent messages will tend to get
the same penalty in all formats, so the ambiguity check kicks in.

With this final change the HEADING_SPEED and TRACK_TURN message rates
are almost identical, which is what we'd expect to see if the
interrogator is asking for both at about the same rate.

Before:

    567 AMBIGUOUS
   7445 GICB_CAPS
  19173 EMPTY_RESPONSE
  75252 UNKNOWN
  76469 AIRCRAFT_IDENT
 127603 ACAS_RA
 212654 HEADING_SPEED
 223068 DATALINK_CAPS
 229807 TRACK_TURN
 269267 VERTICAL_INTENT
    466 "suspicious"

After:

   7445 GICB_CAPS
  17432 AMBIGUOUS
  19173 EMPTY_RESPONSE
  75252 UNKNOWN
  76469 AIRCRAFT_IDENT
 127603 ACAS_RA
 212718 HEADING_SPEED
 212878 TRACK_TURN
 223068 DATALINK_CAPS
 269267 VERTICAL_INTENT
    328 "suspicious"
This commit is contained in:
Oliver Jowett 2019-05-02 18:19:27 +08:00
parent 5eb0bd10ea
commit 39aeb7a48c

View file

@ -358,29 +358,24 @@ static int decodeBDS40(struct modesMessage *mm, bool store)
return 0; return 0;
} }
// small bonuses for consistent data // small penalty for inconsistent data
if (mcp_valid && fms_valid && mcp_alt == fms_alt) { if (mcp_valid && fms_valid && mcp_alt != fms_alt) {
score += 2; score -= 4;
}
if (baro_valid && baro_raw == 2132) {
// 1013.2mb, standard pressure
score += 2;
} }
if (mcp_valid) { if (mcp_valid) {
unsigned remainder = mcp_alt % 500; unsigned remainder = mcp_alt % 500;
if (remainder < 16 || remainder > 484) { if (!(remainder < 16 || remainder > 484)) {
// mcp altitude is a multiple of 500 // mcp altitude is not a multiple of 500
score += 2; score -= 4;
} }
} }
if (fms_valid) { if (fms_valid) {
unsigned remainder = fms_alt % 500; unsigned remainder = fms_alt % 500;
if (remainder < 16 || remainder > 484) { if (!(remainder < 16 || remainder > 484)) {
// fms altitude is a multiple of 500 // fms altitude is not a multiple of 500
score += 2; score -= 4;
} }
} }
@ -544,13 +539,11 @@ static int decodeBDS50(struct modesMessage *mm, bool store)
return 0; return 0;
} }
// small bonuses for consistent data // small penalty for inconsistent data
if (gs_valid && tas_valid) { if (gs_valid && tas_valid) {
int delta = abs((int)gs_valid - (int)tas_valid); int delta = abs((int)gs_valid - (int)tas_valid);
if (delta < 50) { if (delta > 150) {
score += 5; score -= 6;
} else if (delta > 150) {
score -= 5;
} }
} }
@ -558,10 +551,8 @@ static int decodeBDS50(struct modesMessage *mm, bool store)
if (roll_valid && tas_valid && tas > 0 && track_rate_valid) { if (roll_valid && tas_valid && tas > 0 && track_rate_valid) {
double turn_rate = 68625 * tan(roll * M_PI / 180.0) / (tas * 20 * M_PI); double turn_rate = 68625 * tan(roll * M_PI / 180.0) / (tas * 20 * M_PI);
double delta = fabs(turn_rate - track_rate); double delta = fabs(turn_rate - track_rate);
if (delta < 0.5) { if (delta > 2.0) {
score += 5; score -= 6;
} else if (delta > 2.0) {
score -= 5;
} }
} }
@ -704,16 +695,14 @@ static int decodeBDS60(struct modesMessage *mm, bool store)
return 0; return 0;
} }
// small bonuses for consistent data // small penalty for inconsistent data
// Should check IAS vs Mach at given altitude, but the maths is a little involved // Should check IAS vs Mach at given altitude, but the maths is a little involved
if (baro_rate_valid && inertial_rate_valid) { if (baro_rate_valid && inertial_rate_valid) {
int delta = abs(baro_rate - inertial_rate); int delta = abs(baro_rate - inertial_rate);
if (delta < 500) { if (delta > 2000) {
score += 5; score -= 12;
} else if (delta > 2000) {
score -= 5;
} }
} }