00001 #pragma ident "$Id: CorrectObservables.cpp 1770 2009-03-04 13:10:43Z architest $"
00002
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "CorrectObservables.hpp"
00033
00034
00035 namespace gpstk
00036 {
00037
00038
00039 int CorrectObservables::classIndex = 4300000;
00040
00041
00042
00043 int CorrectObservables::getIndex() const
00044 { return index; }
00045
00046
00047
00048 std::string CorrectObservables::getClassName() const
00049 { return "CorrectObservables"; }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 satTypeValueMap& CorrectObservables::Process( const DayTime& time,
00060 satTypeValueMap& gData )
00061 throw(ProcessingException)
00062 {
00063
00064 try
00065 {
00066
00067
00068 double lat(nominalPos.geodeticLatitude());
00069 double lon(nominalPos.longitude());
00070
00071
00072 Triple staPos( nominalPos.getX(),
00073 nominalPos.getY(),
00074 nominalPos.getZ() );
00075
00076
00077
00078 Triple initialBias( extraBiases + monumentVector );
00079 Triple dispL1( initialBias );
00080 Triple dispL2( initialBias );
00081 Triple dispL5( initialBias );
00082 Triple dispL6( initialBias );
00083 Triple dispL7( initialBias );
00084 Triple dispL8( initialBias );
00085
00086
00087
00088 if( antenna.isValid() )
00089 {
00090
00091 L1PhaseCenter = antenna.getAntennaEccentricity( Antenna::G01 );
00092 L2PhaseCenter = antenna.getAntennaEccentricity( Antenna::G02 );
00093 }
00094
00095
00096
00097
00098 Triple svPos(0.0, 0.0, 0.0);
00099
00100 SatIDSet satRejectedSet;
00101
00102
00103 satTypeValueMap::iterator it;
00104 for (it = gData.begin(); it != gData.end(); ++it)
00105 {
00106
00107
00108 if( ( (*it).second.find(TypeID::satX) == (*it).second.end() ) ||
00109 ( (*it).second.find(TypeID::satY) == (*it).second.end() ) ||
00110 ( (*it).second.find(TypeID::satZ) == (*it).second.end() ) )
00111 {
00112
00113 if(pEphemeris==NULL)
00114 {
00115
00116
00117 satRejectedSet.insert( (*it).first );
00118
00119 continue;
00120 }
00121 else
00122 {
00123
00124
00125 try
00126 {
00127
00128
00129 Xvt svPosVel(pEphemeris->getXvt( (*it).first, time ));
00130
00131
00132 svPos[0] = svPosVel.x.theArray[0];
00133 svPos[1] = svPosVel.x.theArray[1];
00134 svPos[2] = svPosVel.x.theArray[2];
00135
00136 }
00137 catch(...)
00138 {
00139
00140
00141
00142 satRejectedSet.insert( (*it).first );
00143
00144 continue;
00145
00146 }
00147 }
00148
00149 }
00150 else
00151 {
00152
00153
00154 svPos[0] = (*it).second[TypeID::satX];
00155 svPos[1] = (*it).second[TypeID::satY];
00156 svPos[2] = (*it).second[TypeID::satZ];
00157
00158 }
00159
00160
00161
00162
00163
00164 Triple L1Var( 0.0, 0.0, 0.0 );
00165 Triple L2Var( 0.0, 0.0, 0.0 );
00166
00167
00168 if( antenna.isValid() )
00169 {
00170
00171
00172 if( (*it).second.find(TypeID::elevation) != (*it).second.end() )
00173 {
00174
00175
00176 double elev( (*it).second[TypeID::elevation] );
00177
00178
00179 if( !useAzimuth )
00180 {
00181
00182
00183 try
00184 {
00185
00186
00187 L1Var = antenna.getAntennaPCVariation( Antenna::G01,
00188 elev );
00189 L2Var = antenna.getAntennaPCVariation( Antenna::G02,
00190 elev );
00191
00192 }
00193 catch(InvalidRequest& ir)
00194 {
00195
00196
00197 ProcessingException e( getClassName() + ":"
00198 + StringUtils::asString( getIndex() ) + ":"
00199 + "Unexpected problem found when trying to "
00200 + "compute antenna offsets" );
00201
00202 GPSTK_THROW(e);
00203 }
00204
00205 }
00206 else
00207 {
00208
00209
00210 if( (*it).second.find(TypeID::azimuth) !=
00211 (*it).second.end() )
00212 {
00213
00214
00215 double azim( (*it).second[TypeID::azimuth] );
00216
00217
00218
00219 try
00220 {
00221
00222 L1Var = antenna.getAntennaPCVariation( Antenna::G01,
00223 elev,
00224 azim );
00225
00226 L2Var = antenna.getAntennaPCVariation( Antenna::G02,
00227 elev,
00228 azim );
00229
00230 }
00231 catch(InvalidRequest& ir)
00232 {
00233
00234 try
00235 {
00236
00237
00238 L1Var =
00239 antenna.getAntennaPCVariation( Antenna::G01,
00240 elev );
00241
00242 L2Var =
00243 antenna.getAntennaPCVariation( Antenna::G02,
00244 elev );
00245
00246 }
00247 catch(InvalidRequest& ir)
00248 {
00249
00250
00251 ProcessingException e( getClassName() + ":"
00252 + StringUtils::asString( getIndex() ) + ":"
00253 + "Unexpected problem found when trying to "
00254 + "compute antenna offsets" );
00255
00256 GPSTK_THROW(e);
00257 }
00258
00259 }
00260
00261 }
00262 else
00263 {
00264
00265
00266 ProcessingException e( getClassName() + ":"
00267 + StringUtils::asString( getIndex() ) + ":"
00268 + "Azimuth information could not be found, "
00269 + "so antenna PC offsets can not be computed");
00270
00271 GPSTK_THROW(e);
00272
00273 }
00274
00275 }
00276
00277 }
00278 else
00279 {
00280
00281
00282 ProcessingException e( getClassName() + ":"
00283 + StringUtils::asString( getIndex() ) + ":"
00284 + "Elevation information could not be found, "
00285 + "so antenna PC offsets can not be computed" );
00286
00287 GPSTK_THROW(e);
00288
00289 }
00290
00291
00292 }
00293
00294
00295
00296 Triple dL1( dispL1 + L1PhaseCenter - L1Var );
00297 Triple dL2( dispL2 + L2PhaseCenter - L2Var );
00298 Triple dL5( dispL5 + L5PhaseCenter );
00299 Triple dL6( dispL6 + L6PhaseCenter );
00300 Triple dL7( dispL7 + L7PhaseCenter );
00301 Triple dL8( dispL8 + L8PhaseCenter );
00302
00303
00304 Triple ray(svPos - staPos);
00305
00306
00307 ray = (ray.R3(lon)).R2(-lat);
00308
00309
00310 ray = ray.unitVector();
00311
00312
00313
00314 double corrL1(dL1.dot(ray));
00315 double corrL2(dL2.dot(ray));
00316 double corrL5(dL5.dot(ray));
00317 double corrL6(dL6.dot(ray));
00318 double corrL7(dL7.dot(ray));
00319 double corrL8(dL8.dot(ray));
00320
00321
00322
00323
00324
00325
00326 if( (*it).second.find(TypeID::C1) != (*it).second.end() )
00327 {
00328 (*it).second[TypeID::C1] = (*it).second[TypeID::C1] + corrL1;
00329 };
00330
00331
00332 if( (*it).second.find(TypeID::P1) != (*it).second.end() )
00333 {
00334 (*it).second[TypeID::P1] = (*it).second[TypeID::P1] + corrL1;
00335 };
00336
00337
00338 if( (*it).second.find(TypeID::L1) != (*it).second.end() )
00339 {
00340 (*it).second[TypeID::L1] = (*it).second[TypeID::L1] + corrL1;
00341 };
00342
00343
00344 if( (*it).second.find(TypeID::C2) != (*it).second.end() )
00345 {
00346 (*it).second[TypeID::C2] = (*it).second[TypeID::C2] + corrL2;
00347 };
00348
00349
00350 if( (*it).second.find(TypeID::P2) != (*it).second.end() )
00351 {
00352 (*it).second[TypeID::P2] = (*it).second[TypeID::P2] + corrL2;
00353 };
00354
00355
00356 if( (*it).second.find(TypeID::L2) != (*it).second.end() )
00357 {
00358 (*it).second[TypeID::L2] = (*it).second[TypeID::L2] + corrL2;
00359 };
00360
00361
00362 if( (*it).second.find(TypeID::C5) != (*it).second.end() )
00363 {
00364 (*it).second[TypeID::C5] = (*it).second[TypeID::C5] + corrL5;
00365 };
00366
00367
00368 if( (*it).second.find(TypeID::L5) != (*it).second.end() )
00369 {
00370 (*it).second[TypeID::L5] = (*it).second[TypeID::L5] + corrL5;
00371 };
00372
00373
00374 if( (*it).second.find(TypeID::C6) != (*it).second.end() )
00375 {
00376 (*it).second[TypeID::C6] = (*it).second[TypeID::C6] + corrL6;
00377 };
00378
00379
00380 if( (*it).second.find(TypeID::L6) != (*it).second.end() )
00381 {
00382 (*it).second[TypeID::L6] = (*it).second[TypeID::L6] + corrL6;
00383 };
00384
00385
00386 if( (*it).second.find(TypeID::C7) != (*it).second.end() )
00387 {
00388 (*it).second[TypeID::C7] = (*it).second[TypeID::C7] + corrL7;
00389 };
00390
00391
00392 if( (*it).second.find(TypeID::L7) != (*it).second.end() )
00393 {
00394 (*it).second[TypeID::L7] = (*it).second[TypeID::L7] + corrL7;
00395 };
00396
00397
00398 if( (*it).second.find(TypeID::C8) != (*it).second.end() )
00399 {
00400 (*it).second[TypeID::C8] = (*it).second[TypeID::C8] + corrL8;
00401 };
00402
00403
00404 if( (*it).second.find(TypeID::L8) != (*it).second.end() )
00405 {
00406 (*it).second[TypeID::L8] = (*it).second[TypeID::L8] + corrL8;
00407 };
00408
00409 }
00410
00411
00412 gData.removeSatID(satRejectedSet);
00413
00414 return gData;
00415
00416 }
00417 catch(Exception& u)
00418 {
00419
00420 ProcessingException e( getClassName() + ":"
00421 + StringUtils::asString( getIndex() ) + ":"
00422 + u.what() );
00423
00424 GPSTK_THROW(e);
00425
00426 }
00427
00428 }
00429
00430
00431 }