00001 #pragma ident "$Id: ConvertC1ToP1.cpp 2552 2011-04-12 06:09:42Z 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 "ConvertC1ToP1.hpp"
00032
00033 namespace gpstk
00034 {
00035
00036 int ConvertC1ToP1::classIndex = 4800000;
00037
00038
00039 int ConvertC1ToP1::getIndex() const
00040 { return index; }
00041
00042
00043
00044 std::string ConvertC1ToP1::getClassName() const
00045 { return "ConvertC1ToP1"; }
00046
00047
00048
00049
00050 ConvertC1ToP1& ConvertC1ToP1::setDCBFile(const string& fileP1C1)
00051 {
00052 dcbP1C1.open(fileP1C1);
00053
00054 return (*this);
00055 }
00056
00057
00058
00059
00060
00061
00062
00063 satTypeValueMap& ConvertC1ToP1::Process( const DayTime& time,
00064 satTypeValueMap& gData )
00065 throw(ProcessingException)
00066 {
00067
00068 try
00069 {
00070 static const double minLimit(15000000.0);
00071 static const double maxLimit(30000000.0);
00072
00073 SatIDSet satRejectedSet;
00074
00075
00076 satTypeValueMap::iterator it;
00077 for (it = gData.begin(); it != gData.end(); ++it)
00078 {
00079 SatID sat = it->first;
00080
00081 typeValueMap::iterator ittC1 = it->second.find(TypeID::C1);
00082 typeValueMap::iterator ittP1 = it->second.find(TypeID::P1);
00083
00084 bool hasC1( ittC1 != it->second.end() );
00085 bool hasP1( ittP1 != it->second.end() );
00086
00087
00088 if(hasC1)
00089 {
00090 if( it->second[TypeID::C1]<minLimit ||
00091 it->second[TypeID::C1]>maxLimit ) { hasC1 = false;}
00092 }
00093 if(hasP1)
00094 {
00095 if( it->second[TypeID::P1]<minLimit ||
00096 it->second[TypeID::P1]>maxLimit ) { hasP1 = false;}
00097 }
00098
00099
00100 if( !hasC1 && !hasP1)
00101 {
00102 satRejectedSet.insert(it->first);
00103 }
00104
00105 if( hasC1 && !hasP1 )
00106 {
00107 double Bp1c1(0.0);
00108 try
00109 {
00110 Bp1c1 = dcbP1C1.getDCB(sat);
00111 }
00112 catch(...)
00113 {
00114 Bp1c1 = 0.0;
00115 }
00116
00117 it->second[TypeID::P1] = it->second[TypeID::C1]
00118 +Bp1c1*(C_GPS_M * 1.0e-9);
00119 }
00120
00121 }
00122
00123 gData.removeSatID(satRejectedSet);
00124
00125 return gData;
00126
00127 }
00128 catch(Exception& u)
00129 {
00130
00131
00132 ProcessingException e( getClassName() + ":"
00133 + StringUtils::asString( getIndex() ) + ":"
00134 + u.what() );
00135
00136 GPSTK_THROW(e);
00137
00138 }
00139
00140 }
00141
00142
00143 }
00144
00145
00146