Changeset 5750 in ntrip for trunk/BNC/src/PPP/satobs.cpp


Ignore:
Timestamp:
Aug 3, 2014, 11:30:39 AM (10 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/satobs.cpp

    r5743 r5750  
    4444#include <newmatio.h>
    4545#include "satobs.h"
    46 #include "genconst.h"
     46#include "bncconst.h"
    4747#include "ephpool.h"
    4848#include "station.h"
    49 #include "utils.h"
    50 #include "tropo.h"
    51 #include "antex.h"
     49#include "bncutils.h"
     50#include "bncantex.h"
    5251#include "obspool.h"
     52#include "pppClient.h"
     53#include "bncmodel.h"
    5354
    5455using namespace BNC;
     
    5758// Constructor
    5859////////////////////////////////////////////////////////////////////////////
    59 t_satObs::t_obs::t_obs(const t_obs& obs) {
    60   _type            = obs._rnxType2ch;
    61   _code            = obs._code;           
    62   _codeValid       = obs._codeValid;     
    63   _phase           = obs._phase;         
    64   _phaseValid      = obs._phaseValid;     
    65   _doppler         = obs._doppler;       
    66   _dopplerValid    = obs._dopplerValid;   
    67   _snr             = obs._snr;           
    68   _snrValid        = obs._snrValid;       
    69   _slip            = obs._slip;           
    70   _slipCounter     = obs._slipCounter;   
    71   _biasJumpCounter = -1;
    72 }
    73 
    74 // Constructor
    75 ////////////////////////////////////////////////////////////////////////////
    76 t_satObs::t_satObs(const t_satObs& satObs) {
    77   _prn  = satObs._prn;
    78   _time = satObs._time;
     60t_satObs::t_satObs(const t_pppSatObs& pppSatObs) {
     61  _prn  = pppSatObs._prn;
     62  _time = pppSatObs._time;
    7963  _outlier    = false;
    80   for (int ii = 0; ii < satObs._numObs; ii++) {
    81     const t_obs& obs = satObs._obs[ii];
     64  for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
     65    const t_obs& obs = pppSatObs._obs[ii];
    8266    t_obsType obsType = string(obs._rnxType2ch).substr(0,2);
    8367    _allObs[obsType] = new t_obs(obs);
     
    145129  // Copy raw observations
    146130  // ---------------------
    147   _f1    = t_genConst::f1(_prn.system(), _channel);
     131  _f1    = t_CST::f1(_prn.system(), _channel);
    148132  _rawC1 = _validObs1->_code;
    149   _rawL1 = _validObs1->_phase * t_genConst::c / _f1;
     133  _rawL1 = _validObs1->_phase * t_CST::c / _f1;
    150134  if (dualFreq) {
    151     _f2    = t_genConst::f2(_prn.system(), _channel);
     135    _f2    = t_CST::f2(_prn.system(), _channel);
    152136    _rawC2 = _validObs2->_code;
    153     _rawL2 = _validObs2->_phase * t_genConst::c / _f2;
     137    _rawL2 = _validObs2->_phase * t_CST::c / _f2;
    154138  }
    155139  else {
     
    168152  double prange = obsValue(tLC);
    169153  for (int ii = 1; ii <= 10; ii++) {
    170     bncTime ToT = _time - prange / t_genConst::c - _xcSat[3];
    171     if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != t_irc::success) {
     154    bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
     155    if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
    172156      _valid = false;
    173157      return;
    174158    }
    175159    ColumnVector dx = _xcSat - satPosOld;
    176     dx[3] *= t_genConst::c;
     160    dx[3] *= t_CST::c;
    177161    if (dx.norm_Frobenius() < 1.e-4) {
    178162      totOK = true;
     
    182166  }
    183167  if (totOK) {
    184     _model._satClkM = _xcSat[3] * t_genConst::c;
     168    _model._satClkM = _xcSat[3] * t_CST::c;
    185169  }
    186170  else {
     
    214198  // Satellite Clocks
    215199  // ----------------
    216   _model._satClkM = _xcSat[3] * t_genConst::c;
     200  _model._satClkM = _xcSat[3] * t_CST::c;
    217201
    218202  // Receiver Clocks
    219203  // ---------------
    220   _model._recClkM = station->dClk() * t_genConst::c;
     204  _model._recClkM = station->dClk() * t_CST::c;
    221205
    222206  // Sagnac Effect (correction due to Earth rotation)
     
    225209  Omega[0] = 0.0;
    226210  Omega[1] = 0.0;
    227   Omega[2] = t_genConst::omega / t_genConst::c;
     211  Omega[2] = t_CST::omega / t_CST::c;
    228212  _model._sagnac = DotProduct(Omega, crossproduct(rSat, station->xyzApr()));
    229213
     
    250234  // Tropospheric Delay
    251235  // ------------------
    252   t_tropo::dtrop(_time, station->ellApr()[0], station->ellApr()[1],
    253                  station->ellApr()[2], _model._eleSat, OPT->tropoModel(),
    254                  OPT->tropoMF(), false, _model._tropo);
     236  _model._tropo = bncModel::delay_saast(station->xyzApr(), station->ellApr()[2]);
    255237
    256238  // Phase Wind-Up
     
    264246  bool biasL1flg = false;
    265247  bool biasL2flg = false;
    266   int  nsdfix    =  0;
    267248  const t_satBias* satBias = PPP_CLIENT->obsPool()->satBias(_prn);
    268249  if (satBias) {
    269     nsdfix    = satBias->nx();
    270250    map<t_biasType, double>::const_iterator it;
    271251    for (it = satBias->biases().begin(); it != satBias->biases().end(); it++) {
     
    273253      if (_validObs1) {
    274254        _validObs1->_biasJumpCounter = satBias->jumpCount();
    275         if      ("C" + _validObs1->_type == biasType) {
     255        if      ("C" + _validObs1->_rnxType2ch == biasType) {
    276256          _model._biasC1 = it->second;
    277257          biasC1flg = true;
    278258        }
    279         else if ("L" + _validObs1->_type == biasType) {
     259        else if ("L" + _validObs1->_rnxType2ch == biasType) {
    280260          _model._biasL1 = it->second;
    281261          biasL1flg = true;
     
    284264      if (_validObs2) {
    285265        _validObs2->_biasJumpCounter = satBias->jumpCount();
    286         if      ("C" + _validObs2->_type == biasType) {
     266        if      ("C" + _validObs2->_rnxType2ch == biasType) {
    287267          _model._biasC2 = it->second;
    288268          biasC2flg = true;
    289269        }
    290         else if ("L" + _validObs2->_type == biasType) {
     270        else if ("L" + _validObs2->_rnxType2ch == biasType) {
    291271          _model._biasL2 = it->second;
    292272          biasL2flg = true;
     
    299279      _valid = false;
    300280    }
    301     if (nsdfix < OPT->minSDFix()) {
    302       _valid = false;
    303     }
    304281  }
    305282
     
    320297  _model._set = true;
    321298
    322   return t_irc::success;
     299  return success;
    323300}
    324301
     
    329306  LOG << "MODEL for Satellite " << _prn.toString() << endl
    330307      << "RHO:    " << setw(12) << setprecision(3) << _model._rho     << endl
    331       << "ELE:    " << setw(12) << setprecision(3) << _model._eleSat * t_genConst::rho_deg << endl
    332       << "AZI:    " << setw(12) << setprecision(3) << _model._azSat  * t_genConst::rho_deg << endl
     308      << "ELE:    " << setw(12) << setprecision(3) << _model._eleSat * 180.0 / M_PI << endl
     309      << "AZI:    " << setw(12) << setprecision(3) << _model._azSat  * 180.0 / M_PI << endl
    333310      << "SATCLK: " << setw(12) << setprecision(3) << _model._satClkM << endl
    334311      << "RECCLK: " << setw(12) << setprecision(3) << _model._recClkM << endl
     
    350327
    351328  LOG << "WIND L3:" <<  setw(12) << setprecision(3)
    352       << lc(t_lc::lIF, _model._windUp * t_genConst::c / _f1,
    353                        _model._windUp * t_genConst::c / _f2, 0.0, 0.0) << endl;
     329      << lc(t_lc::lIF, _model._windUp * t_CST::c / _f1,
     330                       _model._windUp * t_CST::c / _f2, 0.0, 0.0) << endl;
    354331
    355332  LOG << "OBS-CMP P3: " << _prn.toString() << " "
     
    403380  // Add Dispersive Part
    404381  // -------------------
    405   double L1 = nonDisp + _model._antPco1 - _model._biasL1 + _model._windUp * t_genConst::c / _f1;
    406   double L2 = nonDisp + _model._antPco2 - _model._biasL2 + _model._windUp * t_genConst::c / _f2;
     382  double L1 = nonDisp + _model._antPco1 - _model._biasL1 + _model._windUp * t_CST::c / _f1;
     383  double L2 = nonDisp + _model._antPco2 - _model._biasL2 + _model._windUp * t_CST::c / _f2;
    407384  double C1 = nonDisp + _model._antPco1 - _model._biasC1;
    408385  double C2 = nonDisp + _model._antPco2 - _model._biasC2;
     
    503480  _model._biasL2  -= obsBase->_model._biasL2;
    504481
    505   return t_irc::success;
     482  return success;
    506483}
    507484
     
    511488
    512489  if      (tLC == t_lc::l1) {
    513     return t_genConst::c / _f1;
     490    return t_CST::c / _f1;
    514491  }
    515492  else if (tLC == t_lc::l2) {
    516     return t_genConst::c / _f2;
     493    return t_CST::c / _f2;
    517494  }
    518495  else if (tLC == t_lc::lIF) {
    519     return t_genConst::c / (_f1 + _f2);
     496    return t_CST::c / (_f1 + _f2);
    520497  }
    521498  else if (tLC == t_lc::MW) {
    522     return t_genConst::c / (_f1 - _f2);
     499    return t_CST::c / (_f1 - _f2);
    523500  }
    524501  else if (tLC == t_lc::CL) {
    525     return t_genConst::c / _f1 / 2.0;
     502    return t_CST::c / _f1 / 2.0;
    526503  }
    527504
     
    534511
    535512  ColumnVector sig(4);
    536   sig(1) = OPT->sigmaPhase();
    537   sig(2) = OPT->sigmaPhase();
    538   sig(3) = OPT->sigmaCode();
    539   sig(4) = OPT->sigmaCode();
     513  sig(1) = OPT->_sigmaL1;
     514  sig(2) = OPT->_sigmaL1;
     515  sig(3) = OPT->_sigmaC1;
     516  sig(4) = OPT->_sigmaC1;
    540517
    541518  ColumnVector coeff(4);
     
    547524  // -----------------------------
    548525  double cEle = 1.0;
    549   if ( (OPT->eleWgtCode()  && t_lc::includesCode(tLC)) ||
    550        (OPT->eleWgtPhase() && t_lc::includesPhase(tLC)) ) {
    551     double eleD = eleSat()*180.0/t_genConst::pi;
     526  if ( (OPT->_eleWgtCode  && t_lc::includesCode(tLC)) ||
     527       (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {
     528    double eleD = eleSat()*180.0/M_PI;
    552529    double hlp  = fabs(90.0 - eleD);
    553530    cEle = (1.0 + hlp*hlp*hlp*0.000004);
Note: See TracChangeset for help on using the changeset viewer.