dl9rdz / rdz_ttgo_sonde

270 stars 94 forks source link

M10/M20 provisional frame counter #322

Closed rs1729 closed 5 months ago

rs1729 commented 2 years ago

In https://github.com/dl9rdz/rdz_ttgo_sonde/blob/9761f9cee14f403aae5020a6a50429bf5b59ff77/RX_FSK/src/M10M20.cpp#L406 subtraction of 18 leap seconds is hard coded. However an offline decoder never knows if this is up-to-date or when it changed. Also if the next change will happen, using older versions would give different results.

vframe adds the 18 seconds again, and it looks like vframe is used in the JSON "frame" field, but still there is a difference of 18 seconds to the auto_rx date on sondehub. The M10 and M20 decoders in auto_rx use the GPS time as the base for calculating the provisional frame counter. The M10 reports the leap seconds in the data, but that is only used for the JSON "datetime" field, also there is the additional field "ref_datetime" to make clear if "datetime" is UTC or GPS.

For "datetime" you also add the 18 seconds again. https://github.com/dl9rdz/rdz_ttgo_sonde/blob/affcde4f26f7b7ebb5faf5ef577e24593dcc202e/RX_FSK/RX_FSK.ino#L3595

So there are different places that add/subtract the leap seconds (no global constant), but this works only as long as the 18 seconds are still valid. Don't know if you can use this code for older transmission, then it would fail as well.

rs1729 commented 5 months ago

Re: Sondehub upload

rdz_ttgo_sonde seems to calculate the M20 frame number based on UTC (after converting to UTC?), although the date/time in the data is GPS time. As a consequence there are different entries for the same frame on Sondehub. E.g.

Sat 2024-04-06 05:34:00.000  lat: 45.76036  lon: 14.93947  alt: 14622.44   vH:  8.1  D: 123.9  vV: -2.1   SN: 401-2-00977  #  [OK]  T:-63.0C RH=0% P=128.2hPa 

RS/radiosonde_auto_rx/dxlAPRS:

{"alt": 14622.44, "batt": 2.19, "datetime": "2024-04-06T05:34:00.000000Z", "frame": 1396416840, "frequency": 403.001, "heading": 123.94471, "humidity": 0.3, "lat": 45.76036, "launch_site": "14015", "launch_site_range_estimate": 506.9520749045219, "lon": 14.93947, "manufacturer": "Meteomodem", "position": "45.76036,14.93947", "pressure": 128.17, "ref_datetime": "GPS", "ref_position": "GPS", "serial": "401-2-00977", "snr": 9.9, "software_name": "radiosonde_auto_rx", "software_version": "1.7.1", "temp": -63.0, "time_received": "2024-04-06T05:33:42.680573Z", "type": "M20", "upload_time_delta": -1.261, "vel_h": 8.11257, "vel_v": -2.08}

rdzTTGOsonde:

{"alt": 14622.44043, "datetime": "2024-04-06T05:34:00.000Z", "frame": 1396416822, "frequency": 403.005, "heading": 123.94472, "lat": 45.76036, "lon": 14.93947, "manufacturer": "Meteomodem", "position": "45.76036,14.93947", "rssi": -112.0, "serial": "401-2-00977", "software_name": "rdzTTGOsonde", "software_version": "devel20240225", "time_received": "2024-04-06T05:33:42.000Z", "type": "M20", "upload_time_delta": -16.59, "vel_h": 8.11257, "vel_v": -2.08, "launch_site": "14015", "launch_site_range_estimate": 506.9520749045219}

frame(auto_rx)-frame(rdz_ttgo)=18