Changeset 7203 in ntrip for trunk/BNC/src/PPP/pppFilter.h
- Timestamp:
- Aug 17, 2015, 12:30:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppFilter.h
r6654 r7203 1 #ifndef FILTER_H 2 #define FILTER_H 3 4 #include <vector> 1 // Part of BNC, a utility for retrieving decoding and 2 // converting GNSS data streams from NTRIP broadcasters. 3 // 4 // Copyright (C) 2007 5 // German Federal Agency for Cartography and Geodesy (BKG) 6 // http://www.bkg.bund.de 7 // Czech Technical University Prague, Department of Geodesy 8 // http://www.fsv.cvut.cz 9 // 10 // Email: euref-ip@bkg.bund.de 11 // 12 // This program is free software; you can redistribute it and/or 13 // modify it under the terms of the GNU General Public License 14 // as published by the Free Software Foundation, version 2. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program; if not, write to the Free Software 23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 25 #ifndef PPPFILTER_H 26 #define PPPFILTER_H 27 28 #include <QtCore> 29 #include <QtNetwork> 5 30 #include <newmat.h> 6 #include "pppInclude.h" 7 #include " pppParlist.h"31 32 #include "bncconst.h" 8 33 #include "bnctime.h" 9 #include "t_prn.h" 34 35 class bncAntex; 10 36 11 37 namespace BNC_PPP { 12 38 13 class t_pppParlist; 14 class t_pppObsPool; 15 class t_pppSatObs; 39 class t_pppClient; 40 class t_pppOptions; 41 class t_epoData; 42 class t_satData; 43 class t_tides; 44 45 class t_satData { 46 public: 47 t_satData() { 48 obsIndex = 0; 49 P1 = 0.0; 50 P2 = 0.0; 51 P5 = 0.0; 52 P3 = 0.0; 53 L1 = 0.0; 54 L2 = 0.0; 55 L5 = 0.0; 56 L3 = 0.0; 57 lkA = 0.0; 58 lkB = 0.0; 59 } 60 ~t_satData() {} 61 bncTime tt; 62 QString prn; 63 double P1; 64 double P2; 65 double P5; 66 double P7; 67 double P3; 68 double L1; 69 double L2; 70 double L5; 71 double L7; 72 double L3; 73 ColumnVector xx; 74 ColumnVector vv; 75 double clk; 76 double eleSat; 77 double azSat; 78 double rho; 79 bool slipFlag; 80 double lambda3; 81 double lkA; 82 double lkB; 83 unsigned obsIndex; 84 char system() const {return prn.toAscii()[0];} 85 }; 86 87 class t_epoData { 88 public: 89 t_epoData() {} 90 91 ~t_epoData() { 92 clear(); 93 } 94 95 void clear() { 96 QMapIterator<QString, t_satData*> it(satData); 97 while (it.hasNext()) { 98 it.next(); 99 delete it.value(); 100 } 101 satData.clear(); 102 tt.reset(); 103 } 104 105 void deepCopy(const t_epoData* from) { 106 clear(); 107 tt = from->tt; 108 QMapIterator<QString, t_satData*> it(from->satData); 109 while (it.hasNext()) { 110 it.next(); 111 satData[it.key()] = new t_satData(*it.value()); 112 } 113 } 114 115 unsigned sizeSys(char system) const { 116 unsigned ans = 0; 117 QMapIterator<QString, t_satData*> it(satData); 118 while (it.hasNext()) { 119 it.next(); 120 if (it.value()->system() == system) { 121 ++ans; 122 } 123 } 124 return ans; 125 } 126 unsigned sizeAll() const {return satData.size();} 127 128 bncTime tt; 129 QMap<QString, t_satData*> satData; 130 }; 131 132 class t_pppParam { 133 public: 134 enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3, 135 GLONASS_OFFSET, GALILEO_OFFSET, BDS_OFFSET}; 136 t_pppParam(parType typeIn, int indexIn, const QString& prn); 137 ~t_pppParam(); 138 double partial(t_satData* satData, bool phase); 139 bool isCrd() const { 140 return (type == CRD_X || type == CRD_Y || type == CRD_Z); 141 } 142 parType type; 143 double xx; 144 int index; 145 int index_old; 146 int numEpo; 147 QString prn; 148 }; 16 149 17 150 class t_pppFilter { 18 151 public: 19 t_pppFilter( );152 t_pppFilter(t_pppClient* pppClient); 20 153 ~t_pppFilter(); 21 22 t_irc processEpoch(t_pppObsPool* obsPool); 23 24 const ColumnVector& x() const {return _xFlt;} 25 const SymmetricMatrix& Q() const {return _QFlt;} 26 154 t_irc update(t_epoData* epoData); 155 bncTime time() const {return _time;} 156 const SymmetricMatrix& Q() const {return _QQ;} 157 const ColumnVector& neu() const {return _neu;} 27 158 int numSat() const {return _numSat;} 28 double PDOP() const {return _dop.P;} 29 double GDOP() const {return _dop.G;} 159 double PDOP() const {return _pDop;} 160 double x() const {return _params[0]->xx;} 161 double y() const {return _params[1]->xx;} 162 double z() const {return _params[2]->xx;} 163 double clk() const {return _params[3]->xx;} 164 double trp0() {return delay_saast(M_PI/2.0);} 30 165 double trp() const { 31 const std::vector<t_pppParam*>& par = _parlist->params();32 for (unsigned ii = 0; ii < par.size(); ++ii) {33 if (p ar[ii]->type() == t_pppParam::trp) {34 return x()[ii];35 } 36 } 37 return 0.0; 38 } ;166 for (int ii = 0; ii < _params.size(); ++ii) { 167 t_pppParam* pp = _params[ii]; 168 if (pp->type == t_pppParam::TROPO) { 169 return pp->xx; 170 } 171 } 172 return 0.0; 173 } 39 174 double trpStdev() const { 40 const std::vector<t_pppParam*>& par = _parlist->params();41 for (unsigned ii = 0; ii < par.size(); ++ii) {42 if (p ar[ii]->type() == t_pppParam::trp) {175 for (int ii = 0; ii < _params.size(); ++ii) { 176 t_pppParam* pp = _params[ii]; 177 if (pp->type == t_pppParam::TROPO) { 43 178 return sqrt(Q()[ii][ii]); 44 179 } 45 180 } 46 181 return 0.0; 47 }; 48 182 } 183 double Glonass_offset() const { 184 for (int ii = 0; ii < _params.size(); ++ii) { 185 t_pppParam* pp = _params[ii]; 186 if (pp->type == t_pppParam::GLONASS_OFFSET) { 187 return pp->xx; 188 } 189 } 190 return 0.0; 191 } 192 double Galileo_offset() const { 193 for (int ii = 0; ii < _params.size(); ++ii) { 194 t_pppParam* pp = _params[ii]; 195 if (pp->type == t_pppParam::GALILEO_OFFSET) { 196 return pp->xx; 197 } 198 } 199 return 0.0; 200 } 201 double Bds_offset() const { 202 for (int ii = 0; ii < _params.size(); ++ii) { 203 t_pppParam* pp = _params[ii]; 204 if (pp->type == t_pppParam::BDS_OFFSET) { 205 return pp->xx; 206 } 207 } 208 return 0.0; 209 } 49 210 private: 50 class t_slip { 51 public: 52 t_slip() { 53 _slip = false; 54 _obsSlipCounter = -1; 55 _biasJumpCounter = -1; 56 } 57 bool _slip; 58 int _obsSlipCounter; 59 int _biasJumpCounter; 60 }; 61 62 class t_dop { 63 public: 64 t_dop() {reset();} 65 void reset() {P = T = G = 0.0;} 66 double P; 67 double T; 68 double G; 69 }; 70 71 t_irc processSystem(const std::vector<t_lc::type>& LCs, 72 const std::vector<t_pppSatObs*>& obsVector); 73 74 t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs, 75 const std::vector<t_pppSatObs*>& obsVector); 76 77 t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, 78 SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0); 79 80 void cmpDOP(const std::vector<t_pppSatObs*>& obsVector); 81 82 void predictCovCrdPart(const SymmetricMatrix& QFltOld); 83 84 bncTime _epoTime; 85 t_pppParlist* _parlist; 86 SymmetricMatrix _QFlt; 87 ColumnVector _xFlt; 88 ColumnVector _x0; 89 t_slip _slips[t_prn::MAXPRN+1]; 90 int _numSat; 91 t_dop _dop; 92 bncTime _firstEpoTime; 211 void reset(); 212 t_irc cmpBancroft(t_epoData* epoData); 213 void cmpEle(t_satData* satData); 214 void addAmb(t_satData* satData); 215 void addObs(int iPhase, unsigned& iObs, t_satData* satData, 216 Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP); 217 QByteArray printRes(int iPhase, const ColumnVector& vv, 218 const QMap<QString, t_satData*>& satDataMap); 219 void findMaxRes(const ColumnVector& vv, 220 const QMap<QString, t_satData*>& satData, 221 QString& prnGPS, QString& prnGlo, 222 double& maxResGPS, double& maxResGlo); 223 double cmpValue(t_satData* satData, bool phase); 224 double delay_saast(double Ele); 225 void predict(int iPhase, t_epoData* epoData); 226 t_irc update_p(t_epoData* epoData); 227 QString outlierDetection(int iPhase, const ColumnVector& vv, 228 QMap<QString, t_satData*>& satData); 229 230 double windUp(const QString& prn, const ColumnVector& rSat, 231 const ColumnVector& rRec); 232 233 bncTime _startTime; 234 235 void rememberState(t_epoData* epoData); 236 void restoreState(t_epoData* epoData); 237 238 t_irc selectSatellites(const QString& lastOutlierPrn, 239 QMap<QString, t_satData*>& satData); 240 241 void bancroft(const Matrix& BBpass, ColumnVector& pos); 242 243 void cmpDOP(t_epoData* epoData); 244 245 t_pppClient* _pppClient; 246 bncTime _time; 247 bncTime _lastTimeOK; 248 QVector<t_pppParam*> _params; 249 SymmetricMatrix _QQ; 250 QVector<t_pppParam*> _params_sav; 251 SymmetricMatrix _QQ_sav; 252 t_epoData* _epoData_sav; 253 ColumnVector _xcBanc; 254 ColumnVector _ellBanc; 255 QMap<QString, double> _windUpTime; 256 QMap<QString, double> _windUpSum; 257 QStringList _outlierGPS; 258 QStringList _outlierGlo; 259 bncAntex* _antex; 260 t_tides* _tides; 261 ColumnVector _neu; 262 int _numSat; 263 double _pDop; 93 264 }; 94 265
Note:
See TracChangeset
for help on using the changeset viewer.