junzis / pyModeS

Python decoder for Mode S and ADS-B signals
GNU General Public License v3.0
529 stars 151 forks source link

MRAR capability #20

Closed AntRivas16 closed 4 years ago

AntRivas16 commented 6 years ago

Hello guys,

First of all, my name is Antonio and I'm developing a project in which we want to receive Mode-S MRAR (BDS 4,4), so when I discovered pyModeS I thought I had found the perfect solution.

I have downloaded it and, after reading the book and playing with the programme, two problems/doubts came up:

Thank you so much for your help.

Note: I'm using a SBS-3 receiver.

junzis commented 6 years ago

Hi @AntRivas16, the streaming function will be one of our goal for the new pyModeS release. You can see the code and progress in the dev-2.0 branch, specifically the streamer package: https://github.com/junzis/pyModeS/tree/dev-2.0/pyModeS/streamer

However, the new version is not fully ready yet. The MRAR functions are especially weak at this moment, and it is not integrated in the streamer. This is because we don't have MRAR data to test (no MRAR interrogation occurs in our region by ATC).

By the way, would it be possible for you to share some of your data?


I am pointing out a shortcut for you to use pyModeS for MRAR here. However, you will have to learn a few python basic to get things running.

  1. First, you need to record the raw messages from you SBS-3 receiver. I am not sure about the output options of this receiver. But we have to obtain raw messages in the hexadecimal format like: A000153B188B0FD1800000132DD6

  2. iInstall the dev-2.0 version following instruction on: https://github.com/junzis/pyModeS/tree/dev-2.0

  3. Use the following function to detect and decode if a message is an MRAR message:

def decode_mrar(message):
    import pyModeS as pms

    # first check the possibility of other bds types
    bds = pms.bds.infer(message)
    if bds is not None:
        return None

    is44 = pms.bds.bds44.is44(message)

    if not is44:
        return None

    wspd, wdir = pms.bds.bds44.wind44(msg)  # wind speed (kt) and direction (deg)
    temp = pms.bds.bds44.temp44(msg)        # temperature (C)
    press = pms.bds.bds44.p44(msg)          # pressure (hPa)
    hum = pms.bds.bds44.hum44(msg)          # humidity (%)

    return wspd, wdir, temp, press, hum
AntRivas16 commented 6 years ago

Hi junzis,

First of all, thank so much for your help.

I've been talking with the project leader and the conclusion has not been as positive as I had expected because we need a device which could send an interrogation and receive its response. However SBS-3 is only a receiver so the only way to obtain messages as MRAR is receiving the responses to interrogations made by others devices.

I will try this option. Nevertheless, before that I have to investigate how could be configure the software to save the hexadecimal message format.

As soon as I could I will report you if I had good news

adsb-related-code commented 6 years ago

Hi junzis,

ADSBexchange can provide you with a live raw hex data stream to continue development. Send me an email james adsbexchange.com

Thanks, James

junzis commented 6 years ago

@adsbxchange Thanks, James! That's great. I will send you an email. Cheers!

nunojpg commented 5 years ago

Hi @junzis,

I took a look at your code regading this feature, and while it is documented, it seems there are no unit tests and no way to validate the implementation.

For eg. the temperature on the unrevised version is being calculated with a LSb of 0.125ºC while I think the LSb is 0.25ºC.

Do you have any real and confirmed test data available?

Thanks!

junzis commented 5 years ago

Hi @nunojpg, 0.25 is what is indicated in ICAO Doc.9871. However, we believe it was a mistake in the original ICAO document.

If one want to use 10 bit to the represent 128 (decimal), the lowest should be 0.125 (=128 / 2^10). This is also what has been corrected in the revision BDS 44 and 45.

But till now, I still don't know whether manufacutres are using the wrong implementation or they spotted the mistake. Without proper validation messages, I can not say which is "more correct"...

nunojpg commented 5 years ago

Would be so nice if someone could get the hands on validated DF20 and 21 frames with Asterix decoding, so reliable unit tests could be provided. I think I need to beg to Eurocontrol or some kind ATC provider.

marius190 commented 4 years ago

I've made some test comparing MRAR data and meteorological derived data from BDS 5.0 and BDS 6.0 and it looks like the temperature explained in the ICAO document is the correct one.