From 2e770cee8b679dcb8f8b06c053d208555aa58882 Mon Sep 17 00:00:00 2001 From: Zilog80 Date: Fri, 12 Jun 2020 13:06:08 +0200 Subject: [PATCH] DFM: geoid data, MSL = alt_ellipsoid + dMSL --- demod/mod/dfm09mod.c | 31 +++++++++++++++++++++++++++---- dfm/dfm06.txt | 8 ++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/demod/mod/dfm09mod.c b/demod/mod/dfm09mod.c index d5372d5..7396514 100644 --- a/demod/mod/dfm09mod.c +++ b/demod/mod/dfm09mod.c @@ -52,6 +52,12 @@ typedef struct { ui32_t chX[2]; } sn_t; +typedef struct { + ui32_t prn; // SVs used (PRN) + float dMSL; // Alt_MSL - Alt_ellipsoid = -N = - geoid_height = ellipsoid - geoid + ui8_t nSV; // numSVs used +} gpsdat_t; + #define BITFRAME_LEN 280 typedef struct { @@ -74,6 +80,7 @@ typedef struct { pcksts_t pck[9]; option_t option; int ptu_out; + gpsdat_t gps; } gpx_t; @@ -294,6 +301,9 @@ static int dat_out(gpx_t *gpx, ui8_t *dat_bits, int ec) { } } + // GPS data + // SiRF msg ID 41: Geodetic Navigation Data + if (fr_id == 0) { //start = 0x1000; frnr = bits2val(dat_bits+24, 8); @@ -301,7 +311,8 @@ static int dat_out(gpx_t *gpx, ui8_t *dat_bits, int ec) { } if (fr_id == 1) { - // 00..31: ? GPS-Sats in Sicht? + // 00..31: GPS-Sats in solution (bitmap) + gpx->gps.prn = bits2val(dat_bits, 32); // SV/PRN used msek = bits2val(dat_bits+32, 16); // UTC (= GPS - 18sec ab 1.1.2017) gpx->sek = msek/1000.0; } @@ -328,6 +339,8 @@ static int dat_out(gpx_t *gpx, ui8_t *dat_bits, int ec) { } if (fr_id == 5) { + short dMSL = bits2val(dat_bits, 16); + gpx->gps.dMSL = dMSL/1e2; } if (fr_id == 6) { // sat data @@ -342,6 +355,7 @@ static int dat_out(gpx_t *gpx, ui8_t *dat_bits, int ec) { gpx->tag = bits2val(dat_bits+16, 5); gpx->std = bits2val(dat_bits+21, 5); gpx->min = bits2val(dat_bits+26, 6); + gpx->gps.nSV = bits2val(dat_bits+32, 8); } ret = fr_id; @@ -733,6 +747,16 @@ static void print_gpx(gpx_t *gpx) { } printf("\n"); + if (gpx->option.sat) { + printf(" "); + printf(" dMSL: %+.2f", gpx->gps.dMSL); // MSL = alt + gps.dMSL + printf(" sats: %d", gpx->gps.nSV); + printf(" ("); + for (j = 0; j < 32; j++) { if ((gpx->gps.prn >> j)&1) printf(" %02d", j+1); } + printf(" )"); + printf("\n"); + } + if (gpx->option.jsn && jsonout) { // JSON Buffer to store sonde ID @@ -1058,6 +1082,7 @@ int main(int argc, char **argv) { option_min = 1; } else if (strcmp(*argv, "--dbg") == 0) { gpx.option.dbg = 1; } + else if (strcmp(*argv, "--sat") == 0) { gpx.option.sat = 1; } else if (strcmp(*argv, "-") == 0) { int sample_rate = 0, bits_sample = 0, channels = 0; ++argv; @@ -1122,7 +1147,6 @@ int main(int argc, char **argv) { gpx.option.dst = option_dist; gpx.option.jsn = option_json; - headerlen = strlen(dfm_rawheader); @@ -1259,7 +1283,6 @@ int main(int argc, char **argv) { // optional: // normalize soft bit s_j by // rhsbit.sb /= dsp._spb+1; // all samples in [-1,+1] - } if ( bitQ == EOF ) { frm = nfrms; break; } // liest 2x EOF @@ -1285,12 +1308,12 @@ int main(int argc, char **argv) { pos = headerlen; } + if (!option_bin) free_buffers(&dsp); else { if (hdb.buf) { free(hdb.buf); hdb.buf = NULL; } } - fclose(fp); return 0; diff --git a/dfm/dfm06.txt b/dfm/dfm06.txt index ff16990..7fe94e2 100644 --- a/dfm/dfm06.txt +++ b/dfm/dfm06.txt @@ -15,12 +15,14 @@ erweiterter systematischer [8,4]-Hamming-Code, erste 4 bit sind Daten Big Endian +(SiRF msg ID 41: Geodetic Navigation Data) GPS_DAT-Block 48bit + 4bit-PCK_ID 0x0..0x8 (letztes nibble): PCK_ID bitpos 0x0 24..31 Counter: 8 bit -0x1 32..47 UTC-msec : 16bit (sec*1e3), GPS = UTC + 18s (ab 1. Jan. 2017) +0x1 0..31 SV/PRN bitmap + 32..47 UTC-msec : 16bit (sec*1e3), GPS = UTC + 18s (ab 1. Jan. 2017) 0x2 0..31 GPS-lat : 32bit, Faktor 1e7 32..47 hor-V m/s: 16bit, Faktor 1e2 @@ -28,9 +30,11 @@ PCK_ID bitpos 0x3 0..31 GPS-lon : 32bit, Faktor 1e7 32..47 direction: 16bit, Faktor 1e2 (unsigned, 0-36000) -0x4 0..31 GPS-alt m: 32bit, Faktor 1e2 +0x4 0..31 GPS-alt m: 32bit, Faktor 1e2 (Alt_ellipsoid) 32..47 ver-V m/s: 16bit, Faktor 1e2 (signed) +0x5 0..15 dMSL = Alt_MSL - Alt_ellipsoid = -N = -geoid_height , Faktor 1e2 (signed) + 0x8 0..11 Jahr : 12bit 12..15 Monat: 4bit 16..20 Tag : 5bit