Changeset 1197 in ntrip


Ignore:
Timestamp:
Nov 15, 2008, 10:33:54 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r1123 r1197  
    289289void t_bns::readEpoch() {
    290290
    291   QByteArray line = _clkSocket->readLine();
    292 
    293   if (_echoStream) {
    294     *_echoStream << line;
    295     _echoStream->flush();
    296   }
    297 
    298   emit(newClkBytes(line.length()));
    299 
    300   if (line.indexOf('*') == -1) {
     291  // Read the first line (if not already read)
     292  // -----------------------------------------
     293  if (_clkLine.indexOf('*') == -1) {
     294    _clkLine = _clkSocket->readLine();
     295    if (_echoStream) {
     296      *_echoStream << _clkLine;
     297      _echoStream->flush();
     298    }
     299    emit(newClkBytes(_clkLine.length()));
     300  }
     301
     302  if (_clkLine.indexOf('*') == -1) {
    301303    return;
    302304  }
    303305
    304   QTextStream in(line);
     306  QTextStream in(_clkLine);
    305307
    306308  QString hlp;
    307   int     GPSweek, numSat;
     309  int     year, month, day, hour, min;
     310  double  sec;
     311  in >> hlp >> year >> month >> day >> hour >> min >> sec;
     312
     313  int     GPSweek;
    308314  double  GPSweeks;
    309315
    310   in >> hlp >> GPSweek >> GPSweeks >> numSat;
    311 
    312   if (numSat > 0) {
     316  GPSweekFromYMDhms(year, month, day, hour, min, sec, GPSweek, GPSweeks);
     317
     318  QStringList prns;
     319
     320  // Loop over all satellites
     321  // ------------------------
     322  QStringList lines;
     323  for (;;) {
     324    if (!_clkSocket->canReadLine()) {
     325      return;
     326    }
     327    _clkLine = _clkSocket->readLine();
     328    if (_echoStream) {
     329      *_echoStream << _clkLine;
     330      _echoStream->flush();
     331    }
     332    if (_clkLine[0] == '*') {
     333      return;
     334    }
     335    if (_clkLine[0] == 'P') {
     336      _clkLine.remove(0,1);
     337      lines.push_back(_clkLine);
     338    }
     339  }
     340
     341  if (lines.size() > 0) {
    313342
    314343    QStringList prns;
     
    328357        co.SatRefDatum       = DATUM_ITRF;
    329358     
    330         for (int ii = 1; ii <= numSat; ii++) {
    331      
     359        for (int ii = 0; ii < lines.size(); ii++) {
     360
    332361          QString      prn;
    333362          ColumnVector xx(5);
     
    335364     
    336365          if (oldEph == 0 && ic == 0) {
    337             line = _clkSocket->readLine();
    338 
    339             if (_echoStream) {
    340               *_echoStream << line;
    341               _echoStream->flush();
    342             }
    343 
    344             QTextStream in(line);
     366            QTextStream in(lines[ii].toAscii());
    345367            in >> prn;
    346368            prns << prn;
    347369            if ( _ephList.contains(prn) ) {
    348               in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6;
    349      
    350               //// beg test (zero clock correction for Gerhard Wuebbena)
    351               ////            xx(4) -= xx(5) / 299792458.0;
    352               //// end test
     370              in >> xx(1) >> xx(2) >> xx(3) >> xx(4);
     371              xx(1) *= 1e3;
     372              xx(2) *= 1e3;
     373              xx(3) *= 1e3;
     374              xx(4) *= 1e-6;
    353375     
    354376              t_ephPair* pair = _ephList[prn];
     
    358380          }
    359381          else {
    360             prn = prns[ii-1];
     382            prn = prns[ii];
    361383            if ( _ephList.contains(prn) ) {
    362384              t_ephPair* pair = _ephList[prn];
  • trunk/BNS/bns.h

    r1102 r1197  
    7777  bnsRinex*                 _rnx;
    7878  bnsSP3*                   _sp3;
     79  QByteArray                _clkLine;
    7980};
    8081#endif
  • trunk/BNS/bnsutils.cpp

    r1125 r1197  
    166166}
    167167
     168//
     169////////////////////////////////////////////////////////////////////////////
     170double djul(int jj, int mm, double tt) {
     171  int    ii, kk;
     172  double  djul ;
     173
     174  if( mm <= 2 ) {
     175    jj = jj - 1;
     176    mm = mm + 12;
     177  } 
     178 
     179  ii   = jj/100;
     180  kk   = 2 - ii + ii/4;
     181  djul = (365.25*jj - fmod( 365.25*jj, 1.0 )) - 679006.0;
     182  djul = djul + floor( 30.6001*(mm + 1) ) + tt + kk;
     183  return djul;
     184}
     185
     186void jdgp(double tjul, double & second, int & nweek) {
     187  double      deltat;
     188
     189  deltat = tjul - 44244.0 ;
     190
     191  // current gps week
     192
     193  nweek = (int) floor(deltat/7.0);
     194
     195  // seconds past midnight of last weekend
     196
     197  second = (deltat - (nweek)*7.0)*86400.0;
     198
     199}
     200
     201void GPSweekFromYMDhms(int year, int month, int day, int hour, int min,
     202                       double sec, int& GPSWeek, double& GPSWeeks) {
     203
     204  double tt = (min / 60.0 + hour) / 24.0 + day;
     205  double mjd = djul(year, month, tt);
     206  jdgp(mjd, GPSWeeks, GPSWeek);
     207  GPSWeeks += sec; 
     208}
     209
  • trunk/BNS/bnsutils.h

    r930 r1197  
    2020                            int& GPSWeek, double& GPSWeeks);
    2121
     22void GPSweekFromYMDhms(int year, int month, int day, int hour, int min,
     23                       double sec, int& GPSWeek, double& GPSWeeks);
     24
    2225void mjdFromDateAndTime(const QDateTime& dateTime, int& mjd, double& dayfrac);
    2326
Note: See TracChangeset for help on using the changeset viewer.