Changeset 9635 in ntrip for trunk/BNC/src/combination


Ignore:
Timestamp:
Feb 24, 2022, 5:08:42 PM (3 years ago)
Author:
stuerze
Message:

consideration of incoming Code Biases during clock combination

Location:
trunk/BNC/src/combination
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/combination/bnccomb.cpp

    r9546 r9635  
    1818#include <iomanip>
    1919#include <sstream>
     20#include <map>
    2021
    2122#include "bnccomb.h"
     
    472473    }
    473474
    474     // Check satellite code biases
    475     // ----------------------------
    476     if (!_satCodeBiases.contains(acName)) {
    477       delete newCorr;
    478       continue;
    479     }
    480     else {
    481       QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
    482       if (!storage.contains(clkCorr._prn)) {
    483         delete newCorr;
    484         continue;
    485       }
    486       else {
    487         newCorr->_satCodeBias = storage[clkCorr._prn];
    488       }
    489     }
    490 
    491475    // Check the Ephemeris
    492476    //--------------------
     
    520504        continue;
    521505      }
     506    }
     507
     508    // Check satellite code biases
     509    // ----------------------------
     510    if (!_satCodeBiases.contains(acName)) {
     511      delete newCorr;
     512      continue;
     513    }
     514    else {
     515      QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
     516      if (!storage.contains(clkCorr._prn)) {
     517        delete newCorr;
     518        continue;
     519      }
     520      else {
     521        t_satCodeBias& satCodeBias = storage[clkCorr._prn];
     522        QMap<t_frequency::type, double> codeBias;
     523        for (unsigned ii = 1; ii < t_lcRefSig::cIF; ii++) {
     524          t_frequency::type frqType = t_lcRefSig::toFreq(sys,  static_cast<t_lcRefSig::type>(ii));
     525          char frqNum = t_frequency::toString(frqType)[1];
     526          char attrib = t_lcRefSig::toAttrib(sys,  static_cast<t_lcRefSig::type>(ii));
     527          QString obsType = QString("%1%2").arg(frqNum).arg(attrib);
     528          for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
     529            const t_frqCodeBias& bias = satCodeBias._bias[ii];
     530            if (obsType.toStdString() == bias._rnxType2ch) {
     531              codeBias[frqType] = bias._value;
     532            }
     533          }
     534        }
     535        map<t_frequency::type, double> codeCoeff;
     536        double channel = double(newCorr->_eph->slotNum());
     537        t_lcRefSig::coeff(sys, t_lcRefSig::cIF, channel, codeCoeff);
     538        map<t_frequency::type, double>::const_iterator it;
     539        for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
     540          t_frequency::type frqType = it->first;
     541          newCorr->_codeBiasIF += it->second * codeBias[frqType];
     542        }
     543      }
     544      cout <<  acName.toStdString() << " " << clkCorr._prn.toString().c_str() << " _codeBiasIF: " << newCorr->_codeBiasIF << endl;
    522545    }
    523546
     
    597620  QTextStream out(&_log, QIODevice::WriteOnly);
    598621
    599   out << endl <<           "Combination: " << sys << endl
    600       << "--------------------------------" << endl;
     622  out << "\n" <<           "Combination: " << sys << "\n"
     623      << "--------------------------------" << "\n";
    601624
    602625  // Observation Statistics
     
    617640      }
    618641    }
    619     out << AC->name.toLatin1().data() << ": " << AC->numObs[sys] << endl;
     642    out << AC->name.toLatin1().data() << ": " << AC->numObs[sys] << "\n";
    620643  }
    621644
     
    629652    ++_masterMissingEpochs[sys];
    630653    if (_masterMissingEpochs[sys] < switchMasterAfterGap) {
    631       out << "Missing Master, Epoch skipped" << endl;
     654      out << "Missing Master, Epoch skipped" << "\n";
    632655      _buffer[sys].remove(_resTime);
    633656      emit newMessage(_log, false);
     
    644667              << AC->name.toLatin1().data()   << " "
    645668              << _resTime.datestr().c_str()    << " "
    646               << _resTime.timestr().c_str()    << endl;
     669              << _resTime.timestr().c_str()    << "\n";
    647670          _masterOrbitAC[sys] = AC->name;
    648671          break;
     
    682705      out.setRealNumberPrecision(4);
    683706      out << pp->toString(sys) << " "
    684           << pp->xx << " +- " << sqrt(_QQ[sys](pp->index,pp->index)) << endl;
     707          << pp->xx << " +- " << sqrt(_QQ[sys](pp->index,pp->index)) << "\n";
    685708      out.setFieldWidth(0);
    686709    }
     
    762785      }
    763786
    764       out << "  Outlier" << endl;
     787      out << "  Outlier" << "\n";
    765788      _QQ[sys] = QQ_sav;
    766789      corrs(sys).remove(maxResIndex-1);
    767790    }
    768791    else {
    769       out << "  OK" << endl;
     792      out << "  OK" << "\n";
    770793      out.setRealNumberNotation(QTextStream::FixedNotation);
    771794      out.setRealNumberPrecision(4);
     
    776799            << corr->_acName << ' ' << corr->_prn.mid(0,3);
    777800        out.setFieldWidth(10);
    778         out <<  " res = " << vv[ii] << endl;
     801        out <<  " res = " << vv[ii] << "\n";
    779802        out.setFieldWidth(0);
    780803      }
     
    807830      out << "Full Clock " << corr->_prn.mid(0,3) << " " << corr->_iod << " ";
    808831      out.setFieldWidth(14);
    809       out << (xc(4) + corr->_dClkResult) * t_CST::c << endl;
     832      out << (xc(4) + corr->_dClkResult) * t_CST::c << "\n";
    810833      out.setFieldWidth(0);
    811834    }
    812835    else {
    813       out << "bncComb::printResuls bug" << endl;
     836      out << "bncComb::printResuls bug" << "\n";
    814837    }
    815838  }
     
    958981    }
    959982
    960     ll(iObs) = corr->_clkCorr._dClk * t_CST::c - DotProduct(AA.Row(iObs), x0);
     983    ll(iObs) = (corr->_clkCorr._dClk * t_CST::c - corr->_codeBiasIF) - DotProduct(AA.Row(iObs), x0);
    961984  }
    962985
     
    11171140    }
    11181141    catch (Exception& exc) {
    1119       out << exc.what() << endl;
     1142      out << exc.what() << "\n";
    11201143      return failure;
    11211144    }
     
    11301153
    11311154    if (maxRes > _MAXRES) {
    1132       out << "  Outlier" << endl;
     1155      out << "  Outlier" << "\n";
    11331156      delete corrs(sys)[maxResIndex-1];
    11341157      corrs(sys).remove(maxResIndex-1);
    11351158    }
    11361159    else {
    1137       out << "  OK" << endl;
     1160      out << "  OK" << "\n";
    11381161      out.setRealNumberNotation(QTextStream::FixedNotation);
    11391162      out.setRealNumberPrecision(3);
     
    11441167            << corr->_acName << ' ' << corr->_prn.mid(0,3);
    11451168        out.setFieldWidth(6);
    1146         out << " res = " << vv[ii] << endl;
     1169        out << " res = " << vv[ii] << "\n";
    11471170        out.setFieldWidth(0);
    11481171      }
     
    11721195
    11731196    if      (ephLast == 0) {
    1174       out << "checkOrbit: missing eph (not found) " << corr->_prn.mid(0,3) << endl;
     1197      out << "checkOrbit: missing eph (not found) " << corr->_prn.mid(0,3) << "\n";
    11751198      delete corr;
    11761199      im.remove();
    11771200    }
    11781201    else if (corr->_eph == 0) {
    1179       out << "checkOrbit: missing eph (zero) " << corr->_prn.mid(0,3) << endl;
     1202      out << "checkOrbit: missing eph (zero) " << corr->_prn.mid(0,3) << "\n";
    11801203      delete corr;
    11811204      im.remove();
     
    11861209      }
    11871210      else {
    1188         out << "checkOrbit: missing eph (deleted) " << corr->_prn.mid(0,3) << endl;
     1211        out << "checkOrbit: missing eph (deleted) " << corr->_prn.mid(0,3) << "\n";
    11891212        delete corr;
    11901213        im.remove();
     
    12681291              << prn.mid(0,3).toLatin1().data()           << " "
    12691292              << corr->_iod                     << " "
    1270               << norm                           << endl;
     1293              << norm                           << "\n";
    12711294          delete corr;
    12721295          im.remove();
     
    13011324      out << "Provider ID changed: AC " << AC->name.toLatin1().data()   << " "
    13021325          << _resTime.datestr().c_str()    << " "
    1303           << _resTime.timestr().c_str()    << endl;
     1326          << _resTime.timestr().c_str()    << "\n";
    13041327      break;
    13051328    }
  • trunk/BNC/src/combination/bnccomb.h

    r9530 r9635  
    44
    55#include <fstream>
     6#include <map>
    67#include <newmat.h>
    78#include "bncephuser.h"
    89#include "satObs.h"
     10#include "bncconst.h"
    911#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
    1012#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
     
    8082      _iod        = 0;
    8183      _dClkResult = 0.0;
     84      _codeBiasIF   = 0.0;
    8285    }
    8386    ~cmbCorr() {}
     
    9093    t_satCodeBias _satCodeBias;
    9194    QString       _acName;
     95    double        _codeBiasIF;
    9296    double        _dClkResult;
    9397    ColumnVector  _diffRao;
     
    106110    QVector<cmbCorr*> corrs;
    107111  };
     112
     113  class t_lcRefSig {
     114   public:
     115    enum type {dummy = 0, c1, c2, cIF};
     116
     117    static t_frequency::type toFreq(char sys, type tt) {
     118      switch (tt) {
     119      case c1:
     120        if      (sys == 'G') return t_frequency::G1;
     121        else if (sys == 'R') return t_frequency::R1;
     122        else if (sys == 'E') return t_frequency::E1;
     123        else if (sys == 'C') return t_frequency::C2;
     124        else if (sys == 'J') return t_frequency::J1;
     125        else if (sys == 'S') return t_frequency::S1;
     126        else                 return t_frequency::dummy;
     127      case c2:
     128        if      (sys == 'G') return t_frequency::G2;
     129        else if (sys == 'R') return t_frequency::R2;
     130        else if (sys == 'E') return t_frequency::E5;
     131        else if (sys == 'C') return t_frequency::C6;
     132        else if (sys == 'J') return t_frequency::J2;
     133        else if (sys == 'S') return t_frequency::S5;
     134        else                 return t_frequency::dummy;
     135      case dummy:
     136      case cIF:
     137        return t_frequency::dummy;
     138      }
     139      return t_frequency::dummy;
     140    }
     141
     142    static char toAttrib(char sys, type LC) {
     143      switch (LC) {
     144        case c1:
     145          if      (sys == 'G') return 'W';
     146          else if (sys == 'R') return 'P';
     147          else if (sys == 'E') return 'C';
     148          else if (sys == 'C') return 'I';
     149          else if (sys == 'J') return 'C';
     150          else if (sys == 'S') return 'C';
     151          break;
     152        case c2:
     153          if      (sys == 'G') return 'W';
     154          else if (sys == 'R') return 'P';
     155          else if (sys == 'E') return 'Q';
     156          else if (sys == 'C') return 'I';
     157          else if (sys == 'J') return 'L';
     158          else if (sys == 'S') return 'Q';
     159          break;
     160      case dummy:
     161      case cIF:
     162        return '_';
     163        break;
     164      }
     165      return '_';
     166    }
     167
     168      static void coeff(char sys, type tLC, double channel, std::map<t_frequency::type, double>& codeCoeff)  {
     169      codeCoeff.clear();
     170      t_frequency::type fType1 = toFreq(sys, c1);
     171      t_frequency::type fType2 = toFreq(sys, c2);
     172      double f1 = t_CST::freq(fType1, channel);
     173      double f2 = t_CST::freq(fType2, channel);
     174      switch (tLC) {
     175        case c1:
     176          codeCoeff[fType1] = 1.0;
     177          return;
     178        case c2:
     179          codeCoeff[fType2] = 1.0;
     180          return;
     181        case cIF:
     182          codeCoeff[fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
     183          codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     184          return;
     185        case t_lcRefSig::dummy:
     186          return;
     187      }
     188      return;
     189    }
     190  };
     191
    108192
    109193  void  processEpoch(char sys);
     
    134218  e_method                                   _method;
    135219  int                                        _cmbSampl;
     220  QString                                    _cmbRefAttributes;
    136221  QMap<QString, QMap<t_prn, t_orbCorr> >     _orbCorrections;
    137222  QMap<QString, QMap<t_prn, t_satCodeBias> > _satCodeBiases;
Note: See TracChangeset for help on using the changeset viewer.