- Timestamp:
- Mar 30, 2011, 4:07:41 PM (14 years ago)
- Location:
- trunk/BNC/combination
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/BNC/combination/bnccomb.cpp ¶
r3184 r3201 20 20 #include "bnccomb.h" 21 21 #include "bncapp.h" 22 #include " cmbcaster.h"22 #include "upload/bncrtnetdecoder.h" 23 23 #include "bncsettings.h" 24 24 #include "bncmodel.h" … … 118 118 } 119 119 120 _caster = new cmbCaster(); 120 _rtnetDecoder = new bncRtnetDecoder(); 121 121 122 connect(this, SIGNAL(newMessage(QByteArray,bool)), 122 123 ((bncApp*)qApp), SLOT(slotMessage(const QByteArray,bool))); … … 162 163 } 163 164 164 // Output File (skeleton name)165 // ---------------------------166 QString path = settings.value("cmbOutPath").toString();167 if (!path.isEmpty() && !_caster->mountpoint().isEmpty()) {168 expandEnvVar(path);169 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {170 path += QDir::separator();171 }172 _outNameSkl = path + _caster->mountpoint();173 }174 _out = 0;175 176 // SP3 writer177 // ----------178 if ( settings.value("cmbSP3Path").toString().isEmpty() ) {179 _sp3 = 0;180 }181 else {182 QString sklFileName = settings.value("cmbSP3Path").toString()183 + QDir::separator() + "BNC.sp3";184 QString interval = "";185 int sampl = 0;186 _sp3 = new bncSP3(sklFileName, interval, sampl);187 }188 189 165 // ANTEX File 190 166 // ---------- … … 213 189 delete it.value(); 214 190 } 215 delete _caster; 216 delete _out; 217 delete _sp3; 191 delete _rtnetDecoder; 218 192 delete _antex; 219 193 } … … 328 302 } 329 303 330 // Send results to caster304 // Send results to RTNet Decoder and directly to PPP Client 331 305 //////////////////////////////////////////////////////////////////////////// 332 306 void bncComb::dumpResults(const bncTime& resTime, 333 307 const QMap<QString, t_corr*>& resCorr) { 334 335 _caster->open();336 337 unsigned year, month, day;338 resTime.civil_date (year, month, day);339 double GPSweeks = resTime.gpssec();340 341 struct ClockOrbit co;342 memset(&co, 0, sizeof(co));343 co.GPSEpochTime = (int)GPSweeks;344 co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)345 + 3 * 3600 - gnumleap(year, month, day);346 co.ClockDataSupplied = 1;347 co.OrbitDataSupplied = 1;348 co.SatRefDatum = DATUM_ITRF;349 350 struct Bias bias;351 memset(&bias, 0, sizeof(bias));352 bias.GPSEpochTime = (int)GPSweeks;353 bias.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0)354 + 3 * 3600 - gnumleap(year, month, day);355 308 356 309 QMapIterator<QString, t_corr*> it(resCorr); … … 359 312 t_corr* corr = it.value(); 360 313 361 struct ClockOrbit::SatData* sd = 0; 362 if (corr->prn[0] == 'G') { 363 sd = co.Sat + co.NumberOfGPSSat; 364 ++co.NumberOfGPSSat; 365 } 366 else if (corr->prn[0] == 'R') { 367 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat; 368 ++co.NumberOfGLONASSSat; 369 } 370 371 if (sd != 0) { 372 sd->ID = corr->prn.mid(1).toInt(); 373 sd->IOD = corr->iod; 374 sd->Clock.DeltaA0 = corr->dClk * t_CST::c; 375 sd->Orbit.DeltaRadial = corr->rao(1); 376 sd->Orbit.DeltaAlongTrack = corr->rao(2); 377 sd->Orbit.DeltaCrossTrack = corr->rao(3); 378 sd->Orbit.DotDeltaRadial = corr->dotRao(1); 379 sd->Orbit.DotDeltaAlongTrack = corr->dotRao(2); 380 sd->Orbit.DotDeltaCrossTrack = corr->dotRao(3); 381 } 382 383 struct Bias::BiasSat* biasSat = 0; 384 if (corr->prn[0] == 'G') { 385 biasSat = bias.Sat + bias.NumberOfGPSSat; 386 ++bias.NumberOfGPSSat; 387 } 388 else if (corr->prn[0] == 'R') { 389 biasSat = bias.Sat + CLOCKORBIT_NUMGPS + bias.NumberOfGLONASSSat; 390 ++bias.NumberOfGLONASSSat; 391 } 392 393 // Coefficient of Ionosphere-Free LC 394 // --------------------------------- 395 const static double a_L1_GPS = 2.54572778; 396 const static double a_L2_GPS = -1.54572778; 397 const static double a_L1_Glo = 2.53125000; 398 const static double a_L2_Glo = -1.53125000; 399 400 if (biasSat) { 401 biasSat->ID = corr->prn.mid(1).toInt(); 402 biasSat->NumberOfCodeBiases = 3; 403 if (corr->prn[0] == 'G') { 404 biasSat->Biases[0].Type = CODETYPEGPS_L1_Z; 405 biasSat->Biases[0].Bias = - a_L2_GPS * 0.0; // xx(10); 406 biasSat->Biases[1].Type = CODETYPEGPS_L1_CA; 407 biasSat->Biases[1].Bias = - a_L2_GPS * 0.0; // xx(10) + xx(9); 408 biasSat->Biases[2].Type = CODETYPEGPS_L2_Z; 409 biasSat->Biases[2].Bias = a_L1_GPS * 0.0; // xx(10); 410 } 411 else if (corr->prn[0] == 'R') { 412 biasSat->Biases[0].Type = CODETYPEGLONASS_L1_P; 413 biasSat->Biases[0].Bias = - a_L2_Glo * 0.0; // xx(10); 414 biasSat->Biases[1].Type = CODETYPEGLONASS_L1_CA; 415 biasSat->Biases[1].Bias = - a_L2_Glo * 0.0; // xx(10) + xx(9); 416 biasSat->Biases[2].Type = CODETYPEGLONASS_L2_P; 417 biasSat->Biases[2].Bias = a_L1_Glo * 0.0; // xx(10); 418 } 419 } 420 421 // SP3 Output 422 // ---------- 423 if (_sp3) { 424 ColumnVector xc(4); 425 ColumnVector vv(3); 426 corr->eph->position(resTime.gpsw(), resTime.gpssec(), 427 xc.data(), vv.data()); 428 bncPPPclient::applyCorr(resTime, corr, xc, vv); 429 430 // Relativistic Correction 431 // ----------------------- 432 xc(4) += 2.0 * DotProduct(xc.Rows(1,3),vv) / t_CST::c / t_CST::c; 433 434 // Correction Phase Center --> CoM 435 // ------------------------------- 436 if (_antex) { 437 ColumnVector dx(3); dx = 0.0; 438 double Mjd = resTime.mjd() + resTime.daysec()/86400.0; 439 if (_antex->satCoMcorrection(corr->prn, Mjd, xc.Rows(1,3), dx) == success) { 440 xc(1) -= dx(1); 441 xc(2) -= dx(2); 442 xc(3) -= dx(3); 443 } 444 else { 445 cout << "antenna not found" << endl; 446 } 447 } 448 _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc); 449 } 450 451 delete corr; 452 } 453 454 // Send Corrections to Caster 455 // -------------------------- 456 if ( _caster->usedSocket() && 457 (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) { 458 char obuffer[CLOCKORBIT_BUFFERSIZE]; 459 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer)); 460 if (len > 0) { 461 _caster->write(obuffer, len); 462 } 463 } 464 465 if ( _caster->usedSocket() && 466 (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) ) { 467 char obuffer[CLOCKORBIT_BUFFERSIZE]; 468 int len = MakeBias(&bias, BTYPE_AUTO, 0, obuffer, sizeof(obuffer)); 469 if (len > 0) { 470 _caster->write(obuffer, len); 471 } 472 } 473 474 // Optionall send new Corrections to PPP client and/or write into file 475 // ------------------------------------------------------------------- 476 RTCM3coDecoder::reopen(_outNameSkl, _outName, _out); 477 bncApp* app = (bncApp*) qApp; 478 if (app->_bncPPPclient || _out) { 479 QStringList corrLines; 480 co.messageType = COTYPE_GPSCOMBINED; 481 QStringListIterator il(RTCM3coDecoder::corrsToASCIIlines(resTime.gpsw(), 482 resTime.gpssec(), co, 0)); 483 while (il.hasNext()) { 484 QString line = il.next(); 485 if (_out) { 486 *_out << line.toAscii().data() << endl; 487 _out->flush(); 488 } 489 line += " " + _caster->mountpoint(); 490 corrLines << line; 491 } 492 314 // // SP3 Output 315 // // ---------- 316 // if (_sp3) { 317 // ColumnVector xc(4); 318 // ColumnVector vv(3); 319 // corr->eph->position(resTime.gpsw(), resTime.gpssec(), 320 // xc.data(), vv.data()); 321 // bncPPPclient::applyCorr(resTime, corr, xc, vv); 322 // 323 // // Relativistic Correction 324 // // ----------------------- 325 // xc(4) += 2.0 * DotProduct(xc.Rows(1,3),vv) / t_CST::c / t_CST::c; 326 // 327 // // Correction Phase Center --> CoM 328 // // ------------------------------- 329 // if (_antex) { 330 // ColumnVector dx(3); dx = 0.0; 331 // double Mjd = resTime.mjd() + resTime.daysec()/86400.0; 332 // if (_antex->satCoMcorrection(corr->prn, Mjd, xc.Rows(1,3), dx) == success) { 333 // xc(1) -= dx(1); 334 // xc(2) -= dx(2); 335 // xc(3) -= dx(3); 336 // } 337 // else { 338 // cout << "antenna not found" << endl; 339 // } 340 // } 341 // _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc); 342 // } 343 // 344 // delete corr; 345 // } 346 347 // Optionally send new Corrections to PPP 348 // -------------------------------------- 349 bncApp* app = (bncApp*) qApp; 493 350 if (app->_bncPPPclient) { 494 app->_bncPPPclient->slotNewCorrections(corrLines); 351 // QStringList corrLines; 352 // co.messageType = COTYPE_GPSCOMBINED; 353 // QStringListIterator il(RTCM3coDecoder::corrsToASCIIlines(resTime.gpsw(), 354 // resTime.gpssec(), co, 0)); 355 // while (il.hasNext()) { 356 // QString line = il.next(); 357 // line += " COMB"; 358 // corrLines << line; 359 // } 360 // 361 // app->_bncPPPclient->slotNewCorrections(corrLines); 495 362 } 496 363 } … … 709 576 } 710 577 711 // Print results to caster578 // Print results 712 579 //////////////////////////////////////////////////////////////////////////// 713 580 void bncComb::printResults(QTextStream& out, const bncTime& resTime, -
TabularUnified trunk/BNC/combination/bnccomb.h ¶
r3184 r3201 7 7 #include "bncephuser.h" 8 8 9 class cmbCaster;9 class bncRtnetDecoder; 10 10 class bncSP3; 11 11 class bncAntex; … … 80 80 QMap<QString, cmbAC*> _ACs; // Analytical Centers (key is mountpoint) 81 81 bncTime _processedBeforeTime; 82 cmbCaster* _caster;83 82 QVector<cmbParam*> _params; 83 bncRtnetDecoder* _rtnetDecoder; 84 84 SymmetricMatrix _QQ; 85 85 bool _firstReg; 86 86 QByteArray _log; 87 87 QString _masterAC; 88 QString _outNameSkl;89 QString _outName;90 std::ofstream* _out;91 bncSP3* _sp3;92 88 bncAntex* _antex; 93 89 };
Note:
See TracChangeset
for help on using the changeset viewer.