Changeset 6137 in ntrip for trunk/BNC/src/rinex


Ignore:
Timestamp:
Sep 13, 2014, 12:19:37 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/rinex
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r6122 r6137  
    237237      for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
    238238        const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
    239         t_obs obs;
     239        t_satObs obs;
    240240        t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
    241241 
    242         QString prn = QString("%1%2").arg(obs.satSys)
    243                                      .arg(obs.satNum, 2, 10, QChar('0'));
     242        QString prn(obs._prn.toString().c_str());
    244243 
    245         t_ephGlo* ephGlo = 0;
    246         if (obs.satSys == 'R') {
     244        t_ephGlo* ephGlo  = 0;
     245        int       slotNum = 0;
     246        if (obs._prn.system() == 'R') {
    247247          for (int ie = 0; ie < _ephs.size(); ie++) {
    248248            if (QString(_ephs[ie]->prn().toString().c_str()) == prn) {
     
    252252          }
    253253          if (ephGlo) {
    254             obs.slotNum = ephGlo->slotNum();
     254            slotNum = ephGlo->slotNum();
    255255          }
    256256        }
    257257 
    258         t_irc irc = _allObsMap[prn].addObs(obs);
     258        t_irc irc = _allObsMap[prn].addObs(obs, slotNum);
    259259
    260260        if (irc == success) {
     
    339339// 
    340340////////////////////////////////////////////////////////////////////////////
    341 t_irc t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) {
    342 
    343   t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
     341t_irc t_reqcAnalyze::t_allObs::addObs(const t_satObs& obs, int slotNum) {
     342
     343  t_oneObs* newObs = new t_oneObs(obs._time.gpsw(), obs._time.gpssec());
    344344  bool      okFlag = false;
    345345
    346346  // Availability and Slip Flags
    347347  // ---------------------------
    348   double L1 = obs.measdata("L1", 3.0);
    349   if (L1 != 0) {
    350     newObs->_hasL1 = true;
    351   }
    352   double L2 = obs.satSys == 'E' ? obs.measdata("L5", 3.0) : obs.measdata("L2", 3.0);;
    353   if (L2 != 0) {
    354     newObs->_hasL2 = true;
    355   }
    356   if (obs.slipL1) {
    357     newObs->_slipL1 = true;
    358   }
    359   if (obs.slipL2) {
    360     newObs->_slipL2 = true;
     348  double L1 = 0.0;
     349  double L2 = 0.0;
     350  double P1 = 0.0;
     351  double P2 = 0.0;
     352
     353  for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
     354    const t_frqObs* frqObs = obs._obs[iFrq];
     355    if      (frqObs->_rnxType2ch[0] == '1') {
     356      if (frqObs->_phaseValid) {
     357        L1              = frqObs->_phase;
     358        newObs->_hasL1  = true;
     359        newObs->_slipL1 = frqObs->_slip;
     360      }
     361      if (frqObs->_codeValid) {
     362        P1 = frqObs->_code;   
     363      }
     364      if (frqObs->_snrValid) {
     365        newObs->_SNR1 = frqObs->_snr;   
     366      }
     367    }
     368    else if ( (obs._prn.system() != 'E' && frqObs->_rnxType2ch[0] == '2') ||
     369              (obs._prn.system() == 'E' && frqObs->_rnxType2ch[0] == '5') ) {
     370      if (frqObs->_phaseValid) {
     371        L2             = frqObs->_phase;
     372        newObs->_hasL2 = true;
     373        newObs->_slipL2 = frqObs->_slip;
     374      }
     375      if (frqObs->_codeValid) {
     376        P2 = frqObs->_code;   
     377      }
     378      if (frqObs->_snrValid) {
     379        newObs->_SNR2 = frqObs->_snr;   
     380      }
     381    }
    361382  }
    362383
     
    366387    double f1 = 0.0;
    367388    double f2 = 0.0;
    368     if      (obs.satSys == 'G') {
     389    if      (obs._prn.system() == 'G') {
    369390      f1 = t_CST::freq(t_frequency::G1, 0);
    370391      f2 = t_CST::freq(t_frequency::G2, 0);
    371392    }
    372     else if (obs.satSys == 'R') {
    373       f1 = t_CST::freq(t_frequency::R1, obs.slotNum);
    374       f2 = t_CST::freq(t_frequency::R2, obs.slotNum);
    375     }
    376     else if (obs.satSys == 'E') {
     393    else if (obs._prn.system() == 'R') {
     394      f1 = t_CST::freq(t_frequency::R1, slotNum);
     395      f2 = t_CST::freq(t_frequency::R2, slotNum);
     396    }
     397    else if (obs._prn.system() == 'E') {
    377398      f1 = t_CST::freq(t_frequency::E1, 0);
    378399      f2 = t_CST::freq(t_frequency::E5, 0);
     
    382403    L2 = L2 * t_CST::c / f2;
    383404
    384     double P1 = obs.measdata("C1", 3.0);
    385405    if (P1 != 0.0) {
    386406      newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
    387407      okFlag = true;
    388408    }
    389     double P2 = obs.satSys == 'E' ? obs.measdata("C5", 3.0) : obs.measdata("C2", 3.0);
    390409    if (P2 != 0.0) {
    391410      newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
    392       okFlag = true;
    393     }
    394   }
    395 
    396   // Signal-to-Noise
    397   // ---------------
    398   double S1 = obs.measdata("S1", 3.0);
    399   if (S1 != 0.0) {
    400     newObs->_SNR1 = floor(S1/6);
    401     if (newObs->_SNR1 > 9.0) {
    402       newObs->_SNR1 = 9.0;
    403     }
    404     if (newObs->_SNR1 < 1.0) {
    405       newObs->_SNR1 = 1.0;
    406     }
    407     okFlag = true;
    408   }
    409   else {
    410     if (obs.snrL1 > 0) {
    411       newObs->_SNR1 = obs.snrL1;
    412       okFlag = true;
    413     }
    414   }
    415   double S2 = obs.satSys == 'E' ? obs.measdata("S5", 3.0) : obs.measdata("S2", 3.0);
    416   if (S2 != 0.0) {
    417     newObs->_SNR2 = floor(S2/6);
    418     if (newObs->_SNR2 > 9.0) {
    419       newObs->_SNR2 = 9.0;
    420     }
    421     if (newObs->_SNR2 < 1.0) {
    422       newObs->_SNR2 = 1.0;
    423     }
    424     okFlag = true;
    425   }
    426   else {
    427     if (obs.snrL2 > 0) {
    428       newObs->_SNR2 = obs.snrL2;
    429411      okFlag = true;
    430412    }
  • trunk/BNC/src/rinex/reqcanalyze.h

    r5883 r6137  
    2929#include "rnxobsfile.h"
    3030#include "rnxnavfile.h"
    31 #include "GPSDecoder.h"
    3231#include "ephemeris.h"
     32#include "satObs.h"
    3333
    3434class t_polarPoint;
     
    150150      }
    151151    }
    152     t_irc addObs(const t_obs& obs);
     152    t_irc addObs(const t_satObs& obs, int slotNum);
    153153    QVector<t_oneObs*> _oneObsVec;
    154154  };
  • trunk/BNC/src/rinex/rnxobsfile.cpp

    r6130 r6137  
    10381038// Set Observations from RINEX File
    10391039////////////////////////////////////////////////////////////////////////////
    1040 void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile,
    1041                                  const t_rnxObsFile::t_rnxEpo* epo,
    1042                                  const t_rnxObsFile::t_rnxSat& rnxSat,
    1043                                  t_obs& obs) {
    1044 
    1045   strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(), sizeof(obs.StatID));
    1046 
    1047   obs.satSys   = rnxSat.prn.system();
    1048   obs.satNum   = rnxSat.prn.number();
    1049   obs.GPSWeek  = epo->tt.gpsw();
    1050   obs.GPSWeeks = epo->tt.gpssec();
    1051 
    1052   for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) {
    1053     QString type   = rnxObsFile->obsType(obs.satSys, iType);
     1040void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo,
     1041                                 const t_rnxObsFile::t_rnxSat& rnxSat, t_satObs& obs) {
     1042
     1043  obs._staID = rnxObsFile->markerName().toAscii().constData();
     1044  obs._prn   = rnxSat.prn;
     1045  obs._time  = epo->tt;
     1046
     1047  char sys   = rnxSat.prn.system();
     1048
     1049  for (int iType = 0; iType < rnxObsFile->nTypes(sys); iType++) {
     1050    QString type = rnxObsFile->obsType(sys, iType);
    10541051    if (rnxSat.obs.contains(type)) {
    10551052      const t_rnxObs& rnxObs = rnxSat.obs[type];
    1056       obs.setMeasdata(type, rnxObsFile->version(), rnxObs.value);
    1057       if      (type.indexOf("L1") == 0) {
    1058         obs.snrL1  = rnxObs.snr;
    1059         obs.slipL1 = (rnxObs.lli & 1);
    1060       }
    1061       else if (type.indexOf("L2") == 0) {
    1062         obs.snrL2  = rnxObs.snr;
    1063         obs.slipL2 = (rnxObs.lli & 1);
    1064       }
    1065       else if (type.indexOf("L5") == 0) {
    1066         obs.snrL5  = rnxObs.snr;
    1067         obs.slipL5 = (rnxObs.lli & 1);
    1068       }
    1069     }
    1070   }
    1071 }
    1072 
     1053      string type2ch(type.mid(1).toAscii().data());
     1054
     1055
     1056      t_frqObs* frqObs = 0;
     1057      for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
     1058        if (obs._obs[iFrq]->_rnxType2ch == type2ch) {
     1059          frqObs = obs._obs[iFrq];
     1060          break;
     1061        }
     1062      }
     1063      if (frqObs == 0) {
     1064        frqObs = new t_frqObs;
     1065        frqObs->_rnxType2ch = type2ch;
     1066        obs._obs.push_back(frqObs);
     1067      }
     1068
     1069      switch( type.toAscii().data()[0] ) {
     1070      case 'C':
     1071        frqObs->_codeValid = true;
     1072        frqObs->_code      = rnxObs.value;
     1073        break;
     1074      case 'L':
     1075        frqObs->_phaseValid = true;
     1076        frqObs->_phase      = rnxObs.value;
     1077        frqObs->_slip       = (rnxObs.lli & 1);
     1078        break;
     1079      case 'D':
     1080        frqObs->_dopplerValid = true;
     1081        frqObs->_doppler      = rnxObs.value;
     1082        break;
     1083      case 'S':
     1084        frqObs->_snrValid = true;
     1085        frqObs->_snr      = rnxObs.value;
     1086        break;
     1087      }
     1088    }
     1089  }
     1090}
     1091
  • trunk/BNC/src/rinex/rnxobsfile.h

    r6130 r6137  
    3636#include "bnctime.h"
    3737#include "t_prn.h"
    38 #include "GPSDecoder.h"
     38#include "satObs.h"
    3939
    4040class t_rnxObsHeader {
     
    163163                            const t_rnxObsFile::t_rnxEpo* epo,
    164164                            const t_rnxObsFile::t_rnxSat& rnxSat,
    165                             t_obs& obs);
     165                            t_satObs& obs);
    166166
    167167  static QString type2to3(char sys, const QString& typeV2);
Note: See TracChangeset for help on using the changeset viewer.