Changeset 11083 in ntrip for trunk/BNC/src


Ignore:
Timestamp:
Oct 12, 2026, 3:32:43 PM (2 weeks ago)
Author:
stuerze
Message:

further fixes and improvements

Location:
trunk/BNC/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp

    r11074 r11083  
    12751275    if (bdt) {
    12761276      epoSecBds += 14.0;
    1277       if (epoSecBds > 604800.0) {
     1277      if (epoSecBds >= 604800.0) {
    12781278        epoSecBds -= 7.0*24.0*60.0*60.0;
    12791279      }
    … …  
    12891289  }
    12901290
     1291  // The epoch is given as seconds of week (or of day): move it by whole days
     1292  // to the one closest to the current time. Folding in 12 h steps (as
     1293  // before) stopped at the edge of the +-12 h window, e.g. at the week
     1294  // change a correction of Saturday 23:59:55 received after midnight ended
     1295  // up at Sunday 11:59:55.
    12911296  if (_lastTime.valid()) {
    1292     double maxDiff = 12 * 3600.0;
    1293     while (_lastTime < currentTime - maxDiff) {
    1294       _lastTime = _lastTime + maxDiff;
    1295     }
    1296     while (_lastTime > currentTime + maxDiff) {
    1297       _lastTime = _lastTime - maxDiff;
     1297    const double halfDay = 12 * 3600.0;
     1298    const double day     = 24 * 3600.0;
     1299    while (_lastTime < currentTime - halfDay) {
     1300      _lastTime = _lastTime + day;
     1301    }
     1302    while (_lastTime > currentTime + halfDay) {
     1303      _lastTime = _lastTime - day;
    12981304    }
    12991305  }
  • trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.cpp

    r11042 r11083  
    9797            break;
    9898          case CLOCKORBIT_SATGLONASS:
    99             E_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     99            E_GLONASS_SATELLITE_ID_OLD(co->Sat[i].ID)
    100100            E_GLONASS_IOD(co->Sat[i].IOD)
    101101            break;
    … …  
    161161            break;
    162162          case CLOCKORBIT_SATGLONASS:
    163             E_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     163            E_GLONASS_SATELLITE_ID_OLD(co->Sat[i].ID)
    164164            break;
    165165        }
    … …  
    221221            break;
    222222          case CLOCKORBIT_SATGLONASS:
    223             E_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     223            E_GLONASS_SATELLITE_ID_OLD(co->Sat[i].ID)
    224224            E_GLONASS_IOD(co->Sat[i].IOD)
    225225            break;
    … …  
    294294            break;
    295295          case CLOCKORBIT_SATGLONASS:
    296             E_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     296            E_GLONASS_SATELLITE_ID_OLD(co->Sat[i].ID)
    297297            break;
    298298        }
    … …  
    334334            break;
    335335          case CLOCKORBIT_SATGLONASS:
    336             E_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     336            E_GLONASS_SATELLITE_ID_OLD(co->Sat[i].ID)
    337337            break;
    338338        }
    … …  
    385385            break;
    386386          case CLOCKORBIT_SATGLONASS:
    387             E_GLONASS_SATELLITE_ID(cb->Sat[i].ID)
     387            E_GLONASS_SATELLITE_ID_OLD(cb->Sat[i].ID)
    388388            break;
    389389        }
    … …  
    442442            break;
    443443          case CLOCKORBIT_SATGLONASS:
    444             E_GLONASS_SATELLITE_ID(pb->Sat[i].ID)
     444            E_GLONASS_SATELLITE_ID_OLD(pb->Sat[i].ID)
    445445            break;
    446446        }
  • trunk/BNC/src/bnchelp.html

    r11081 r11083  
    43374337  </p>
    43384338  <p>
    4339     To compare satellite clocks provided by the two files, BNC first converts coordinate differences dX,dY,dZ
    4340     into along track, out-of-plane, and radial components. It then corrects the clock differences for the radial
    4341     components
    4342     of coordinate differences. RMS values of clock differences are finally calculated after introducing at first one
    4343     offset
    4344     'per epoch for all satellites' and secondly one offset 'per satellite for all epochs'.
     4339    To compare the orbits, BNC converts the coordinate differences dX,dY,dZ into radial, along-track and out-of-plane
     4340    components, using the satellite velocity derived from neighbouring epochs.
     4341  </p>
     4342  <p>
     4343    The clocks of two products usually differ by an offset common to all satellites of a system, which changes from
     4344    epoch to epoch (clock datum), and by a constant offset per satellite (e.g. different realizations of the satellite
     4345    code biases). For each system, BNC therefore estimates from all clock differences in a least-squares adjustment
     4346    one offset 'per epoch for all satellites' and one offset 'per satellite for all epochs' (column 'Offset'), with
     4347    the sum of the satellite offsets constrained to zero. The clock residuals of this adjustment ('clk') are then
     4348    corrected for the radial component of the orbit differences ('clkRed'). The signal-in-space difference ('SIS',
     4349    radial orbit difference minus clock difference) removes only the epoch offset, i.e. it contains the satellite
     4350    offsets.
     4351  </p>
     4352  <p>
     4353    The epoch offsets are eliminated from the normal equations before the satellite offsets are solved for; the
     4354    result is identical to that of the complete adjustment. This keeps the comparison fast also for long or densely
     4355    sampled files: comparing two daily files with 30-second sampling (2880 epochs) takes a few seconds.
    43454356  </p>
    43464357  <p><img src="IMG/Figure15.png" width=800 /></p>
  • trunk/BNC/src/combination/bnccomb.cpp

    r11079 r11083  
    15251525    // 30 min and are valid for ±900 s around the reference time (TOC).
    15261526    // t_ephGlo::position() uses Runge-Kutta integration from TOC; beyond
    1527     // ±900 s the integration error grows unchecked and propagates into both
    1528     // the combined clock estimate and the SP3 position.
     1527    // that the integration error grows and propagates into both the
     1528    // combined clock estimate and the SP3 position. A margin of 60 s is
     1529    // allowed, as ACs switch to the next ephemeris a few seconds before its
     1530    // window begins (otherwise satellites drop out at every switch).
    15291531    if (corr->_eph->prn().system() == 'R') {
    15301532      double age = epoTime - corr->_eph->TOC();
    1531       if (fabs(age) > 900.0) {
     1533      if (fabs(age) > 960.0) {
    15321534        emit newMessage(QString().asprintf(
    15331535          "bncComb: skip %s, GLONASS eph age %.0fs",
  • trunk/BNC/src/orbComp/sp3Comp.cpp

    r11076 r11083  
    178178  }
    179179
    180   int nPar = epochs.size() + clkSats.size();
    181   SymmetricMatrix NN(nPar); NN = 0.0;
    182   ColumnVector    bb(nPar); bb = 0.0;
    183 
    184   // Create Matrix A'A and vector b
    185   // ------------------------------
    186   for (unsigned ie = 0; ie < epochs.size(); ie++) {
     180  // Least-squares adjustment of an epoch-specific offset (common to all
     181  // satellites) and a satellite-specific offset (common to all epochs), the
     182  // sum of the satellite offsets constrained to zero (weight 1). The normal
     183  // equations of the epoch offsets are diagonal, so these offsets are
     184  // eliminated (Schur complement) and only the satellite offsets are solved
     185  // for; the epoch offsets follow from them. The solution is identical to
     186  // that of the full system, but the effort grows only linearly with the
     187  // number of epochs (before: cubic).
     188  // -----------------------------------------------------------------------
     189  int nEpo = epochs.size();
     190  int nSat = clkSats.size();
     191  int nPar = nEpo + nSat;
     192
     193  vector<vector<int> >    satIdx(nEpo);   // satellites (index) of each epoch
     194  ColumnVector    nEp(nEpo); nEp = 0.0;   // number of satellites per epoch
     195  ColumnVector    bEp(nEpo); bEp = 0.0;   // sum of the differences per epoch
     196  SymmetricMatrix NS(nSat);  NS  = 1.0;   // regularization: sum of satellite offsets
     197  ColumnVector    bS(nSat);  bS  = 0.0;
     198  for (int ie = 0; ie < nEpo; ie++) {
    187199    const map<t_prn, double>& dc = epochs[ie]->_dc;
    188     Matrix       AA(dc.size(), nPar); AA = 0.0;
    189     ColumnVector ll(dc.size());       ll = 0.0;
    190     map<t_prn, double>::const_iterator it;
    191     int ii = -1;
    192     for (it = dc.begin(); it != dc.end(); it++) {
    193       const t_prn& prn = it->first;
    194       if (satIndex(clkSats, prn) != -1) {
    195         ++ii;
    196         int index = epochs.size() + satIndex(clkSats, prn);
    197         AA[ii][ie]    = 1.0; // epoch-specfic offset (common for all satellites)
    198         AA[ii][index] = 1.0; // satellite-specific offset (common for all epochs)
    199         ll[ii]        = it->second;
    200       }
    201     }
    202     SymmetricMatrix dN; dN << AA.t() * AA;
    203     NN += dN;
    204     bb += AA.t() * ll;
    205   }
    206 
    207   // Regularize NN
    208   // -------------
    209   RowVector HH(nPar);
    210   HH.columns(1, epochs.size())      = 0.0;
    211   HH.columns(epochs.size()+1, nPar) = 1.0;
    212   SymmetricMatrix dN; dN << HH.t() * HH;
    213   NN += dN;
    214 
    215   // Estimate Parameters
    216   // -------------------
    217   ColumnVector xx = NN.i() * bb;
     200    for (map<t_prn, double>::const_iterator it = dc.begin(); it != dc.end(); it++) {
     201      int is = satIndex(clkSats, it->first);
     202      if (is != -1) {
     203        satIdx[ie].push_back(is);
     204        nEp[ie]     += 1.0;
     205        bEp[ie]     += it->second;
     206        NS(is+1, is+1) += 1.0;
     207        bS[is]      += it->second;
     208      }
     209    }
     210  }
     211
     212  // Eliminate the epoch offsets
     213  // ---------------------------
     214  for (int ie = 0; ie < nEpo; ie++) {
     215    const vector<int>& idx = satIdx[ie];
     216    for (unsigned ia = 0; ia < idx.size(); ia++) {
     217      bS[idx[ia]] -= bEp[ie] / nEp[ie];
     218      for (unsigned ib = 0; ib <= ia; ib++) {
     219        NS(idx[ia]+1, idx[ib]+1) -= 1.0 / nEp[ie];
     220      }
     221    }
     222  }
     223
     224  // Estimate Parameters (epoch offsets first, then satellite offsets)
     225  // ---------------------------------------------------------------
     226  ColumnVector yy = NS.i() * bS;
     227  ColumnVector xx(nPar);
     228  for (int ie = 0; ie < nEpo; ie++) {
     229    double sum = bEp[ie];
     230    for (unsigned ia = 0; ia < satIdx[ie].size(); ia++) {
     231      sum -= yy[satIdx[ie][ia]];
     232    }
     233    xx[ie] = sum / nEp[ie];
     234  }
     235  for (int is = 0; is < nSat; is++) {
     236    xx[nEpo + is] = yy[is];
     237  }
    218238
    219239  // Compute clock residuals
Note: See TracChangeset for help on using the changeset viewer.