00001 #pragma ident "$Id: SolverPPPFB.cpp 2346 2010-03-13 15:55:58Z yanweignss $"
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "SolverPPPFB.hpp"
00032
00033
00034 namespace gpstk
00035 {
00036
00037
00038 int SolverPPPFB::classIndex = 9400000;
00039
00040
00041
00042 int SolverPPPFB::getIndex() const
00043 { return index; }
00044
00045
00046
00047 std::string SolverPPPFB::getClassName() const
00048 { return "SolverPPPFB"; }
00049
00050
00051
00052
00053
00054
00055
00056 SolverPPPFB::SolverPPPFB(bool useNEU)
00057 : firstIteration(true)
00058 {
00059
00060
00061 processedMeasurements = 0;
00062
00063
00064 rejectedMeasurements = 0;
00065
00066
00067 SolverPPP::setNEU(useNEU);
00068
00069
00070 setIndex();
00071
00072
00073
00074 keepTypeSet.insert(TypeID::wetMap);
00075
00076 if (useNEU)
00077 {
00078 keepTypeSet.insert(TypeID::dLat);
00079 keepTypeSet.insert(TypeID::dLon);
00080 keepTypeSet.insert(TypeID::dH);
00081 }
00082 else
00083 {
00084 keepTypeSet.insert(TypeID::dx);
00085 keepTypeSet.insert(TypeID::dy);
00086 keepTypeSet.insert(TypeID::dz);
00087 }
00088
00089 keepTypeSet.insert(TypeID::cdt);
00090 keepTypeSet.insert(TypeID::prefitC);
00091 keepTypeSet.insert(TypeID::prefitL);
00092 keepTypeSet.insert(TypeID::weight);
00093 keepTypeSet.insert(TypeID::CSL1);
00094 keepTypeSet.insert(TypeID::satArc);
00095
00096
00097 }
00098
00099
00100
00101
00102
00103
00104
00105
00106 gnssSatTypeValue& SolverPPPFB::Process(gnssSatTypeValue& gData)
00107 throw(ProcessingException)
00108 {
00109
00110 try
00111 {
00112
00113
00114 gnssRinex g1;
00115 g1.header = gData.header;
00116 g1.body = gData.body;
00117
00118
00119 Process(g1);
00120
00121
00122 gData.body = g1.body;
00123
00124 return gData;
00125
00126 }
00127 catch(Exception& u)
00128 {
00129
00130 ProcessingException e( getClassName() + ":"
00131 + StringUtils::asString( getIndex() ) + ":"
00132 + u.what() );
00133
00134 GPSTK_THROW(e);
00135
00136 }
00137
00138 }
00139
00140
00141
00142
00143
00144
00145
00146
00147 gnssRinex& SolverPPPFB::Process(gnssRinex& gData)
00148 throw(ProcessingException)
00149 {
00150
00151 try
00152 {
00153
00154 SolverPPP::Process(gData);
00155
00156
00157
00158 if(firstIteration)
00159 {
00160
00161
00162 gnssRinex gBak(gData.extractTypeID(keepTypeSet));
00163
00164
00165 ObsData.push_back(gBak);
00166
00167
00168 processedMeasurements += gData.numSats();
00169
00170 }
00171
00172 return gData;
00173
00174 }
00175 catch(Exception& u)
00176 {
00177
00178 ProcessingException e( getClassName() + ":"
00179 + StringUtils::asString( getIndex() ) + ":"
00180 + u.what() );
00181
00182 GPSTK_THROW(e);
00183
00184 }
00185
00186 }
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 void SolverPPPFB::ReProcess(int cycles)
00198 throw(ProcessingException)
00199 {
00200
00201
00202 if (cycles < 1)
00203 {
00204 cycles = 1;
00205 }
00206
00207
00208
00209 firstIteration = false;
00210
00211 try
00212 {
00213
00214 std::list<gnssRinex>::iterator pos;
00215 std::list<gnssRinex>::reverse_iterator rpos;
00216
00217
00218 for (rpos = ObsData.rbegin(); rpos != ObsData.rend(); ++rpos)
00219 {
00220
00221 SolverPPP::Process( (*rpos) );
00222
00223 }
00224
00225
00226 for (int i=0; i<(cycles-1); i++)
00227 {
00228
00229
00230 for (pos = ObsData.begin(); pos != ObsData.end(); ++pos)
00231 {
00232 SolverPPP::Process( (*pos) );
00233 }
00234
00235
00236 for (rpos = ObsData.rbegin(); rpos != ObsData.rend(); ++rpos)
00237 {
00238 SolverPPP::Process( (*rpos) );
00239 }
00240
00241 }
00242
00243 return;
00244
00245 }
00246 catch(Exception& u)
00247 {
00248
00249 ProcessingException e( getClassName() + ":"
00250 + StringUtils::asString( getIndex() ) + ":"
00251 + u.what() );
00252
00253 GPSTK_THROW(e);
00254
00255 }
00256
00257 }
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 void SolverPPPFB::ReProcess( void )
00268 throw(ProcessingException)
00269 {
00270
00271
00272 std::list<double> codeList( limitsCodeList );
00273 std::list<double> phaseList( limitsPhaseList );
00274
00275
00276 int maxSize( codeList.size() );
00277 if( maxSize < phaseList.size() ) maxSize = phaseList.size();
00278
00279
00280
00281 firstIteration = false;
00282
00283 try
00284 {
00285
00286 std::list<gnssRinex>::iterator pos;
00287 std::list<gnssRinex>::reverse_iterator rpos;
00288
00289
00290 for (rpos = ObsData.rbegin(); rpos != ObsData.rend(); ++rpos)
00291 {
00292
00293 SolverPPP::Process( (*rpos) );
00294
00295 }
00296
00297
00298 if( maxSize == 0 )
00299 {
00300 return;
00301 }
00302
00303
00304 double codeLimit( 1000000.0 );
00305 double phaseLimit( 1000000.0 );
00306
00307
00308 for (int i = 0; i < maxSize; i++)
00309 {
00310
00311
00312 if( codeList.size() > 0 )
00313 {
00314
00315 codeLimit = codeList.front();
00316
00317
00318 codeList.pop_front();
00319 }
00320
00321 if( phaseList.size() > 0 )
00322 {
00323
00324 phaseLimit = phaseList.front();
00325
00326
00327 phaseList.pop_front();
00328 }
00329
00330
00331
00332 for (pos = ObsData.begin(); pos != ObsData.end(); ++pos)
00333 {
00334
00335 checkLimits( (*pos), codeLimit, phaseLimit );
00336
00337
00338 SolverPPP::Process( (*pos) );
00339 }
00340
00341
00342 for (rpos = ObsData.rbegin(); rpos != ObsData.rend(); ++rpos)
00343 {
00344
00345 checkLimits( (*rpos), codeLimit, phaseLimit );
00346
00347
00348 SolverPPP::Process( (*rpos) );
00349 }
00350
00351 }
00352
00353 return;
00354
00355 }
00356 catch(Exception& u)
00357 {
00358
00359 ProcessingException e( getClassName() + ":"
00360 + StringUtils::asString( getIndex() ) + ":"
00361 + u.what() );
00362
00363 GPSTK_THROW(e);
00364
00365 }
00366
00367 }
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 bool SolverPPPFB::LastProcess(gnssSatTypeValue& gData)
00379 throw(ProcessingException)
00380 {
00381
00382 try
00383 {
00384
00385
00386 gnssRinex g1;
00387
00388
00389 bool result( LastProcess(g1) );
00390
00391 if(result)
00392 {
00393
00394 gData.header = g1.header;
00395 gData.body = g1.body;
00396
00397 }
00398
00399 return result;
00400
00401 }
00402 catch(Exception& u)
00403 {
00404
00405 ProcessingException e( getClassName() + ":"
00406 + StringUtils::asString( getIndex() ) + ":"
00407 + u.what() );
00408
00409 GPSTK_THROW(e);
00410
00411 }
00412
00413 }
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424 bool SolverPPPFB::LastProcess(gnssRinex& gData)
00425 throw(ProcessingException)
00426 {
00427
00428 try
00429 {
00430
00431
00432 if( !(ObsData.empty()) )
00433 {
00434
00435
00436
00437 gData = SolverPPP::Process( ObsData.front() );
00438
00439
00440
00441 ObsData.pop_front();
00442
00443
00444
00445 solution = SolverPPP::solution;
00446 covMatrix = SolverPPP::covMatrix;
00447 postfitResiduals = SolverPPP::postfitResiduals;
00448
00449
00450 valid = true;
00451
00452 return true;
00453
00454 }
00455 else
00456 {
00457
00458
00459 return false;
00460
00461 }
00462
00463 }
00464 catch(Exception& u)
00465 {
00466
00467 ProcessingException e( getClassName() + ":"
00468 + StringUtils::asString( getIndex() ) + ":"
00469 + u.what() );
00470
00471 GPSTK_THROW(e);
00472
00473 }
00474
00475 }
00476
00477
00478
00479
00480 void SolverPPPFB::checkLimits( gnssRinex& gData,
00481 double codeLimit,
00482 double phaseLimit )
00483 {
00484
00485
00486 SatIDSet satRejectedSet;
00487
00488
00489 for( satTypeValueMap::iterator it = gData.body.begin();
00490 it != gData.body.end();
00491 ++it )
00492 {
00493
00494
00495 if( std::abs((*it).second( TypeID::postfitC )) > codeLimit )
00496 {
00497 satRejectedSet.insert( (*it).first );
00498 }
00499
00500 if( std::abs((*it).second( TypeID::postfitL )) > phaseLimit )
00501 {
00502 satRejectedSet.insert( (*it).first );
00503 }
00504
00505 }
00506
00507
00508
00509 rejectedMeasurements += satRejectedSet.size();
00510
00511
00512 gData.removeSatID(satRejectedSet);
00513
00514 return;
00515
00516 }
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526 SolverPPPFB& SolverPPPFB::setNEU( bool useNEU )
00527 {
00528
00529
00530 SolverPPP::setNEU(useNEU);
00531
00532
00533
00534
00535 keepTypeSet.clear();
00536
00537 keepTypeSet.insert(TypeID::wetMap);
00538
00539 if (useNEU)
00540 {
00541 keepTypeSet.insert(TypeID::dLat);
00542 keepTypeSet.insert(TypeID::dLon);
00543 keepTypeSet.insert(TypeID::dH);
00544 }
00545 else
00546 {
00547 keepTypeSet.insert(TypeID::dx);
00548 keepTypeSet.insert(TypeID::dy);
00549 keepTypeSet.insert(TypeID::dz);
00550 }
00551
00552 keepTypeSet.insert(TypeID::cdt);
00553 keepTypeSet.insert(TypeID::prefitC);
00554 keepTypeSet.insert(TypeID::prefitL);
00555 keepTypeSet.insert(TypeID::weight);
00556 keepTypeSet.insert(TypeID::CSL1);
00557 keepTypeSet.insert(TypeID::satArc);
00558
00559
00560
00561 return (*this);
00562
00563 }
00564
00565
00566
00567 }