Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When BDS60 receives IRS ROCD as all 1's conver them to 0 as either al… #47

Merged
merged 1 commit into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
When BDS60 receives IRS ROCD as all 1's conver them to 0 as either al…
…l 0 or all 1 = 0fpm
  • Loading branch information
Douglasdc3 committed Oct 9, 2022
commit 64df1abeac6d364d24c4c60b26dd13033f8a94db
2 changes: 1 addition & 1 deletion src/main/java/aero/t2s/modes/decoder/df/bds/Bds60.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Bds60(short[] data) {
}

double irsSign = ((data[9] >> 1) & 0x1) == 1 ? -512.0 : 0.0;
irsRocd = (((data[9] & 0x1) << 8 | data[10]) + irsSign) * ROCD_ACCURCY;
irsRocd = ((((data[9] & 0x1) << 8 | data[10]) + irsSign) * ROCD_ACCURCY) % 16384;
if (statusIrsRocd) {
if (irsRocd < -8000 || irsRocd > 6000) {
invalidate();
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/aero/t2s/modes/decoder/df/DfRealMessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,31 @@ public void test_df20_bds60_800736() throws UnknownDownlinkFormatException {
assertEquals(101.7, bds.getMagneticHeading(), 0.1);
}

@Test
public void test_df21_bds60_4CA708() throws UnknownDownlinkFormatException {
DownlinkFormat df = testMessage("A8800337D439E730BFE600C28696");

assertInstanceOf(DF21.class, df);
DF21 df21 = (DF21) df;
assertEquals("4CA708", df.getIcao());
assertEquals(2547, df21.getModeA());

assertTrue(df21.isValid());
assertInstanceOf(Bds60.class, df21.getBds());

Bds60 bds = (Bds60) df21.getBds();
assertTrue(bds.isStatusIrsRocd());
assertEquals(0, bds.getIrsRocd(), 0.1);
assertTrue(bds.isStatusBaroRocd());
assertEquals(-128, bds.getBaroRocd(), 0.1);
assertTrue(bds.isStatusIas());
assertEquals(243, bds.getIas());
assertTrue(bds.isStatusMach());
assertEquals(0.77, bds.getMach(), 0.1);
assertTrue(bds.isStatusMagneticHeading());
assertEquals(236.7, bds.getMagneticHeading(), 0.1);
}

private DownlinkFormat testMessage(String message) throws UnknownDownlinkFormatException {
Decoder decoder = new Decoder(new HashMap<>(), 50, 2, ModeSDatabase.createDatabase());

Expand Down