Changeset 1044 in ntrip
- Timestamp:
- Aug 19, 2008, 11:36:54 AM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM/GPSDecoder.h
r1035 r1044 34 34 class t_obsInternal { 35 35 public: 36 37 t_obsInternal() : 38 flags(0), 39 satSys(' '), 40 satNum(0), 41 slot(0), 42 GPSWeek(0), 43 GPSWeeks(0.0), 44 C1(0.0), 45 C2(0.0), 46 P1(0.0), 47 P2(0.0), 48 L1(0.0), 49 L2(0.0), 50 slip_cnt_L1(-1), 51 slip_cnt_L2(-1), 52 lock_timei_L1(-1), 53 lock_timei_L2(-1), 54 S1(0.0), 55 S2(0.0), 56 SNR1(0), 57 SNR2(0) { 58 StatID[0] = '\x0'; 59 } 36 60 int flags; 37 char StatID[20+1];// Station ID 38 char satSys; // Satellite System ('G' or 'R') 39 int satNum; // Satellite Number (PRN for GPS NAVSTAR) 40 int slot; // Slot Number (for Glonass) 41 int GPSWeek; // Week of GPS-Time 42 double GPSWeeks; // Second of Week (GPS-Time) 43 double C1; // CA-code pseudorange (meters) 44 double C2; // CA-code pseudorange (meters) 45 double P1; // P1-code pseudorange (meters) 46 double P2; // P2-code pseudorange (meters) 47 double L1; // L1 carrier phase (cycles) 48 double L2; // L2 carrier phase (cycles) 49 double S1; // L1 signal-to noise ratio 50 double S2; // L2 signal-to noise ratio 51 int SNR1; // L1 signal-to noise ratio (mapped to integer) 52 int SNR2; // L2 signal-to noise ratio (mapped to integer) 61 char StatID[20+1]; // Station ID 62 char satSys; // Satellite System ('G' or 'R') 63 int satNum; // Satellite Number (PRN for GPS NAVSTAR) 64 int slot; // Slot Number (for Glonass) 65 int GPSWeek; // Week of GPS-Time 66 double GPSWeeks; // Second of Week (GPS-Time) 67 double C1; // CA-code pseudorange (meters) 68 double C2; // CA-code pseudorange (meters) 69 double P1; // P1-code pseudorange (meters) 70 double P2; // P2-code pseudorange (meters) 71 double L1; // L1 carrier phase (cycles) 72 double L2; // L2 carrier phase (cycles) 73 int slip_cnt_L1; // L1 cumulative loss of continuity indicator (negative value = undefined) 74 int slip_cnt_L2; // L2 cumulative loss of continuity indicator (negative value = undefined) 75 int lock_timei_L1; // L1 last lock time indicator (negative value = undefined) 76 int lock_timei_L2; // L2 last lock time indicator (negative value = undefined) 77 double S1; // L1 signal-to noise ratio 78 double S2; // L2 signal-to noise ratio 79 int SNR1; // L1 signal-to noise ratio (mapped to integer) 80 int SNR2; // L2 signal-to noise ratio (mapped to integer) 53 81 }; 54 82 … … 60 88 _status = initial; 61 89 62 _o.flags = 0; 63 _o.StatID[0] = '\0'; 64 _o.satSys = 'G'; 65 _o.satNum = 0; 66 _o.slot = 0; 67 _o.GPSWeek = 0; 68 _o.GPSWeeks = 0.0; 69 _o.C1 = 0.0; 70 _o.C2 = 0.0; 71 _o.P1 = 0.0; 72 _o.P2 = 0.0; 73 _o.L1 = 0.0; 74 _o.L2 = 0.0; 75 _o.S1 = 0.0; 76 _o.S2 = 0.0; 77 _o.SNR1 = 0; 78 _o.SNR2 = 0; 90 _o.flags = 0; 91 _o.StatID[0] = '\0'; 92 _o.satSys = 'G'; 93 _o.satNum = 0; 94 _o.slot = 0; 95 _o.GPSWeek = 0; 96 _o.GPSWeeks = 0.0; 97 _o.C1 = 0.0; 98 _o.C2 = 0.0; 99 _o.P1 = 0.0; 100 _o.P2 = 0.0; 101 _o.L1 = 0.0; 102 _o.L2 = 0.0; 103 _o.S1 = 0.0; 104 _o.S2 = 0.0; 105 _o.slip_cnt_L1 = -1; 106 _o.slip_cnt_L2 = -1; 107 _o.lock_timei_L1 = -1; 108 _o.lock_timei_L2 = -1; 109 _o.SNR1 = 0; 110 _o.SNR2 = 0; 79 111 } 80 112 -
trunk/BNC/RTCM/RTCM2.cpp
r1029 r1044 945 945 cph_L1.resize(0); // Carrier phase [m] 946 946 cph_L2.resize(0); // Carrier phase [m] 947 slip_L1.resize(0); // Slip counter 948 slip_L2.resize(0); // Slip counter 947 949 948 950 availability.reset(); // Message status flags … … 1005 1007 bool isGPS,isCAcode,isL1,isOth; 1006 1008 int NSat,idx; 1007 int sid,prn ;1009 int sid,prn,slip_cnt; 1008 1010 double t,rng,cph; 1009 1011 … … 1114 1116 1115 1117 prn = (isGPS? sid : sid+200 ); 1116 1118 1117 1119 // Carrier phase measurement (mod 2^23 [cy]; sign matched to range) 1118 1120 cph = -P.getBits(iSat*48+40,32)/256.0; 1121 1122 // Slip counter 1123 slip_cnt = P.getUnsignedBits(iSat*48+35,5); 1119 1124 1120 1125 // Is this a new PRN? … … 1132 1137 cph_L1.push_back(0.0); 1133 1138 cph_L2.push_back(0.0); 1139 slip_L1.push_back(-1); 1140 slip_L2.push_back(-1); 1134 1141 }; 1135 1142 1136 1143 // Store measurement 1137 1144 if (isL1) { 1138 cph_L1[idx] = cph; 1145 cph_L1 [idx] = cph; 1146 slip_L1[idx] = slip_cnt; 1139 1147 } 1140 1148 else { 1141 cph_L2[idx] = cph; 1149 cph_L2 [idx] = cph; 1150 slip_L2[idx] = slip_cnt; 1142 1151 }; 1143 1152 … … 1251 1260 cph_L1.push_back(0.0); 1252 1261 cph_L2.push_back(0.0); 1262 slip_L1.push_back(-1); 1263 slip_L2.push_back(-1); 1253 1264 }; 1254 1265 … … 1339 1350 1340 1351 }; // End of namespace rtcm2 1352 1353 1354 -
trunk/BNC/RTCM/RTCM2.h
r1029 r1044 201 201 202 202 class RTCM2_03 { 203 204 public: 205 206 void extract(const RTCM2packet& P); 207 208 public: 209 210 bool validMsg; // Validity flag 211 double x,y,z; // Station coordinates 212 203 public: 204 205 RTCM2_03() : validMsg(false), x(0.0), y(0.0), z(0.0) { } 206 207 void extract(const RTCM2packet& P); 208 209 public: 210 bool validMsg; // Validity flag 211 double x,y,z; // Station coordinates 213 212 }; 214 213 … … 309 308 std::vector<double> cph_L1; // Carrier phase on L1 [cy] 310 309 std::vector<double> cph_L2; // Carrier phase on L2 [cy] 310 std::vector<int> slip_L1; // Carrier phase slip counter, L1 311 std::vector<int> slip_L2; // Carrier phase slip counter, L1 311 312 312 313 private: -
trunk/BNC/RTCM/RTCM2Decoder.cpp
r1029 r1044 39 39 * -----------------------------------------------------------------------*/ 40 40 41 #include <math.h> 42 #include <sstream> 43 #include <iomanip> 44 41 45 #include "../bncutils.h" 46 #include "rtcm_utils.h" 42 47 #include "GPSDecoder.h" 43 48 #include "RTCM2Decoder.h" 44 49 45 50 using namespace std; 51 using namespace rtcm2; 46 52 47 53 // … … 49 55 // 50 56 51 RTCM2Decoder::RTCM2Decoder( ) {52 57 RTCM2Decoder::RTCM2Decoder(const std::string& ID) { 58 _ID = ID; 53 59 } 54 60 … … 58 64 59 65 RTCM2Decoder::~RTCM2Decoder() { 60 } 61 62 // 63 66 for (t_pairMap::iterator ii = _ephPair.begin(); ii != _ephPair.end(); ii++) { 67 delete ii->second; 68 } 69 } 70 71 72 // 73 t_irc RTCM2Decoder::getStaCrd(double& xx, double& yy, double& zz) { 74 if ( !_msg03.validMsg ) { 75 return failure; 76 } 77 78 xx = _msg03.x + (_msg22.validMsg ? _msg22.dL1[0] : 0.0); 79 yy = _msg03.y + (_msg22.validMsg ? _msg22.dL1[1] : 0.0); 80 zz = _msg03.z + (_msg22.validMsg ? _msg22.dL1[2] : 0.0); 81 82 return success; 83 } 84 85 86 // 64 87 t_irc RTCM2Decoder::Decode(char* buffer, int bufLen) { 65 88 … … 95 118 _obsList.push_back(obs); 96 119 if (_ObsBlock.PRN[iSat] > 100) { 97 obs->_o.satNum = _ObsBlock.PRN[iSat] % 100; 98 obs->_o.satSys = 'R'; 99 } 100 else { 101 obs->_o.satNum = _ObsBlock.PRN[iSat]; 102 obs->_o.satSys = 'G'; 103 } 104 obs->_o.GPSWeek = epochWeek; 105 obs->_o.GPSWeeks = epochSecs; 106 obs->_o.C1 = _ObsBlock.rng_C1[iSat]; 107 obs->_o.P1 = _ObsBlock.rng_P1[iSat]; 108 obs->_o.P2 = _ObsBlock.rng_P2[iSat]; 109 obs->_o.L1 = _ObsBlock.resolvedPhase_L1(iSat); 110 obs->_o.L2 = _ObsBlock.resolvedPhase_L2(iSat); 120 obs->_o.satNum = _ObsBlock.PRN[iSat] % 100; 121 obs->_o.satSys = 'R'; 122 } 123 else { 124 obs->_o.satNum = _ObsBlock.PRN[iSat]; 125 obs->_o.satSys = 'G'; 126 } 127 obs->_o.GPSWeek = epochWeek; 128 obs->_o.GPSWeeks = epochSecs; 129 obs->_o.C1 = _ObsBlock.rng_C1[iSat]; 130 obs->_o.P1 = _ObsBlock.rng_P1[iSat]; 131 obs->_o.P2 = _ObsBlock.rng_P2[iSat]; 132 obs->_o.L1 = _ObsBlock.resolvedPhase_L1(iSat); 133 obs->_o.L2 = _ObsBlock.resolvedPhase_L2(iSat); 134 obs->_o.slip_cnt_L1 = _ObsBlock.slip_L1[iSat]; 135 obs->_o.slip_cnt_L2 = _ObsBlock.slip_L2[iSat]; 136 obs->_o.lock_timei_L1 = -1; 137 obs->_o.lock_timei_L2 = -1; 111 138 } 112 139 _ObsBlock.clear(); 113 140 } 114 141 } 142 143 else if ( _PP.ID() == 20 || _PP.ID() == 21 ) { 144 _msg2021.extract(_PP); 145 146 if (_msg2021.valid()) { 147 translateCorr2Obs(); 148 } 149 } 150 151 else if ( _PP.ID() == 3 ) { 152 _msg03.extract(_PP); 153 } 154 155 else if ( _PP.ID() == 22 ) { 156 _msg22.extract(_PP); 157 } 115 158 } 116 159 return success; 117 160 } 118 161 162 163 164 void RTCM2Decoder::storeEph(const gpsephemeris& gpseph) { 165 t_ephGPS eph; eph.set(&gpseph); 166 167 storeEph(eph); 168 } 169 170 171 void RTCM2Decoder::storeEph(const t_ephGPS& gpseph) { 172 t_ephGPS* eph = new t_ephGPS(gpseph); 173 174 string prn = eph->prn(); 175 176 t_pairMap::iterator ip = _ephPair.find(prn); 177 if (ip == _ephPair.end() ) { 178 ip = _ephPair.insert(pair<string, t_ephPair*>(prn, new t_ephPair)).first; 179 } 180 t_ephPair* pair = ip->second; 181 182 if ( !pair->eph || eph->isNewerThan(pair->eph) ) { 183 delete pair->oldEph; 184 pair->oldEph = pair->eph; 185 pair->eph = eph; 186 187 return; 188 } 189 190 delete eph; 191 } 192 193 194 void RTCM2Decoder::translateCorr2Obs() { 195 196 if ( !_msg03.validMsg || !_msg2021.valid() ) { 197 return; 198 } 199 200 double stax = _msg03.x + (_msg22.validMsg ? _msg22.dL1[0] : 0.0); 201 double stay = _msg03.y + (_msg22.validMsg ? _msg22.dL1[1] : 0.0); 202 double staz = _msg03.z + (_msg22.validMsg ? _msg22.dL1[2] : 0.0); 203 204 int refWeek; 205 double refSecs; 206 currentGPSWeeks(refWeek, refSecs); 207 208 // Resolve receiver time of measurement (see RTCM 2.3, page 4-42, Message 18, Note 1) 209 // ---------------------------------------------------------------------------------- 210 double hoursec_est = _msg2021.hoursec(); // estimated time of measurement 211 double hoursec_rcv = rint(hoursec_est * 1e2) / 1e2; // receiver clock reading at hoursec_est 212 double rcv_clk_bias = (hoursec_est - hoursec_rcv) * c_light; 213 214 int GPSWeek; 215 double GPSWeeks; 216 resolveEpoch(hoursec_est, refWeek, refSecs, 217 GPSWeek, GPSWeeks); 218 219 int GPSWeek_rcv; 220 double GPSWeeks_rcv; 221 resolveEpoch(hoursec_rcv, refWeek, refSecs, 222 GPSWeek_rcv, GPSWeeks_rcv); 223 224 // Loop over all satellites 225 // ------------------------ 226 for (RTCM2_2021::data_iterator icorr = _msg2021.data.begin(); 227 icorr != _msg2021.data.end(); icorr++) { 228 const RTCM2_2021::HiResCorr* corr = icorr->second; 229 230 ostringstream oPRN; oPRN.fill('0'); 231 232 oPRN << (corr->PRN < 200 ? 'G' : 'R') 233 << setw(2) << (corr->PRN < 200 ? corr->PRN : corr->PRN - 200); 234 235 string PRN(oPRN.str()); 236 237 t_pairMap::const_iterator ieph = _ephPair.find(PRN); 238 const t_eph* eph0 = 0; 239 const t_eph* eph1 = 0; 240 241 if ( ieph != _ephPair.end() ) { 242 eph0 = ieph->second->eph; 243 eph1 = ieph->second->oldEph; 244 } 245 246 if ( !eph0 && !eph1 ) { 247 continue; 248 } 249 250 double L1 = 0; 251 double L2 = 0; 252 double P1 = 0; 253 double P2 = 0; 254 string obsT = ""; 255 256 // new observation 257 p_obs new_obs = 0; 258 259 for (unsigned ii = 0; ii < 4; ii++) { 260 int IODcorr = 0; 261 double corrVal = 0; 262 const t_eph* eph = 0; 263 double* obsVal = 0; 264 265 switch (ii) { 266 case 0: // --- L1 --- 267 IODcorr = corr->IODp1; 268 corrVal = corr->phase1 * LAMBDA_1; 269 obsVal = &L1; 270 obsT = "L1"; 271 break; 272 case 1: // --- L2 --- 273 IODcorr = corr->IODp2; 274 corrVal = corr->phase2 * LAMBDA_2; 275 obsVal = &L2; 276 obsT = "L2"; 277 break; 278 case 2: // --- P1 --- 279 IODcorr = corr->IODr1; 280 corrVal = corr->range1; 281 obsVal = &P1; 282 obsT = "P1"; 283 break; 284 case 3: // --- P2 --- 285 IODcorr = corr->IODr2; 286 corrVal = corr->range2; 287 obsVal = &P2; 288 obsT = "P2"; 289 break; 290 default: 291 continue; 292 } 293 294 eph = 0; 295 if ( eph0 && eph0->IOD() == IODcorr ) 296 eph = eph0; 297 else if ( eph1 && eph1->IOD() == IODcorr ) 298 eph = eph1; 299 if ( eph && corr ) { 300 int GPSWeek_tot; 301 double GPSWeeks_tot; 302 double rho, xSat, ySat, zSat, clkSat; 303 cmpRho(eph, stax, stay, staz, 304 GPSWeek, GPSWeeks, 305 rho, GPSWeek_tot, GPSWeeks_tot, 306 xSat, ySat, zSat, clkSat); 307 308 *obsVal = rho - corrVal + rcv_clk_bias - clkSat; 309 310 if ( *obsVal == 0 ) *obsVal = ZEROVALUE; 311 312 // Allocate new memory 313 // ------------------- 314 if ( !new_obs ) { 315 new_obs = new t_obs(); 316 317 new_obs->_o.StatID[0] = '\x0'; 318 new_obs->_o.satSys = (corr->PRN < 200 ? 'G' : 'R'); 319 new_obs->_o.satNum = (corr->PRN < 200 ? corr->PRN : corr->PRN - 200); 320 321 new_obs->_o.GPSWeek = GPSWeek_rcv; 322 new_obs->_o.GPSWeeks = GPSWeeks_rcv; 323 } 324 325 // Store estimated measurements 326 // ---------------------------- 327 switch (ii) { 328 case 0: // --- L1 --- 329 new_obs->_o.L1 = *obsVal / LAMBDA_1; 330 new_obs->_o.slip_cnt_L1 = corr->lock1; 331 new_obs->_o.lock_timei_L1 = -1; 332 break; 333 case 1: // --- L2 --- 334 new_obs->_o.L2 = *obsVal / LAMBDA_2; 335 new_obs->_o.slip_cnt_L2 = corr->lock2; 336 new_obs->_o.lock_timei_L2 = -1; 337 break; 338 case 2: // --- C1 / P1 --- 339 if ( corr->Pind1 ) 340 new_obs->_o.P1 = *obsVal; 341 else 342 new_obs->_o.C1 = *obsVal; 343 break; 344 case 3: // --- C2 / P2 --- 345 if ( corr->Pind2 ) 346 new_obs->_o.P2 = *obsVal; 347 else 348 new_obs->_o.C2 = *obsVal; 349 break; 350 default: 351 continue; 352 } 353 } 354 } // loop over frequencies 355 356 if ( new_obs ) { 357 _obsList.push_back( new_obs ); 358 } 359 } 360 } -
trunk/BNC/RTCM/RTCM2Decoder.h
r1029 r1044 26 26 #define INC_RTCM2DECODER_H 27 27 28 #include <map> 29 28 30 #include "GPSDecoder.h" 29 31 #include "RTCM2.h" 32 #include "RTCM2_2021.h" 33 #include "../RTCM3/rtcm3torinex.h" 34 #include "../RTCM3/ephemeris.h" 30 35 31 36 class RTCM2Decoder: public GPSDecoder { 32 37 33 38 public: 34 RTCM2Decoder( );39 RTCM2Decoder(const std::string& ID); 35 40 virtual ~RTCM2Decoder(); 36 41 virtual t_irc Decode(char* buffer, int bufLen); 37 42 43 void storeEph(const gpsephemeris& gpseph); 44 void storeEph(const t_ephGPS& gpseph); 45 46 t_irc getStaCrd(double& xx, double& yy, double& zz); 47 48 const rtcm2::RTCM2_2021& msg2021() const { return _msg2021; } 49 50 std::string ID() const { return _ID; } 51 38 52 private: 39 53 40 std::string _buffer; 41 rtcm2::RTCM2_Obs _ObsBlock; 42 rtcm2::RTCM2packet _PP; 54 class t_ephPair { 55 public: 56 t_ephPair() { 57 eph = 0; 58 oldEph = 0; 59 } 60 61 ~t_ephPair() { 62 delete eph; 63 delete oldEph; 64 } 65 66 t_eph* eph; 67 t_eph* oldEph; 68 }; 43 69 70 void translateCorr2Obs(); 71 72 std::string _ID; 73 74 std::string _buffer; 75 rtcm2::RTCM2packet _PP; 76 77 // for messages 18, 19 decoding 78 rtcm2::RTCM2_Obs _ObsBlock; 79 80 // for messages 20, 21 decoding 81 rtcm2::RTCM2_03 _msg03; 82 rtcm2::RTCM2_22 _msg22; 83 rtcm2::RTCM2_2021 _msg2021; 84 std::map<std::string, t_ephPair*> _ephPair; 85 86 typedef std::map<std::string, t_ephPair*> t_pairMap; 44 87 }; 45 88 -
trunk/BNC/RTCM/rtcm_utils.cpp
r1027 r1044 38 38 eph->position(GPSWeek, GPSWeeks, xSat, ySat, zSat, clkSat); 39 39 40 cout << "----- cmpRho -----\n";41 eph->print(cout);42 cout << " pos " << setw(4) << GPSWeek43 << " " << setw(14) << setprecision(6) << GPSWeeks44 << " " << setw(13) << setprecision(3) << xSat45 << " " << setw(13) << setprecision(3) << ySat46 << " " << setw(13) << setprecision(3) << zSat47 << endl;40 ////cout << "----- cmpRho -----\n"; 41 ////eph->print(cout); 42 ////cout << " pos " << setw(4) << GPSWeek 43 //// << " " << setw(14) << setprecision(6) << GPSWeeks 44 //// << " " << setw(13) << setprecision(3) << xSat 45 //// << " " << setw(13) << setprecision(3) << ySat 46 //// << " " << setw(13) << setprecision(3) << zSat 47 //// << endl; 48 48 49 49 // Loop until the correct Time Of Transmission is found … … 85 85 rho = sqrt(dx*dx + dy*dy + dz*dz); 86 86 87 cout << " scrd " << setw(4) << GPSWeek_tot88 << " " << setw(15) << setprecision(8) << GPSWeeks_tot89 << " " << setw(13) << setprecision(3) << xSat90 << " " << setw(13) << setprecision(3) << ySat91 << " " << setw(13) << setprecision(3) << zSat92 << " rcv0 " << setw(12) << setprecision(3) << stax93 << " " << setw(12) << setprecision(3) << stay94 << " " << setw(12) << setprecision(3) << staz95 << " rcv " << setw(12) << setprecision(3) << xRec96 << " " << setw(12) << setprecision(3) << yRec97 << " " << setw(12) << setprecision(3) << zRec98 << " dPhi " << scientific << setw(13) << setprecision(10) << dPhi << fixed99 << " rho " << setw(13) << setprecision(3) << rho100 << endl;87 ////cout << " scrd " << setw(4) << GPSWeek_tot 88 //// << " " << setw(15) << setprecision(8) << GPSWeeks_tot 89 //// << " " << setw(13) << setprecision(3) << xSat 90 //// << " " << setw(13) << setprecision(3) << ySat 91 //// << " " << setw(13) << setprecision(3) << zSat 92 //// << " rcv0 " << setw(12) << setprecision(3) << stax 93 //// << " " << setw(12) << setprecision(3) << stay 94 //// << " " << setw(12) << setprecision(3) << staz 95 //// << " rcv " << setw(12) << setprecision(3) << xRec 96 //// << " " << setw(12) << setprecision(3) << yRec 97 //// << " " << setw(12) << setprecision(3) << zRec 98 //// << " dPhi " << scientific << setw(13) << setprecision(10) << dPhi << fixed 99 //// << " rho " << setw(13) << setprecision(3) << rho 100 //// << endl; 101 101 102 102 … … 112 112 clkSat *= c_light; // satellite clock correction in meters 113 113 114 cout << "***** cmpRho *****\n";115 116 114 return 0; 117 115 } -
trunk/BNC/RTCM3/RTCM3Decoder.cpp
r1035 r1044 224 224 else 225 225 { 226 int isat = (_Parser.Data.satellites[ii] < 120 227 ? _Parser.Data.satellites[ii] 228 : _Parser.Data.satellites[ii] - 80); 229 226 230 // variables df and pos are used consequently. Perlt 227 231 if (df & GNSSDF_C1DATA) { … … 238 242 } 239 243 else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) { 240 obs->_o.L1 = _Parser.Data.measdata[ii][pos]; 241 obs->_o.SNR1 = _Parser.Data.snrL1[ii]; 244 obs->_o.L1 = _Parser.Data.measdata[ii][pos]; 245 obs->_o.SNR1 = _Parser.Data.snrL1[ii]; 246 obs->_o.lock_timei_L1 = _Parser.lastlockl1[isat]; 242 247 } 243 248 else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) { 244 obs->_o.L2 = _Parser.Data.measdata[ii][pos]; 245 obs->_o.SNR2 = _Parser.Data.snrL2[ii]; 249 obs->_o.L2 = _Parser.Data.measdata[ii][pos]; 250 obs->_o.SNR2 = _Parser.Data.snrL2[ii]; 251 obs->_o.lock_timei_L2 = _Parser.lastlockl2[isat]; 246 252 } 247 253 else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) { -
trunk/BNC/bnc.pro
r1029 r1044 3 3 # ----------------------------- 4 4 CONFIG += release 5 ###CONFIG -= debug5 ###CONFIG += debug 6 6 7 7 DEFINES += NO_RTCM3_MAIN … … 27 27 bncconst.h bnchtml.h bnctableitem.h bnczerodecoder.h \ 28 28 RTCM/GPSDecoder.h RTCM/RTCM2.h RTCM/RTCM2Decoder.h \ 29 RTCM/RTCM2_2021.h RTCM/rtcm_utils.h \ 29 30 RTCM3/RTCM3Decoder.h RTCM3/rtcm3torinex.h \ 30 31 RTCM3/RTCM3coDecoder.h RTCM3/clock_orbit_rtcm.h \ 32 RTCM3/ephemeris.h RTCM3/timeutils.h \ 31 33 RTIGS/RTIGSDecoder.h RTIGS/rtigs_records.h \ 32 34 RTIGS/cgps_transform.h RTIGS/rtstruct.h RTIGS/rtacp.h RTIGS/gpswro.h … … 37 39 bnczerodecoder.cpp \ 38 40 RTCM/RTCM2.cpp RTCM/RTCM2Decoder.cpp \ 41 RTCM/RTCM2_2021.cpp RTCM/rtcm_utils.cpp \ 39 42 RTCM3/RTCM3Decoder.cpp RTCM3/rtcm3torinex.c \ 40 43 RTCM3/RTCM3coDecoder.cpp RTCM3/clock_orbit_rtcm.c \ 44 RTCM3/ephemeris.cpp RTCM3/timeutils.cpp \ 41 45 RTIGS/RTIGSDecoder.cpp RTIGS/cgps_transform.cpp 42 46 -
trunk/BNC/bncapp.cpp
r1035 r1044 192 192 QMutexLocker locker(&_mutex); 193 193 194 gpsephemeris copy_gpseph = *gpseph; 195 emit newEphGPS(copy_gpseph); 196 194 197 printEphHeader(); 195 198 -
trunk/BNC/bncapp.h
r1029 r1044 49 49 void slotQuit(); 50 50 51 signals: 52 void newMessage(QByteArray msg); 51 signals: 52 void newMessage(QByteArray msg); 53 void newEphGPS(gpsephemeris gpseph); 53 54 54 55 private slots: -
trunk/BNC/bncgetthread.cpp
r1035 r1044 40 40 41 41 #include <stdlib.h> 42 #include <iomanip> 42 43 43 44 #include <QFile> … … 144 145 _rnx = new bncRinex(_staID, mountPoint, format, latitude, longitude, nmea); 145 146 } 147 _rnx_set_position = false; 146 148 147 149 msleep(100); //sleep 0.1 sec … … 160 162 } 161 163 delete _decoder; 162 delete _rnx; 164 delete _rnx; 163 165 } 164 166 … … 369 371 if (_format.indexOf("RTCM_2") != -1) { 370 372 emit(newMessage("Get Data: " + _staID + " in RTCM 2.x format")); 371 _decoder = new RTCM2Decoder( );373 _decoder = new RTCM2Decoder(_staID.data()); 372 374 } 373 375 else if (_format.indexOf("RTCM_3") != -1) { … … 560 562 561 563 delete [] data; 562 564 563 565 QListIterator<p_obs> it(_decoder->_obsList); 564 566 while (it.hasNext()) { … … 648 650 // ------------ 649 651 if (_rnx) { 650 long iSec = long(floor(obs->_o.GPSWeeks+0.5)); 651 long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec; 652 if (_samplingRate == 0 || iSec % _samplingRate == 0) { 653 _rnx->deepCopy(obs); 652 bool dump = true; 653 654 ////RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(_decoder); 655 ////if ( decoder2 && !_rnx_set_position ) { 656 //// double stax, stay, staz; 657 //// if ( decoder2->getStaCrd(stax, stay, staz) == success ) { 658 //// _rnx->setApproxPos(stax, stay, staz); 659 //// _rnx_set_position = true; 660 //// } 661 //// else { 662 //// dump = false; 663 //// } 664 ////} 665 666 if ( dump ) { 667 long iSec = long(floor(obs->_o.GPSWeeks+0.5)); 668 long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec; 669 if (_samplingRate == 0 || iSec % _samplingRate == 0) { 670 _rnx->deepCopy(obs); 671 } 672 _rnx->dumpEpoch(newTime); 654 673 } 655 _rnx->dumpEpoch(newTime); 656 } 657 674 } 675 676 // Emit new observation signal 677 // --------------------------- 658 678 bool firstObs = (obs == _decoder->_obsList.first()); 659 679 obs->_status = t_obs::posted; … … 757 777 } 758 778 } 779 780 // 781 ////////////////////////////////////////////////////////////////////////////// 782 void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) { 783 RTCM2Decoder* decoder = dynamic_cast<RTCM2Decoder*>(_decoder); 784 785 if ( decoder ) { 786 QMutexLocker locker(&_mutex); 787 788 decoder->storeEph(gpseph); 789 } 790 } 791 -
trunk/BNC/bncgetthread.h
r1030 r1044 31 31 32 32 #include "RTCM/GPSDecoder.h" 33 #include "RTCM3/rtcm3torinex.h" 33 34 #include "bncconst.h" 34 35 … … 56 57 void error(QByteArray staID); 57 58 void newMessage(QByteArray msg); 59 60 public slots: 61 void slotNewEphGPS(gpsephemeris gpseph); 58 62 59 63 protected: … … 96 100 int _samplingRate; 97 101 bncRinex* _rnx; 102 bool _rnx_set_position; 98 103 QDateTime _decodeFailure; 99 104 QDateTime _decodeStart; -
trunk/BNC/bncrinex.cpp
r1029 r1044 93 93 _rinexVers = 2; 94 94 } 95 96 _approxPos[0] = _approxPos[1] = _approxPos[2] = 0.0; 95 97 } 96 98 … … 447 449 // ------------------ 448 450 else { 449 double approxPos[3]; approxPos[0] = approxPos[1] = approxPos[2] = 0.0;450 451 double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0; 451 452 … … 477 478 << setw(20) << " " << "ANT # / TYPE" << endl; 478 479 _out.unsetf(ios::left); 479 _out << setw(14) << setprecision(4) << approxPos[0]480 << setw(14) << setprecision(4) << approxPos[1]481 << setw(14) << setprecision(4) << approxPos[2]480 _out << setw(14) << setprecision(4) << _approxPos[0] 481 << setw(14) << setprecision(4) << _approxPos[1] 482 << setw(14) << setprecision(4) << _approxPos[2] 482 483 << " " << "APPROX POSITION XYZ" << endl; 483 484 _out << setw(14) << setprecision(4) << antennaNEU[0] … … 565 566 double sec = double(datTim.time().second()) + fmod(fObs->_o.GPSWeeks,1.0); 566 567 567 // RINEX Version 3568 // --------------- 568 // Epoch header line: RINEX Version 3 569 // ---------------------------------- 569 570 if (_rinexVers == 3) { 570 char sbasflag = 'S';571 571 _out << datTim.toString("> yyyy MM dd hh mm ").toAscii().data() 572 572 << setw(10) << setprecision(7) << sec 573 573 << " " << 0 << setw(3) << dumpList.size() << endl; 574 575 QListIterator<p_obs> it(dumpList); 576 while (it.hasNext()) { 577 p_obs obs = it.next(); 578 // Changed data output, C1P, C2C|X, L2C|X, S2C|X added. Changed Output for SBAS Perlt 579 if (sbasflag != obs->_o.satSys) { 580 _out << obs->_o.satSys 581 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ') 582 << setw(14) << setprecision(3) << obs->_o.C1 << " " 583 << setw(14) << setprecision(3) << obs->_o.P1 << " " 584 << setw(14) << setprecision(3) << obs->_o.L1 << " " 585 << setw(1) << obs->_o.SNR1 586 << setw(14) << setprecision(3) << obs->_o.S1 << " " 587 << setw(14) << setprecision(3) << obs->_o.C2 << " " 588 << setw(14) << setprecision(3) << obs->_o.P2 << " " ; 589 if ((obs->_o.C2 != 0.0) && (obs->_o.P2 == 0.0)) { 590 _out << setw(14) << setprecision(3) << obs->_o.L2 << " " 591 << setw(1) << obs->_o.SNR2 592 << setw(14) << setprecision(3) << obs->_o.S2 << " " 593 << " 0.000 0.000 "; 594 } 595 else { 596 _out << " 0.000 0.000 " 597 << setw(14) << setprecision(3) << obs->_o.L2 << " " 598 << setw(1) << obs->_o.SNR2 599 << setw(14) << setprecision(3) << obs->_o.S2; 600 } 601 _out << endl; 602 } 603 else { 604 _out << obs->_o.satSys 605 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ') 606 << setw(14) << setprecision(3) << obs->_o.C1 << " " 607 << setw(14) << setprecision(3) << obs->_o.P1 << " " 608 << setw(14) << setprecision(3) << obs->_o.L1 << " " 609 << setw(1) << obs->_o.SNR1 610 << setw(14) << setprecision(3) << obs->_o.S1 << endl; 611 } 612 delete obs; 613 } 614 } 615 616 // RINEX Version 2 617 // --------------- 574 } 575 // Epoch header line: RINEX Version 2 576 // ---------------------------------- 618 577 else { 619 578 _out << datTim.toString(" yy MM dd hh mm ").toAscii().data() 620 579 << setw(10) << setprecision(7) << sec 621 580 << " " << 0 << setw(3) << dumpList.size(); 622 581 623 582 QListIterator<p_obs> it(dumpList); int iSat = 0; 624 583 while (it.hasNext()) { … … 632 591 } 633 592 _out << endl; 634 635 it.toFront(); 636 while (it.hasNext()) { 637 p_obs obs = it.next(); 638 593 } 594 595 QListIterator<p_obs> it(dumpList); 596 while (it.hasNext()) { 597 p_obs obs = it.next(); 598 599 // Cycle slips detection 600 // --------------------- 601 int prn = 0; 602 switch (obs->_o.satSys) { 603 case 'G': prn = obs->_o.satNum; break; 604 case 'R': prn = obs->_o.satNum + 200; break; 605 default: prn = obs->_o.satNum; 606 } 607 608 char lli1 = ' '; 609 char lli2 = ' '; 610 if ( obs->_o.slip_cnt_L1 >= 0 ) { 611 if ( _slip_cnt_L1.find(prn) != _slip_cnt_L1.end() && 612 _slip_cnt_L1.find(prn).value() != obs->_o.slip_cnt_L1 ) { 613 lli1 = '1'; 614 } 615 } 616 else if ( obs->_o.lock_timei_L1 >= 0 ) { 617 if ( _lock_timei_L1.find(prn) != _lock_timei_L1.end() && 618 _lock_timei_L1.find(prn).value() != obs->_o.lock_timei_L1 ) { 619 lli1 = '1'; 620 } 621 } 622 623 if ( obs->_o.slip_cnt_L2 >= 0 ) { 624 if ( _slip_cnt_L2.find(prn) != _slip_cnt_L2.end() && 625 _slip_cnt_L2.find(prn).value() != obs->_o.slip_cnt_L2 ) { 626 lli2 = '1'; 627 } 628 } 629 else if ( obs->_o.lock_timei_L2 >= 0 ) { 630 if ( _lock_timei_L2.find(prn) != _lock_timei_L2.end() && 631 _lock_timei_L2.find(prn).value() != obs->_o.lock_timei_L2 ) { 632 lli2 = '1'; 633 } 634 } 635 636 _slip_cnt_L1[prn] = obs->_o.slip_cnt_L1; 637 _slip_cnt_L2[prn] = obs->_o.slip_cnt_L2; 638 639 _lock_timei_L1[prn] = obs->_o.lock_timei_L1; 640 _lock_timei_L2[prn] = obs->_o.lock_timei_L2; 641 642 // RINEX Version 3 643 // --------------- 644 if (_rinexVers == 3) { 645 char sbasflag = 'S'; 646 // Changed data output, C1P, C2C|X, L2C|X, S2C|X added. Changed Output for SBAS Perlt 647 if (sbasflag != obs->_o.satSys) { 648 _out << obs->_o.satSys 649 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ') 650 << setw(14) << setprecision(3) << obs->_o.C1 << " " 651 << setw(14) << setprecision(3) << obs->_o.P1 << " " 652 << setw(14) << setprecision(3) << obs->_o.L1 << lli1 653 << setw(1) << obs->_o.SNR1 654 << setw(14) << setprecision(3) << obs->_o.S1 << " " 655 << setw(14) << setprecision(3) << obs->_o.C2 << " " 656 << setw(14) << setprecision(3) << obs->_o.P2 << " " ; 657 if ((obs->_o.C2 != 0.0) && (obs->_o.P2 == 0.0)) { 658 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli2 659 << setw(1) << obs->_o.SNR2 660 << setw(14) << setprecision(3) << obs->_o.S2 << " " 661 << " 0.000 0.000 "; 662 } 663 else { 664 _out << " 0.000 0.000 " 665 << setw(14) << setprecision(3) << obs->_o.L2 << " " 666 << setw(1) << obs->_o.SNR2 667 << setw(14) << setprecision(3) << obs->_o.S2; 668 } 669 _out << endl; 670 } 671 else { 672 _out << obs->_o.satSys 673 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ') 674 << setw(14) << setprecision(3) << obs->_o.C1 << " " 675 << setw(14) << setprecision(3) << obs->_o.P1 << " " 676 << setw(14) << setprecision(3) << obs->_o.L1 << lli1 677 << setw(1) << obs->_o.SNR1 678 << setw(14) << setprecision(3) << obs->_o.S1 << endl; 679 } 680 } 681 682 // RINEX Version 2 683 // --------------- 684 else { 639 685 char lli = ' '; 640 686 char snr = ' '; … … 643 689 _out << setw(14) << setprecision(3) << obs->_o.P1 << lli << snr; 644 690 _out << setw(14) << setprecision(3) << obs->_o.P2 << lli << snr; 645 _out << setw(14) << setprecision(3) << obs->_o.L1 << lli 691 _out << setw(14) << setprecision(3) << obs->_o.L1 << lli1 646 692 << setw(1) << obs->_o.SNR1 << endl; 647 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli 693 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli2 648 694 << setw(1) << obs->_o.SNR2; 649 695 _out << setw(14) << setprecision(3) << obs->_o.S1 ; 650 696 _out << setw(16) << setprecision(3) << obs->_o.S2 ; 651 697 _out << endl; 652 653 delete obs; 654 }698 } 699 700 delete obs; 655 701 } 656 702 -
trunk/BNC/bncrinex.h
r1029 r1044 49 49 QDateTime* nextEpoch = 0); 50 50 51 void setApproxPos(double stax, double stay, double staz) { 52 _approxPos[0] = stax; 53 _approxPos[1] = stay; 54 _approxPos[2] = staz; 55 } 56 51 57 protected: 52 58 virtual void run() {}; … … 81 87 bool _reloadTable; 82 88 bool _reloadDone; 89 double _approxPos[3]; 90 91 QMap<int, int> _slip_cnt_L1; 92 QMap<int, int> _slip_cnt_L2; 93 QMap<int, int> _lock_timei_L1; 94 QMap<int, int> _lock_timei_L2; 83 95 }; 84 96 -
trunk/BNC/bncwindow.cpp
r1042 r1044 705 705 SLOT(slotNewBytes(QByteArray, double))); 706 706 707 connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)), 708 getThread, SLOT(slotNewEphGPS(gpsephemeris))); 709 707 710 _caster->addGetThread(getThread); 708 711
Note:
See TracChangeset
for help on using the changeset viewer.