Changeset 3666 in ntrip


Ignore:
Timestamp:
Feb 11, 2012, 5:26:09 PM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC
Files:
2 edited

Legend:

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

    r3665 r3666  
    800800  }
    801801
    802   unsigned off = (rnxVersion < 2.12) ? 0 : 1;
     802  int pos[4];
     803  pos[0] = (rnxVersion <= 2.12) ?  3 :  4;
     804  pos[1] = (rnxVersion <= 2.12) ? 22 : 23;
     805  pos[2] = (rnxVersion <= 2.12) ? 41 : 42;
     806  pos[3] = (rnxVersion <= 2.12) ? 60 : 61;
     807
     808  int fieldLen = 19;
    803809
    804810  // Read eight lines
     
    808814
    809815    if      ( iLine == 0 ) {
    810       int year, month, day, hour, min;
    811       double sec = 0.0;
    812       if (rnxVersion < 3.0) {
    813         if ( readInt(line,  3 + off,  2, year            ) ||
    814              readInt(line,  6 + off,  2, month           ) ||
    815              readInt(line,  9 + off,  2, day             ) ||
    816              readInt(line, 12 + off,  2, hour            ) ||
    817              readInt(line, 15 + off,  2, min             ) ||
    818              readDbl(line, 17 + off,  5, sec             ) ||
    819              readDbl(line, 22 + off, 19, _clock_bias     ) ||
    820              readDbl(line, 41 + off, 19, _clock_drift    ) ||
    821              readDbl(line, 60 + off, 19, _clock_driftrate) ) {
    822           return;
    823         }
    824         if (year < 80) {
    825           year += 2000;
    826         }
    827         else {
    828           year += 1900;
    829         }
    830       }
    831       else {
    832         int iSec;
    833         if ( readInt(line,  4,  4, year            ) ||
    834              readInt(line,  9,  2, month           ) ||
    835              readInt(line, 12,  2, day             ) ||
    836              readInt(line, 15,  2, hour            ) ||
    837              readInt(line, 18,  2, min             ) ||
    838              readInt(line, 21,  2, iSec            ) ||
    839              readDbl(line, 23, 19, _clock_bias     ) ||
    840              readDbl(line, 42, 19, _clock_drift    ) ||
    841              readDbl(line, 61, 19, _clock_driftrate) ) {
    842           return;
    843         }
    844         sec = iSec;
    845       }
     816      QTextStream in(line.left(pos[1]).toAscii());
     817
     818      int    year, month, day, hour, min;
     819      double sec;
     820     
     821      in >> _prn >> year >> month >> day >> hour >> min >> sec;
     822
     823      if (_prn.at(0) != 'G') {
     824        _prn = QString("G%1").arg(_prn.toInt(), 2, QChar('0'));
     825      }
     826
     827      if      (year <  80) {
     828        year += 2000;
     829      }
     830      else if (year < 100) {
     831        year += 1900;
     832      }
     833
    846834      bncTime hlpTime;
    847835      hlpTime.set(year, month, day, hour, min, sec);
     
    849837      _GPSweeks = hlpTime.gpssec();
    850838      _TOC      = _GPSweeks;
     839
     840      if ( readDbl(line, pos[1], fieldLen, _clock_bias     ) ||
     841           readDbl(line, pos[2], fieldLen, _clock_drift    ) ||
     842           readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
     843        return;
     844      }
    851845    }
    852846
    853847    else if      ( iLine == 1 ) {
    854       if ( readDbl(line, off +  3, 19, _IODE   ) ||
    855            readDbl(line, off + 22, 19, _Crs    ) ||
    856            readDbl(line, off + 41, 19, _Delta_n) ||
    857            readDbl(line, off + 60, 19, _M0     ) ) {
     848      if ( readDbl(line, pos[0], fieldLen, _IODE   ) ||
     849           readDbl(line, pos[1], fieldLen, _Crs    ) ||
     850           readDbl(line, pos[2], fieldLen, _Delta_n) ||
     851           readDbl(line, pos[3], fieldLen, _M0     ) ) {
    858852        return;
    859853      }
     
    861855
    862856    else if ( iLine == 2 ) {
    863       if ( readDbl(line, off +  3, 19, _Cuc   ) ||
    864            readDbl(line, off + 22, 19, _e     ) ||
    865            readDbl(line, off + 41, 19, _Cus   ) ||
    866            readDbl(line, off + 60, 19, _sqrt_A) ) {
     857      if ( readDbl(line, pos[0], fieldLen, _Cuc   ) ||
     858           readDbl(line, pos[1], fieldLen, _e     ) ||
     859           readDbl(line, pos[2], fieldLen, _Cus   ) ||
     860           readDbl(line, pos[3], fieldLen, _sqrt_A) ) {
    867861        return;
    868862      }
     
    870864
    871865    else if ( iLine == 3 ) {
    872       if ( readDbl(line, off +  3, 19, _TOE   )  ||
    873            readDbl(line, off + 22, 19, _Cic   )  ||
    874            readDbl(line, off + 41, 19, _OMEGA0)  ||
    875            readDbl(line, off + 60, 19, _Cis   ) ) {
     866      if ( readDbl(line, pos[0], fieldLen, _TOE   )  ||
     867           readDbl(line, pos[1], fieldLen, _Cic   )  ||
     868           readDbl(line, pos[2], fieldLen, _OMEGA0)  ||
     869           readDbl(line, pos[3], fieldLen, _Cis   ) ) {
    876870        return;
    877871      }
     
    879873
    880874    else if ( iLine == 4 ) {
    881       if ( readDbl(line, off +  3, 19, _i0      ) ||
    882            readDbl(line, off + 22, 19, _Crc     ) ||
    883            readDbl(line, off + 41, 19, _omega   ) ||
    884            readDbl(line, off + 60, 19, _OMEGADOT) ) {
     875      if ( readDbl(line, pos[0], fieldLen, _i0      ) ||
     876           readDbl(line, pos[1], fieldLen, _Crc     ) ||
     877           readDbl(line, pos[2], fieldLen, _omega   ) ||
     878           readDbl(line, pos[3], fieldLen, _OMEGADOT) ) {
    885879        return;
    886880      }
     
    889883    else if ( iLine == 5 ) {
    890884      double dummy, TOEw;
    891       if ( readDbl(line, off +  3, 19, _IDOT) ||
    892            readDbl(line, off + 22, 19, dummy) ||
    893            readDbl(line, off + 41, 19, TOEw ) ||
    894            readDbl(line, off + 60, 19, dummy) ) {
     885      if ( readDbl(line, pos[0], fieldLen, _IDOT) ||
     886           readDbl(line, pos[1], fieldLen, dummy) ||
     887           readDbl(line, pos[2], fieldLen, TOEw ) ||
     888           readDbl(line, pos[3], fieldLen, dummy) ) {
    895889        return;
    896890      }
     
    899893    else if ( iLine == 6 ) {
    900894      double dummy;
    901       if ( readDbl(line, off +  3, 19, dummy  ) ||
    902            readDbl(line, off + 22, 19, _health) ||
    903            readDbl(line, off + 41, 19, _TGD   ) ||
    904            readDbl(line, off + 60, 19, _IODC  ) ) {
     895      if ( readDbl(line, pos[0], fieldLen, dummy  ) ||
     896           readDbl(line, pos[1], fieldLen, _health) ||
     897           readDbl(line, pos[2], fieldLen, _TGD   ) ||
     898           readDbl(line, pos[3], fieldLen, _IODC  ) ) {
    905899        return;
    906900      }
     
    909903    else if ( iLine == 7 ) {
    910904      double TOT;
    911       if ( readDbl(line, off +  3, 19, TOT) ) {
     905      if ( readDbl(line, pos[0], fieldLen, TOT) ) {
    912906        return;
    913907      }
  • trunk/BNC/rnxnavfile.cpp

    r3663 r3666  
    4040
    4141#include <iostream>
     42#include <newmatio.h>
    4243#include "rnxnavfile.h"
    4344#include "bncutils.h"
     
    145146    }
    146147    if (eph && eph->ok()) {
     148      //// beg test
     149      ColumnVector xc(4);
     150      ColumnVector vv(3);
     151      eph->position(eph->GPSweek(), eph->GPSweeks(), xc.data(), vv.data());
     152      cout << "haha " << eph->prn().toAscii().data() << " " << xc.t();
     153      //// end test
    147154      return success;
    148155    }
Note: See TracChangeset for help on using the changeset viewer.