- Timestamp:
- Oct 7, 2006, 11:57:05 AM (18 years ago)
- Location:
- trunk/BNC
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM/GPSDecoder.h
r215 r222 1 // -*- C++ -*- 2 // 3 // $Id: GPSDecoder.h,v 1.2 2006/10/06 10:51:43 mervart Exp $ 4 // 2005/04/11: include 'int iPCode' into class 'GPSDecoder' (BKG) 5 #if !defined(__GPSDecoder_h__) 6 #define __GPSDecoder_h__ 1 2 #ifndef GPSDECODER_H 3 #define GPSDECODER_H 7 4 8 5 #include <list> 9 #include <iostream>10 6 11 using namespace std; 12 13 // 14 // One Code/Phase - Measurement 15 // 16 struct Observation { 17 Observation() 18 :SVPRN(0) 19 ,GPSWeek(0) 20 ,GPSWeeks(0) 21 ,sec(0.) 22 ,C1(0.) 23 ,P2(0.) 24 ,L1(0.) 25 ,L2(0.) 26 ,SNR1(0) 27 ,SNR2(0) 28 ,pCodeIndicator(0) 29 ,cumuLossOfCont(0) 30 {StatID[0] = '\0';} 31 32 Observation( char _statID 33 ,char _svprn 34 ,short _GPSWeek 35 ,int _GPSWeeks 36 ,double _sec 37 ,double _C1 38 ,double _P2 39 ,double _L1 40 ,double _L2 41 ,short _SNR1 42 ,short _SNR2 43 ,int _pCodeIndicator 44 ,unsigned _cumuLossOfCont) 45 :SVPRN(_svprn) 46 ,GPSWeek(_GPSWeek) 47 ,GPSWeeks(_GPSWeeks) 48 ,sec(_sec) 49 ,C1(_C1) 50 ,P2(_P2) 51 ,L1(_L1) 52 ,L2(_L2) 53 ,SNR1(_SNR1) 54 ,SNR2(_SNR2) 55 ,pCodeIndicator(_pCodeIndicator) 56 ,cumuLossOfCont(_cumuLossOfCont) 57 {StatID[0] = _statID; StatID[1] = '\0';} 58 59 char StatID[5+1]; //< Station ID 60 char SVPRN; //< Satellite PRN 61 short GPSWeek; //< Week of GPS-Time 62 int GPSWeeks; //< Second of Week (GPS-Time> 63 double sec; 64 double C1; //< CA-code validated raw pseudorange (meters) 65 double P2; //< P2-code validated raw pseudorange (meters) 66 double L1; //< validated raw carrier phase (meters) 67 double L2; //< validated raw carrier phase (meters) 68 short SNR1; //< signal-to noise ration (0.1 dB) 69 short SNR2; //< signal-to noise ration (0.1 dB) 70 int pCodeIndicator; // 0 ... CA Code, 1 ... P Code 71 unsigned cumuLossOfCont; // 0 to 31 72 } ; 73 74 // 75 // GPS Orbitinformation 76 // 77 struct Ephemeris { 78 short svprn; //< Satellite PRN 79 short wn; //< GPS - week number 80 short aodc; //< Age of data issue Clock 81 short aode; //< Age of data issue Orbit 82 double tow; //< Seconds of GPS week 83 double toc; //< Reference time, Clock (sec) 84 double toe; //< Ref.time for Orbit:(sec) 85 double tgd; //< Group delay (sec) 86 double af2; //< Clock parameter: (sec/sec^2) 87 double af1; //< Clock parameter: (sec/sec) 88 double af0; //< Clock parameter: (sec) 89 double crs; //< Sin-harmonic correction term, orbit radius:(meters) 90 double deltan; //< Mean anomaly correction:(semi-cirl/sec) 91 double m0; //< Mean anomaly @ ref.time:(semi-circle) 92 double cuc; //< Cos-harmonic correction term, argument of Latitude:(radians) 93 double e; //< Eccentricity 94 double cus; //< Sin-harmonic correction term, argument of Latitude:(radians) 95 double roota; //< Square root of semi-major axis:(m ^1/2) 96 double cic; //< Cos-harmonic correction term, angle of inclination:(radians) 97 double omega0; //< Lon. of Asc. node at weekly epoch: (semi-circle) 98 double cis; //< Sin-harmonic correction term, angle of Inclination:(radians) 99 double i0; //< Inclination angle at Ref.time: (semi-circle) 100 double crc; //< Cos-harmonic correction term, orbit radius:(meters) 101 double omega; //< Argument of Perigee:(semi-circle) 102 double omegadot; //< Rate of right ascension: (semi-circle/sec) 103 double idot; //< Rate of inclination angle: (semi-circle/sec) 104 short svaccu; //< SV accuracy (0-15) 105 short fit; //< Curve fit interval (0-1) 106 short cReserved1; //< Not used - yet 107 short health; //< 0 if healthy, else unhealthy 108 short cReserved2; //< Not used - yet 109 short SVEnable; //< Not used - yet 110 } ; 111 112 const double lambda1 = 0.1902936727984; // [m] 113 const double lambda2 = 0.2442102134241; // [m] 114 const unsigned glonass_svid = 45; 7 class Observation { 8 public: 9 Observation() { 10 flags = 0; 11 StatID[0] = '\0'; 12 SVPRN = 0; 13 GPSWeek = 0; 14 GPSWeeks = 0.0; 15 C1 = 0.0; 16 P1 = 0.0; 17 P2 = 0.0; 18 L1 = 0.0; 19 L2 = 0.0; 20 SNR1 = 0; 21 SNR2 = 0; 22 } 23 int flags; 24 char StatID[5+1]; // Station ID 25 int SVPRN; // Satellite PRN 26 int GPSWeek; // Week of GPS-Time 27 double GPSWeeks; // Second of Week (GPS-Time) 28 double C1; // CA-code pseudorange (meters) 29 double P1; // P1-code pseudorange (meters) 30 double P2; // P2-code pseudorange (meters) 31 double L1; // L1 carrier phase (cycles) 32 double L2; // L2 carrier phase (cycles) 33 int SNR1; // L1 signal-to noise ratio (0.1 dB) 34 int SNR2; // L2 signal-to noise ratio (0.1 dB) 35 }; 115 36 116 37 class GPSDecoder { 117 public: 118 int iPCode; // pointer for CA or P code on L1 119 120 virtual void Decode(char* _ptrBuffer=NULL, int _nBufLen=0) = 0; 121 virtual ~GPSDecoder() {} 122 typedef list<Observation*> ObsList_t; 123 typedef list<Ephemeris*> EphList_t; 124 125 ObsList_t m_lObsList; 126 EphList_t m_lEphList; 127 128 } ; 38 public: 39 virtual void Decode(char* buffer, int bufLen) = 0; 40 virtual ~GPSDecoder() {} 41 std::list<Observation*> _obsList; 42 }; 129 43 130 44 #endif -
trunk/BNC/RTCM/RTCM2.cpp
r220 r222 1081 1081 1082 1082 for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) { 1083 if (_ObsBlock.PRN[iSat] <= 32) { 1084 Observation* obs = new Observation(); 1083 Observation* obs = new Observation(); 1085 1084 1086 obs->SVPRN = _ObsBlock.PRN[iSat]; 1087 obs->GPSWeek = epochWeek; 1088 obs->GPSWeeks = int(epochSecs); 1089 obs->sec = _ObsBlock.secs; 1090 obs->pCodeIndicator = 0; 1091 obs->C1 = _ObsBlock.rng_C1[iSat]; 1092 obs->P2 = _ObsBlock.rng_P2[iSat]; 1093 obs->L1 = _ObsBlock.resolvedPhase_L1(iSat); 1094 obs->L2 = _ObsBlock.resolvedPhase_L2(iSat); 1085 obs->SVPRN = _ObsBlock.PRN[iSat]; 1086 obs->GPSWeek = epochWeek; 1087 obs->GPSWeeks = epochSecs; 1088 obs->C1 = _ObsBlock.rng_C1[iSat]; 1089 obs->P1 = _ObsBlock.rng_P1[iSat]; 1090 obs->P2 = _ObsBlock.rng_P2[iSat]; 1091 obs->L1 = _ObsBlock.resolvedPhase_L1(iSat); 1092 obs->L2 = _ObsBlock.resolvedPhase_L2(iSat); 1095 1093 1096 m_lObsList.push_back(obs); 1097 } 1094 _obsList.push_back(obs); 1098 1095 } 1099 1096 _ObsBlock.clear(); -
trunk/BNC/RTCM/RTCM2.h
r214 r222 333 333 void Decode(char* buffer = 0, int bufLen = 0); 334 334 private: 335 st ring_buffer;335 std::string _buffer; 336 336 rtcm2::RTCM2_Obs _ObsBlock; 337 337 rtcm2::RTCM2packet _PP; -
trunk/BNC/RTCM3/rtcm3.cpp
r131 r222 16 16 * -----------------------------------------------------------------------*/ 17 17 18 #include <iostream> 18 19 #include <math.h> 19 20 … … 57 58 58 59 if (rr == 2) { 59 cerr << "No valid RINEX! All values are modulo 299792.458!\n";60 std::cerr << "No valid RINEX! All values are modulo 299792.458!\n"; 60 61 exit(1); 61 62 } … … 63 64 for (int ii = 0; ii < _Parser.Data.numsats; ii++) { 64 65 Observation* obs = new Observation(); 65 66 //// obs->statID =67 //// obs->cumuLossOfCont =68 69 66 obs->SVPRN = _Parser.Data.satellites[ii]; 70 67 obs->GPSWeek = _Parser.Data.week; 71 obs->GPSWeeks = (int) (_Parser.Data.timeofweek / 1000.0); 72 obs->sec = fmod(_Parser.Data.timeofweek / 1000.0, 3600.0); 68 obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0; 73 69 74 70 for (int jj = 0; jj < _Parser.numdatatypes; jj++) { … … 82 78 if (_Parser.dataflag[jj] & GNSSDF_C1DATA) { 83 79 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 84 obs->pCodeIndicator = 0;85 80 } 86 81 else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) { 87 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 88 obs->pCodeIndicator = 1; 82 obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]]; 89 83 } 90 84 else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) { … … 100 94 } 101 95 } 102 m_lObsList.push_back(obs);96 _obsList.push_back(obs); 103 97 } 104 98 } -
trunk/BNC/RTIGS/rtigs.cpp
r97 r222 82 82 Observation* obs = new Observation(); 83 83 84 obs->SVPRN = _GPSTrans.DecObs.Obs[ii].sat_prn; 85 obs->GPSWeek = _GPSTrans.DecObs.Obs[ii].GPSTime / (7 * 86400); 86 obs->GPSWeeks = _GPSTrans.DecObs.Obs[ii].GPSTime % (7 * 86400); 87 obs->sec = _GPSTrans.DecObs.Obs[ii].GPSTime % 3600; 88 obs->pCodeIndicator = 1; 89 obs->C1 = _GPSTrans.DecObs.Obs[ii].p1_pseudo_range; 90 obs->P2 = _GPSTrans.DecObs.Obs[ii].p2_pseudo_range; 91 obs->L1 = _GPSTrans.DecObs.Obs[ii].p1_phase * (C / F1); // ok 92 obs->L2 = _GPSTrans.DecObs.Obs[ii].l1_phase * (C / F1); // strange, probably bug in RTIGS converter 93 obs->SNR1 = (short) _GPSTrans.DecObs.Obs[ii].l1_sn * 10; 94 obs->SNR2 = (short) _GPSTrans.DecObs.Obs[ii].l2_sn * 10; 95 obs->cumuLossOfCont = 0; 84 obs->SVPRN = _GPSTrans.DecObs.Obs[ii].sat_prn; 85 obs->GPSWeek = _GPSTrans.DecObs.Obs[ii].GPSTime / (7 * 86400); 86 obs->GPSWeeks = _GPSTrans.DecObs.Obs[ii].GPSTime % (7 * 86400); 87 obs->C1 = _GPSTrans.DecObs.Obs[ii].l1_pseudo_range; 88 obs->P1 = _GPSTrans.DecObs.Obs[ii].p1_pseudo_range; 89 obs->P2 = _GPSTrans.DecObs.Obs[ii].p2_pseudo_range; 90 obs->L1 = _GPSTrans.DecObs.Obs[ii].p1_phase; 91 obs->L2 = _GPSTrans.DecObs.Obs[ii].p2_phase; 92 obs->SNR1 = _GPSTrans.DecObs.Obs[ii].l1_sn * 10; 93 obs->SNR2 = _GPSTrans.DecObs.Obs[ii].l2_sn * 10; 96 94 97 m_lObsList.push_back(obs);95 _obsList.push_back(obs); 98 96 } 99 97 } -
trunk/BNC/bnccaster.cpp
r207 r222 15 15 * 16 16 * -----------------------------------------------------------------------*/ 17 18 #include <math.h> 17 19 18 20 #include "bnccaster.h" … … 91 93 void bncCaster::slotNewObs(const QByteArray& staID, Observation* obs) { 92 94 93 long newTime = obs->GPSWeek * 7*24*3600 + obs->GPSWeeks; 95 long iSec = long(floor(obs->GPSWeeks+0.5)); 96 long newTime = obs->GPSWeek * 7*24*3600 + iSec; 94 97 95 98 // Rename the Station … … 103 106 } 104 107 bncRinex* rnx = _rinexWriters.find(obs->StatID).value(); 105 if (_samplingRate == 0 || obs->GPSWeeks% _samplingRate == 0) {108 if (_samplingRate == 0 || iSec % _samplingRate == 0) { 106 109 rnx->deepCopy(obs); 107 110 } … … 121 124 !settings.value("outPort").toString().isEmpty() ) { 122 125 emit( newMessage(QString("Station %1: old epoch %2 thrown away") 123 .arg(staID.data()).arg( obs->GPSWeeks).toAscii()) );126 .arg(staID.data()).arg(iSec).toAscii()) ); 124 127 } 125 128 delete obs; … … 192 195 *_out << begEpoch << endl;; 193 196 } 194 *_out << obs->StatID << " " 195 << (int) obs->SVPRN << " " 196 << (int) obs->GPSWeek << " " 197 << obs->GPSWeeks << " " 198 << obs->sec << " " 199 << obs->pCodeIndicator << " " 200 << obs->cumuLossOfCont << " " 201 << obs->C1 << " " 202 << obs->P2 << " " 203 << obs->L1 << " " 204 << obs->L2 << endl; 197 *_out << obs->StatID << " " 198 << obs->SVPRN << " " 199 << obs->GPSWeek << " " 200 << obs->GPSWeeks << " " 201 << obs->C1 << " " 202 << obs->P1 << " " 203 << obs->P2 << " " 204 << obs->L1 << " " 205 << obs->L2 << endl; 205 206 if (!it.hasNext()) { 206 207 *_out << endEpoch << endl; -
trunk/BNC/bncgetthread.cpp
r214 r222 228 228 _decoder->Decode(data, nBytes); 229 229 delete data; 230 for (list<Observation*>::iterator it = _decoder-> m_lObsList.begin();231 it != _decoder-> m_lObsList.end(); it++) {230 for (list<Observation*>::iterator it = _decoder->_obsList.begin(); 231 it != _decoder->_obsList.end(); it++) { 232 232 emit newObs(_staID, *it); 233 233 } 234 _decoder-> m_lObsList.clear();234 _decoder->_obsList.clear(); 235 235 } 236 236 else { -
trunk/BNC/bncrinex.cpp
r221 r222 298 298 // Time of Epoch 299 299 // ------------- 300 Observation* firstObs = *dumpList.begin(); 301 302 QDateTime datTim = dateAndTimeFromGPSweek( firstObs->GPSWeek, 303 firstObs->GPSWeeks + 304 fmod(firstObs->sec, 1.0) ); 300 Observation* fObs = *dumpList.begin(); 301 QDateTime datTim = dateAndTimeFromGPSweek(fObs->GPSWeek, fObs->GPSWeeks); 305 302 306 303 // Close the file … … 340 337 _out << setw(14) << setprecision(3) << ob->C1 << lli << snr; 341 338 _out << setw(14) << setprecision(3) << ob->P2 << lli << snr; 342 _out << setw(14) << setprecision(3) << ob->L1 / t_CST::lambda1<< lli << snr;343 _out << setw(14) << setprecision(3) << ob->L2 / t_CST::lambda2<< lli << snr;339 _out << setw(14) << setprecision(3) << ob->L1 << lli << snr; 340 _out << setw(14) << setprecision(3) << ob->L2 << lli << snr; 344 341 _out << endl; 345 342 -
trunk/BNC/bncrinex.h
r160 r222 28 28 QByteArray _fName; 29 29 QList<Observation*> _obs; 30 ofstream_out;30 std::ofstream _out; 31 31 QStringList _headerLines; 32 32 bool _headerWritten;
Note:
See TracChangeset
for help on using the changeset viewer.