Changeset 1197 in ntrip
- Timestamp:
- Nov 15, 2008, 10:33:54 AM (16 years ago)
- Location:
- trunk/BNS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r1123 r1197 289 289 void t_bns::readEpoch() { 290 290 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) { 301 303 return; 302 304 } 303 305 304 QTextStream in( line);306 QTextStream in(_clkLine); 305 307 306 308 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; 308 314 double GPSweeks; 309 315 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) { 313 342 314 343 QStringList prns; … … 328 357 co.SatRefDatum = DATUM_ITRF; 329 358 330 for (int ii = 1; ii <= numSat; ii++) {331 359 for (int ii = 0; ii < lines.size(); ii++) { 360 332 361 QString prn; 333 362 ColumnVector xx(5); … … 335 364 336 365 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()); 345 367 in >> prn; 346 368 prns << prn; 347 369 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 test370 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; 353 375 354 376 t_ephPair* pair = _ephList[prn]; … … 358 380 } 359 381 else { 360 prn = prns[ii -1];382 prn = prns[ii]; 361 383 if ( _ephList.contains(prn) ) { 362 384 t_ephPair* pair = _ephList[prn]; -
trunk/BNS/bns.h
r1102 r1197 77 77 bnsRinex* _rnx; 78 78 bnsSP3* _sp3; 79 QByteArray _clkLine; 79 80 }; 80 81 #endif -
trunk/BNS/bnsutils.cpp
r1125 r1197 166 166 } 167 167 168 // 169 //////////////////////////////////////////////////////////////////////////// 170 double 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 186 void 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 201 void 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 20 20 int& GPSWeek, double& GPSWeeks); 21 21 22 void GPSweekFromYMDhms(int year, int month, int day, int hour, int min, 23 double sec, int& GPSWeek, double& GPSWeeks); 24 22 25 void mjdFromDateAndTime(const QDateTime& dateTime, int& mjd, double& dayfrac); 23 26
Note:
See TracChangeset
for help on using the changeset viewer.