Changeset 2676 in ntrip


Ignore:
Timestamp:
Nov 13, 2010, 10:32:55 AM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/RTCM3Decoder.cpp

    r2674 r2676  
    126126        if (_rawFile) {
    127127          _staID_corrections = _rawFile->staID();
    128         }
    129         else {
     128        }
     129        else {
    130130          _mode = corrections;
    131         }
     131        }
    132132      }
    133133    }
     
    153153  // -----------------------
    154154  if (newParser) {
     155    memset(&parser, 0, sizeof(parser));
    155156    parser.rinex3 = 0;
    156     memset(&parser, 0, sizeof(parser));
    157157    double secGPS;
    158158    currentGPSWeeks(parser.GPSWeek, secGPS);
     
    162162  // Remaining part decodes the Observations
    163163  // ---------------------------------------
    164   if (_mode == unknown || _mode == observations || _checkMountPoint == _staID || _checkMountPoint == "ALL") {
     164  if (_mode == unknown || _mode == observations ||
     165      _checkMountPoint == _staID || _checkMountPoint == "ALL") {
    165166
    166167    for (int ii = 0; ii < bufLen; ii++) {
     
    169170      if (parser.MessageSize >= parser.NeedBytes) {
    170171
    171         while(int rr = RTCM3Parser(&parser)) {
     172        while (int rr = RTCM3Parser(&parser)) {
    172173
    173174          // RTCMv3 message types
     
    177178          // RTCMv3 antenna descriptor
    178179          // -------------------------
    179           if(rr == 1007 || rr == 1008 || rr == 1033)
    180           {
    181             _antType.push_back(parser.antenna); /* correct ? */
     180          if (rr == 1007 || rr == 1008 || rr == 1033) {
     181            _antType.push_back(parser.antenna);
    182182          }
    183183
    184184          // RTCMv3 antenna XYZ
    185185          // ------------------
    186           else if(rr == 1005)
    187           {
    188             _antList.push_back(t_antInfo());
    189             _antList.back().type     = t_antInfo::ARP;
    190             _antList.back().xx       = parser.antX * 1e-4;
    191             _antList.back().yy       = parser.antY * 1e-4;
    192             _antList.back().zz       = parser.antZ * 1e-4;
    193             _antList.back().message  = rr;
    194 
    195             // Remember station position for 1003 message decoding
    196             _antXYZ[0] = parser.antX * 1e-4;
    197             _antXYZ[1] = parser.antY * 1e-4;
    198             _antXYZ[2] = parser.antZ * 1e-4;
     186          else if (rr == 1005) {
     187            _antList.push_back(t_antInfo());
     188            _antList.back().type     = t_antInfo::ARP;
     189            _antList.back().xx       = parser.antX * 1e-4;
     190            _antList.back().yy       = parser.antY * 1e-4;
     191            _antList.back().zz       = parser.antZ * 1e-4;
     192            _antList.back().message  = rr;
     193
     194            // Remember station position for 1003 message decoding
     195            _antXYZ[0] = parser.antX * 1e-4;
     196            _antXYZ[1] = parser.antY * 1e-4;
     197            _antXYZ[2] = parser.antZ * 1e-4;
    199198          }
    200199
    201200          // RTCMv3 antenna XYZ-H
    202201          // --------------------
    203           else if(rr == 1006)
    204           {
    205             _antList.push_back(t_antInfo());
    206             _antList.back().type     = t_antInfo::ARP;
    207             _antList.back().xx       = parser.antX * 1e-4;
    208             _antList.back().yy       = parser.antY * 1e-4;
    209             _antList.back().zz       = parser.antZ * 1e-4;
    210             _antList.back().height   = parser.antH * 1e-4;
    211             _antList.back().height_f = true;
    212             _antList.back().message  = rr;
    213 
    214             // Remember station position for 1003 message decoding
    215             _antXYZ[0] = parser.antX * 1e-4;
    216             _antXYZ[1] = parser.antY * 1e-4;
    217             _antXYZ[2] = parser.antZ * 1e-4;
     202          else if(rr == 1006) {
     203            _antList.push_back(t_antInfo());
     204            _antList.back().type     = t_antInfo::ARP;
     205            _antList.back().xx       = parser.antX * 1e-4;
     206            _antList.back().yy       = parser.antY * 1e-4;
     207            _antList.back().zz       = parser.antZ * 1e-4;
     208            _antList.back().height   = parser.antH * 1e-4;
     209            _antList.back().height_f = true;
     210            _antList.back().message  = rr;
     211
     212            // Remember station position for 1003 message decoding
     213            _antXYZ[0] = parser.antX * 1e-4;
     214            _antXYZ[1] = parser.antY * 1e-4;
     215            _antXYZ[2] = parser.antZ * 1e-4;
    218216          }
    219217
     
    228226            }
    229227           
    230             // apply "GPS Integer L1 Pseudorange Modulus Ambiguity"
    231             bool applyModulusAmb = false;
    232             ///if (rr == 2) {
    233             ///  applyModulusAmb = true;
    234             ///}
    235 
    236228            if (rr == 2) {
    237               emit(newMessage( (_staID + ": No valid RINEX! All values are modulo 299792.458!").toAscii(), true));
     229              emit(newMessage( (_staID +
     230               ": No valid RINEX! All values are modulo 299792.458!").toAscii(),
     231               true));
    238232            }
    239233           
     
    269263                obs->_o.satSys = 'E';
    270264                obs->_o.satNum = satID - PRN_GALILEO_START + 1;
    271               }
     265              }
    272266
    273267              // WAAS
     
    282276              else if (satID >= PRN_GIOVE_START && satID <= PRN_GIOVE_END) {
    283277                obs->_o.satSys = 'E';
    284                 obs->_o.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET;
    285               }
     278                obs->_o.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET;
     279              }
    286280
    287281              // Unknown System
     
    290284                delete obs;
    291285                obs = 0;
    292               }
     286              }
    293287
    294288              if (obs) {
     
    302296              obs->_o.GPSWeeks = parser.Data.timeofweek / 1000.0;
    303297
    304               // Estimate "GPS Integer L1 Pseudorange Modulus Ambiguity"
    305               // -------------------------------------------------------
    306               double modulusAmb = 0;
    307               if (applyModulusAmb) {
    308                 // Missing antenna coordinates: skip all data
    309                 if ( !_antXYZ[0] && !_antXYZ[1] && !_antXYZ[2] ) {
    310                   continue;
    311                 }
    312                
    313                 ostringstream prns;
    314                 prns << obs->_o.satSys << setfill('0') << setw(2) << obs->_o.satNum;
    315 
    316                 string prn = prns.str();
    317 
    318                 // Missing ephemerides, skip satellite
    319                 if (_ephList.find(prn) == _ephList.end()) {
    320                   continue;
    321                 }
    322                
    323                 const t_eph* eph = &(_ephList.find(prn)->second);
    324                  
    325                 double rho, xSat, ySat, zSat, clkSat, GPSWeeks_tot;
    326                 int    GPSWeek_tot;
    327                 cmpRho(eph, _antXYZ[0], _antXYZ[1], _antXYZ[2],
    328                        obs->_o.GPSWeek, obs->_o.GPSWeeks,
    329                        rho, GPSWeek_tot, GPSWeeks_tot,
    330                        xSat, ySat, zSat, clkSat);
    331 
    332                 const double CC = 299792458.0;
    333 
    334                 int nn = static_cast<int>(rho / (CC * 0.001));
    335 
    336                 modulusAmb = nn * CC * 0.001;
    337               }
    338            
    339               // Loop over all data types
    340               // ------------------------
     298              // Loop over all data types
     299              // ------------------------
    341300              for (int jj = 0; jj < parser.numdatatypesGPS; jj++) {
    342301                int v = 0;
     
    371330                  // variables df and pos are used consequently. Perlt
    372331                  if      (df & GNSSDF_C1DATA) {
    373                     obs->_o.C1 = parser.Data.measdata[ii][pos] + modulusAmb;
     332                    obs->_o.C1 = parser.Data.measdata[ii][pos];
    374333                  }
    375334                  else if (df & GNSSDF_C2DATA) {
    376                     obs->_o.C2 = parser.Data.measdata[ii][pos] + modulusAmb;
     335                    obs->_o.C2 = parser.Data.measdata[ii][pos];
    377336                  }
    378337                  else if (df & GNSSDF_P1DATA) {
    379                     obs->_o.P1 = parser.Data.measdata[ii][pos] + modulusAmb;
     338                    obs->_o.P1 = parser.Data.measdata[ii][pos];
    380339                  }
    381340                  else if (df & GNSSDF_P2DATA) {
    382                     obs->_o.P2 = parser.Data.measdata[ii][pos] + modulusAmb;
     341                    obs->_o.P2 = parser.Data.measdata[ii][pos];
    383342                  }
    384343                  else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
    385                     obs->_o.L1            = parser.Data.measdata[ii][pos] + modulusAmb;
     344                    obs->_o.L1            = parser.Data.measdata[ii][pos];
    386345                    obs->_o.SNR1          = parser.Data.snrL1[ii];
    387346                    obs->_o.lock_timei_L1 = parser.lastlockGPSl1[isat];
    388347                  }
    389348                  else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
    390                     obs->_o.L2            = parser.Data.measdata[ii][pos] + modulusAmb;
     349                    obs->_o.L2            = parser.Data.measdata[ii][pos];
    391350                    obs->_o.SNR2          = parser.Data.snrL2[ii];
    392351                    obs->_o.lock_timei_L2 = parser.lastlockGPSl2[isat];
     
    407366          else if (rr == 1019) {
    408367            decoded = true;
    409             gpsephemeris* ep = new gpsephemeris(parser.ephemerisGPS);
    410             emit newGPSEph(ep);
     368            emit newGPSEph(new gpsephemeris(parser.ephemerisGPS));
    411369          }
    412370   
     
    415373          else if (rr == 1020) {
    416374            decoded = true;
    417             glonassephemeris* ep = new glonassephemeris(parser.ephemerisGLONASS);
    418             emit newGlonassEph(ep);
     375            emit newGlonassEph(new glonassephemeris(parser.ephemerisGLONASS));
    419376          }
    420377        }
     
    436393
    437394// Store ephemerides
    438 ////////////////////////////////////////////////////////////////////////////////////////
     395//////////////////////////////////////////////////////////////////////////////
    439396bool RTCM3Decoder::storeEph(const gpsephemeris& gpseph) {
    440397  t_ephGPS eph; eph.set(&gpseph);
Note: See TracChangeset for help on using the changeset viewer.