Changeset 11046 in ntrip


Ignore:
Timestamp:
Sep 28, 2026, 11:16:50 AM (16 hours ago)
Author:
stuerze
Message:

updates regarding RTCM-SSR

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm_new.cpp

    r11042 r11046  
    1111#include <stdio.h>
    1212#include <string.h>
     13#include <climits>
    1314#ifndef sparc
    1415#include <stdint.h>
    … …  
    502503  unsigned int satPositions[64], numSatPositions;
    503504  unsigned int freqPositions[ANT_MAXFREQUENCIES], numFreqPositions;
     505  uint64_t satMask;
    504506
    505507  STARTDATA
    … …  
    522524        }
    523525        E_SATELLITE_SET_INDICATOR(a->SatelliteSetIndicator[s])
    524         E_SATELLITE_MASK(a->SatelliteMask[s])
    525 
    526         /* same MSB-first mask convention as D_SATELLITE_MASK/GetSSR */
     526
     527        /* same MSB-first mask convention as D_SATELLITE_MASK/GetSSR; bits
     528           beyond the satellites supported for this system are cleared, since
     529           no Sat[] data exists for them and the mask must match the blocks */
    527530        numSatPositions = 0;
     531        satMask = 0;
    528532        for (k = 0; k < 64 && satoffset[s] + k < satoffset[s + 1]; ++k) {
    529533          if ((a->SatelliteMask[s] >> (63 - k)) & 1ULL) {
    530534            satPositions[numSatPositions++] = satoffset[s] + k;
    531           }
    532         }
     535            satMask |= 1ULL << (63 - k);
     536          }
     537        }
     538        E_SATELLITE_MASK(satMask)
    533539        numSatBlocks = a->SatelliteSetIndicator[s] ? (numSatPositions ? 1 : 0) : numSatPositions;
    534540
    … …  
    557563            }
    558564            if (a->NadirAngleDependentCorrectionIndicator[s]) {
     565              /* DF+021: NaN (invalid) and values outside the range of
     566                 int(3 + DF+015) are sent as the invalid value -2^(n-1) */
     567              unsigned int nb  = 3 + a->NadirAngleDependentCorrectionRangeExtension[s];
     568              double       lim = ldexp(1.0, nb - 1);
    559569              for (deg = 0; deg <= a->maximumOffNadirAngle[s] && deg < ANT_MAXNADIRDEGREES; ++deg) {
    560                 E_NADIR_ANGLE_DEPENDENT_CORRECTION(satBlock.Freq[f].NadirAngleCorrection[deg],
    561                   a->NadirAngleDependentCorrectionRangeExtension[s])
     570                double val = satBlock.Freq[f].NadirAngleCorrection[deg];
     571                double mm  = std::isnan(val) ? -lim : floor(val * 1000.0 + 0.5);
     572                if (mm <= -lim || mm >= lim) {
     573                  mm = -lim;
     574                }
     575                ADDBITS(nb, (int64_t)mm)
    562576              }
    563577            }
    … …  
    12181232
    12191233      /* DF394 satellite mask: MSB (bit 63) = satellite 1 within this system,
    1220          same convention as the MSM satellite mask that shares this field. */
    1221       for (k = 0; k < 64 && satoffset[s] + k < satoffset[s + 1]; ++k) {
     1234         same convention as the MSM satellite mask that shares this field.
     1235         All 64 bits count: a satellite beyond the number supported for this
     1236         system still has its own block on the wire (DF+016 unset), which
     1237         must be read to stay aligned - it is marked UINT_MAX and discarded. */
     1238      for (k = 0; k < 64; ++k) {
    12221239        if ((a->SatelliteMask[s] >> (63 - k)) & 1ULL)
    1223           satPositions[numSatPositions++] = satoffset[s] + k;
     1240          satPositions[numSatPositions++] =
     1241            (satoffset[s] + k < satoffset[s + 1]) ? satoffset[s] + k : UINT_MAX;
    12241242      }
    12251243      numSatBlocks = a->SatelliteSetIndicator[s] ? (numSatPositions ? 1 : 0) : numSatPositions;
    … …  
    12411259          fprintf(stderr, " sat block (shared, PRNs");
    12421260          for (k = 0; k < numSatPositions; ++k)
    1243             fprintf(stderr, " %d", satPositions[k] - satoffset[s] + 1);
     1261            if (satPositions[k] != UINT_MAX)
     1262              fprintf(stderr, " %d", satPositions[k] - satoffset[s] + 1);
    12441263          fprintf(stderr, ") freqSetInd %d freqMask %02x\n",
    12451264            satBlock.FrequencySetIndicator, satBlock.GnssFrequencyMask);
    … …  
    12471266        else {
    12481267          fprintf(stderr, " sat block PRN %d freqSetInd %d freqMask %02x\n",
    1249             satPositions[satBlockIdx] - satoffset[s] + 1,
     1268            satPositions[satBlockIdx] != UINT_MAX ? (int)(satPositions[satBlockIdx] - satoffset[s] + 1) : -1,
    12501269            satBlock.FrequencySetIndicator, satBlock.GnssFrequencyMask);
    12511270        }
    … …  
    12671286            D_NADIR_CORRECTION(satBlock.Freq[f].NadirCorrection)
    12681287          if (a->NadirAngleDependentCorrectionIndicator[s]) {
    1269             for (deg = 0; deg <= a->maximumOffNadirAngle[s] && deg < ANT_MAXNADIRDEGREES; ++deg)
    1270               D_NADIR_ANGLE_DEPENDENT_CORRECTION(satBlock.Freq[f].NadirAngleCorrection[deg],
    1271                 a->NadirAngleDependentCorrectionRangeExtension[s])
     1288            /* DF+021: int(3 + DF+015) in mm; the minimum value -2^(n-1)
     1289               means "invalid" and is stored as NaN */
     1290            unsigned int nb = 3 + a->NadirAngleDependentCorrectionRangeExtension[s];
     1291            for (deg = 0; deg <= a->maximumOffNadirAngle[s] && deg < ANT_MAXNADIRDEGREES; ++deg) {
     1292              double raw;
     1293              GETSSRFLOATSIGN(raw, nb, 1.0)
     1294              satBlock.Freq[f].NadirAngleCorrection[deg] =
     1295                (raw == -ldexp(1.0, nb - 1)) ? NAN : raw / 1000.0;
     1296            }
    12721297          }
    12731298#ifdef BNC_DEBUG_SSR
    … …  
    12881313        if (a->SatelliteSetIndicator[s]) {
    12891314          for (k = 0; k < numSatPositions; ++k)
    1290             a->Sat[satPositions[k]] = satBlock;
    1291         }
    1292         else {
     1315            if (satPositions[k] != UINT_MAX)
     1316              a->Sat[satPositions[k]] = satBlock;
     1317        }
     1318        else if (satPositions[satBlockIdx] != UINT_MAX) {
    12931319          a->Sat[satPositions[satBlockIdx]] = satBlock;
    12941320        }
    … …  
    12961322    }
    12971323    else {
    1298       /* COBOFS_SATANT / COBOFS_REGIONO: message numbers are
     1324      /* COBOFS_REGIONO: message numbers are
    12991325         recognized (see setCorType()) but decoding is not implemented yet */
    13001326      return GCOBR_UNKNOWNTYPE;
    … …  
    15221548    if (freqIndex == 0) return "C2"; // B1
    15231549    if (freqIndex == 1) return "C6"; // B3
    1524     if (freqIndex == 2) return "C7"; // B2
    1525     if (freqIndex == 3) return "C5"; // B2a
    1526     if (freqIndex == 4) return "C7"; // B2b (same t_frequency::type as B2)
     1550    if (freqIndex == 2) return "C7";  // B2  (BDS-2)
     1551    if (freqIndex == 3) return "C5";  // B2a
     1552    if (freqIndex == 4) return "C7b"; // B2b (BDS-3) - same carrier and t_frequency::type as B2,
     1553                                      // own label so that PPP can select by satellite generation
     1554                                      // (see t_pppSatObs::cmpModel())
    15271555    if (freqIndex == 5) return "C1"; // B1C
    15281556    break;
Note: See TracChangeset for help on using the changeset viewer.