FlightAware Discussions

Trying to implement BDS 4,4


I"m doing som research for self-study and I’m trying to implement BDS 4,4 (Meteorological information) into current version of dump1090-fa (got from github), but I’m not having any success :frowning:

I would like to ask for help or any tips where I should look for or what i’m doing wrong…any tip is welcome!

That I’have done:
In the comm_b.c file, I’ve created a new function called “decodeBDS44” and added this function to “comm_b_decoders” list, so it will be called when DF20 or DF21 arrives and call “decodeCommB” function. Not that I’m not scoring at this time, just trying to show in console the decoded data.

I’ve tested and dump1090-fa is calling my bds44 function. And this is the function:

// BDS4,4 Meteorological Information
static int decodeBDS44(struct modesMessage *mm, bool store)
    unsigned char *msg = mm->MB;
     * Source of data
     * 0 = Invalid
     * 1 = INS
     * 2 = GNSS
     * 3 = DME/DME
     * 4 = VOR/DME
     * 5-15 = reserved
    unsigned source = getbits(msg,1,4);
    // Should not be >4 and not 0
    if (source == 0 || source > 4) {
        return 0;
    // Wind speed
    unsigned status_speed_dir = getbit(msg,5);
    unsigned wind_speed_raw = getbits(msg,6,14);
    if (status_speed_dir && wind_speed_raw != 0) { // We have some data!
        printf("[%06X] Wind speed: %u, ",mm->addr,wind_speed_raw);
    // Temperature - doesn't have status field, just sign
    // Lets decode anyway 
    unsigned sign = getbit(msg,24);
    unsigned temperature_raw = getbits(msg,25,34);        
    printf("[%06X] Temperature: ",mm->addr);
    if (sign) { // if sign, it's negative temperature?!
    float temperature = (float)temperature_raw * 0.25;
    return 0;

The problem is that data is always wrong…I can’t get wind speed or (specially) temperature.
To check if incoming data is valid and has temperature/wind, I’m using my ModeSMixer as datasource…
I’m looking into one specific HEX at ModeSMixer to see if it has temperature/wind speed information and compare with results in console…but I never got a good result.

I apreciate any help!

Note: this is the frame information for BDS 4,4:

I’ve never seen a 4,4 in the wild (it may be regional); do you have a sample message that you believe is a 4,4?

Is there any way to save sample data from drump1090-fa or modesmixer? If yes, I can save…
I’m using data from europe.

Since ModeSMixer show temperature/wind speed/wind dir reported by aircraft, I’m assuming this is from BDS 4,4.
Also, BDS 4,4 and 4,5 are the only places where temperature information is present in ICAO DOC 9871 (Mode-S Frames/data specification).

dump1090 will write the raw message to stdout unless you pass --quiet (look for the line with *[bunch of hex]; before the decoded message is written out)

You can derive the wind vector from BDS5,0 + BDS6,0 (compare the ground vector to the airspeed vector); you can derive temperature (approximately) from Mach + TAS, since the speed of sound depends on air temperature. modesmixer may be doing that?

I can’t say by ModeSMixer, but I’m pretty sure it’s from BDS 4,4 and not calculated. But again: I can’t guarantee.
I’m saying this because I have tested with some flights from here (Brasil) and I could not find even one with this information, only from europe (I have a friend there and I have access to their ads-b data).

I’ve saved some samples from there: https://drive.google.com/file/d/1aNIMY1boi0rMFd7faXMzhXJZKjHvEzsP/view?usp=sharing

What message out of that lot do you think is a 4,4? I took a brief look at all the Comm-B messages that dump1090 didn’t recognize as some other format, and none of them look like plausible 4,4 messages as far as I can see? (I would expect the first byte of a 4,4 to be something like 18/19/1A/1B/28/29/2A/2B)

That’s exactly what I’m thinking: dump is not processind these messages…maybe discarding early in ModeS decoder?! I don’t know.

I just sent and message to ‘sergsero’ (autor of ModeSMixer) asking if MSM uses BDS 4,4 or what for wind/wind-dir/temp.

Ahhhh, another observation: for an specific flight, sometimes temperature/wind-speed/wind-dir is not available (all 3 at same time)…then, after some time, it’s available again. One more ‘why’ i think is coming from BDS 4,4.

Another reason for my thinking is that I could not find not even one flight with these information here in Brazil. If it is calculated from other data, this should be work here, at least for international flights on bigger aircrafts (with more recent equipaments)…but nothing! This tell me that there’s no interrogator here (in fact, all airports here are kind of small…specially compared to european airports). Without interrogator, there’s no BDS 4,4!

I mean, there’s interrogators here (for other BDS’s), but not for BDS4,4 (Meteorological data).
That’s my guess.

Do your aircraft have TAS and mach number displayed?

There seems to be at least a Copenhagen radar requesting 4,4 reports:


The demodulator doesn’t care about the MB format. dump1090 will happily demodulate whatever Comm-B response comes along; the question is whether that data is then interpreted or not. You’ll still see the raw messages. Search for “unknown format” in that output above, those are messages where dump1090 couldn’t find a good interpretation of the MB data.

Ah, probably far enough from Cambridge that I don’t hear it.

By the way i found the actual type of the wrong heading BDS5,0 i was getting.
If i remember correctly it’s BDS6,0

So it’s actually a message with magnetic heading and some other stuff.
I don’t remember exactly.
Tried to come up with a way to somehow change the scoring logic in dump1090-fa to better guess in my particular case but eventually gave up on it.

After all it seems to be limited to some very strange transponders.

On the actual topic: Would the following command display messages with unknown format?

view1090-fa --no-interactive | grep 'unknown format'

Oh yes it does and i’m getting quite a few right now.

Edit: A sample of view1090-fa --no-interactive output with unkown format contained if you want to take a look (5 MB)
(Seems to be only one aircraft though, maybe it’s a strange transponder once again.)

In fact, they have!
Do you know the formula for getting temperature from these data? I’ll try to calculate manually and compare to ModeSMixer.

I have some work in progress to try to fix this, but as you discovered it’s a delicate juggling act to score the messages well.

On the 4,4 messages, it seems i am receiving some and was able to decode them with:

Note the 4,4 function is deemed experimental.

I first collect some unkown format messages and save them to a file:

awk '/unknown format/ {print;printf "\n"}' RS= <(view1090-fa --no-interactive) >/tmp/unknown

Then i used this small python script (placed inside the cloned pyModeS directory):


import pyModeS as pms
import sys

temp = []

for line in sys.stdin :
    if line == "\n" :
        msg=temp[0].replace("*", "").replace(";", "")
        if pms.bds.bds44.is44(msg) :
            for line in temp :
                print line,
            print pms.commb.wind44(msg, rev=False)  # Wind speed (kt) and direction (true) (deg)
            print pms.commb.temp44(msg, rev=False)  # Static air temperature (C)
            print pms.commb.p44(msg, rev=False)     # Average static pressure (hPa)
            print pms.commb.hum44(msg, rev=False)   # Humidity (%)
        temp = []

The python script wants view1090-fa output on std input:

./la.py </tmp/unknown2 > /var/www/stuff/sample.txt

The script looks for message blocks that are 4,4 and prints the message block and the wind speed/direction as well as temperature.

Sample output i got:

CRC: 44048a
RSSI: -14.3 dBFS
Time: 113190352518.25us
DF:20 addr:44048A FS:0 DR:0 UM:0 AC:3250 MB:18B3B3D7E77000
 Comm-B, Altitude Reply
  Comm-B format: unknown format
  ICAO Address:  44048A (Mode S / ADS-B)
  Air/Ground:    airborne?
  Baro altitude: 19450 ft

(44.0, 332.6)

More output from the script:

1 Like

This seems plausible (476 hPa matches a baro altitude of 19450ft and the other values seem reasonable)

Got some samples and it’s working here too!
First time i tried to implement BDS 4,4 on dump1090 I used exactly this algoritm from pyModes and didn’t worked (using live data)…but I guess it did and I just didn’t saw results :confused:

Now one question for @obj: is possible do re-use saved data in dump1090 for testing?
Since I know that I have some working data, it’s easier to test/implement this feature using this data. If so, how?!

You can run dump1090 with --net-only --net-ri-port 12345 and then feed the *....; lines to port 12345 e.g. with socat or nc

(I actually have some changes floating around that let you feed it via stdin which is easier, I should dig those up)

tks, I’ll try!!!

Some more 4,4 messages as determined by pyModeS if you want some more to decode:


Am I missing something?! I’m not so familiar with nc.

./dump1090 --net --net-only

pi@raspberrypi:~ $ sudo netstat -plnt | grep dump1090
tcp 0 0* LISTEN 7921/./dump1090
tcp 0 0* LISTEN 7921/./dump1090
tcp 0 0* LISTEN 7921/./dump1090
tcp 0 0* LISTEN 7921/./dump1090
tcp 0 0* LISTEN 7921/./dump1090
tcp 0 0* LISTEN 7921/./dump1090

cat moredata.txt | nc 30001

And nothing happens! nc don’t even end/stop running.