Skip to content

Commit e21059f

Browse files
committed
Improve BDS50/60 detection based on inverse rocd on irs/baro
1 parent c08f043 commit e21059f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/main/java/aero/t2s/modes/decoder/df/bds/Bds60.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ public Bds60(short[] data) {
106106
}
107107
}
108108

109+
if ((irsRocd > 0 && baroRocd < 0) || (irsRocd < 0 && baroRocd > 0)) {
110+
// Aircraft cannot be climbing and descending at the same time
111+
if (Math.abs(irsRocd) > 1000 && Math.abs(baroRocd) > 1000) {
112+
invalidate();
113+
return;
114+
}
115+
}
116+
109117
if (statusMach && statusIas && data[0] >>> 3 == 20) {
110118
double altitude = AltitudeEncoding.decode((data[2] & 0x1F) << 8 | data[3]).getAltitude();
111119
if (altitude > 0) {

src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public void test_df20_bds50_48418A() throws UnknownDownlinkFormatException {
340340
}
341341

342342
@Test
343-
public void test_df16_bds50_48418A() throws UnknownDownlinkFormatException {
343+
public void test_df16_02A198() throws UnknownDownlinkFormatException {
344344
DownlinkFormat df = testMessage("80C18819584195384EF8505941FD");
345345

346346
assertInstanceOf(DF16.class, df);
@@ -366,6 +366,32 @@ public void test_df16_bds50_48418A() throws UnknownDownlinkFormatException {
366366
assertFalse(df16.isRANotTurnRight());
367367
}
368368

369+
@Test
370+
public void test_df21_bds50_02A185() throws UnknownDownlinkFormatException {
371+
DownlinkFormat df = testMessage("A8001AA0F4596112BDFC569A3AEC");
372+
373+
assertInstanceOf(DF21.class, df);
374+
DF21 df21 = (DF21) df;
375+
assertEquals("02A185", df.getIcao()); // Military / corrupt transponder
376+
assertEquals(7110, df21.getModeA());
377+
378+
assertFalse(df21.isMultipleMatches());
379+
assertTrue(df21.isValid());
380+
assertEquals(Bds50.class, df21.getBds().getClass());
381+
382+
Bds50 bds = (Bds50) df21.getBds();
383+
assertTrue(bds.isStatusGs());
384+
assertEquals(148, bds.getGs(), 0.1);
385+
assertTrue(bds.isStatusTas());
386+
assertEquals(172, bds.getTas(), 0.1);
387+
assertTrue(bds.isStatusRollAngle());
388+
assertEquals(-16.5, bds.getRollAngle(), 0.1);
389+
assertTrue(bds.isStatusTrueAngleRate());
390+
assertEquals(-2.0, bds.getTrackAngleRate(), 0.1);
391+
assertTrue(bds.isStatusTrackAngle());
392+
assertEquals(210.9, bds.getTrueTrack(), 0.1);
393+
}
394+
369395
private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException {
370396
Decoder decoder = new Decoder(new HashMap<>(), 50, 2, ModeSDatabase.createDatabase());
371397

0 commit comments

Comments
 (0)