[7235] | 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 |
|
---|
[8252] | 28 | #include <QByteArray>
|
---|
| 29 | #include <QMap>
|
---|
| 30 | #include <QStringList>
|
---|
| 31 | #include <QVector>
|
---|
[7235] | 32 | #include <newmat.h>
|
---|
| 33 |
|
---|
| 34 | #include "bncconst.h"
|
---|
| 35 | #include "bnctime.h"
|
---|
| 36 |
|
---|
| 37 | class bncAntex;
|
---|
| 38 |
|
---|
| 39 | namespace BNC_PPP {
|
---|
| 40 |
|
---|
| 41 | class t_pppClient;
|
---|
| 42 | class t_pppOptions;
|
---|
| 43 | class t_epoData;
|
---|
| 44 | class t_satData;
|
---|
| 45 | class t_tides;
|
---|
| 46 |
|
---|
| 47 | class t_satData {
|
---|
| 48 | public:
|
---|
| 49 | t_satData() {
|
---|
| 50 | obsIndex = 0;
|
---|
[7627] | 51 | P1 = 0.0;
|
---|
| 52 | P2 = 0.0;
|
---|
| 53 | P5 = 0.0;
|
---|
| 54 | P7 = 0.0;
|
---|
| 55 | P3 = 0.0;
|
---|
| 56 | L1 = 0.0;
|
---|
| 57 | L2 = 0.0;
|
---|
| 58 | L5 = 0.0;
|
---|
| 59 | L7 = 0.0;
|
---|
| 60 | L3 = 0.0;
|
---|
| 61 | lkA = 0.0;
|
---|
| 62 | lkB = 0.0;
|
---|
| 63 | clk = 0.0;
|
---|
| 64 | eleSat = 0.0;
|
---|
| 65 | azSat = 0.0;
|
---|
| 66 | rho = 0.0;
|
---|
| 67 | slipFlag = false;
|
---|
| 68 | lambda3 = 0.0;
|
---|
[7235] | 69 | }
|
---|
| 70 | ~t_satData() {}
|
---|
| 71 | bncTime tt;
|
---|
| 72 | QString prn;
|
---|
| 73 | double P1;
|
---|
| 74 | double P2;
|
---|
| 75 | double P5;
|
---|
| 76 | double P7;
|
---|
| 77 | double P3;
|
---|
| 78 | double L1;
|
---|
| 79 | double L2;
|
---|
| 80 | double L5;
|
---|
| 81 | double L7;
|
---|
| 82 | double L3;
|
---|
| 83 | ColumnVector xx;
|
---|
| 84 | ColumnVector vv;
|
---|
| 85 | double clk;
|
---|
| 86 | double eleSat;
|
---|
| 87 | double azSat;
|
---|
| 88 | double rho;
|
---|
| 89 | bool slipFlag;
|
---|
| 90 | double lambda3;
|
---|
| 91 | double lkA;
|
---|
| 92 | double lkB;
|
---|
| 93 | unsigned obsIndex;
|
---|
[8127] | 94 | char system() const {return prn.toLatin1()[0];}
|
---|
[7235] | 95 | };
|
---|
| 96 |
|
---|
| 97 | class t_epoData {
|
---|
| 98 | public:
|
---|
| 99 | t_epoData() {}
|
---|
| 100 |
|
---|
| 101 | ~t_epoData() {
|
---|
| 102 | clear();
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | void clear() {
|
---|
| 106 | QMapIterator<QString, t_satData*> it(satData);
|
---|
| 107 | while (it.hasNext()) {
|
---|
| 108 | it.next();
|
---|
| 109 | delete it.value();
|
---|
| 110 | }
|
---|
| 111 | satData.clear();
|
---|
| 112 | tt.reset();
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | void deepCopy(const t_epoData* from) {
|
---|
| 116 | clear();
|
---|
| 117 | tt = from->tt;
|
---|
| 118 | QMapIterator<QString, t_satData*> it(from->satData);
|
---|
| 119 | while (it.hasNext()) {
|
---|
| 120 | it.next();
|
---|
| 121 | satData[it.key()] = new t_satData(*it.value());
|
---|
| 122 | }
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | unsigned sizeSys(char system) const {
|
---|
| 126 | unsigned ans = 0;
|
---|
| 127 | QMapIterator<QString, t_satData*> it(satData);
|
---|
| 128 | while (it.hasNext()) {
|
---|
| 129 | it.next();
|
---|
| 130 | if (it.value()->system() == system) {
|
---|
| 131 | ++ans;
|
---|
| 132 | }
|
---|
| 133 | }
|
---|
| 134 | return ans;
|
---|
| 135 | }
|
---|
| 136 | unsigned sizeAll() const {return satData.size();}
|
---|
| 137 |
|
---|
| 138 | bncTime tt;
|
---|
| 139 | QMap<QString, t_satData*> satData;
|
---|
| 140 | };
|
---|
| 141 |
|
---|
| 142 | class t_pppParam {
|
---|
| 143 | public:
|
---|
[7627] | 144 | enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
|
---|
[7235] | 145 | GLONASS_OFFSET, GALILEO_OFFSET, BDS_OFFSET};
|
---|
| 146 | t_pppParam(parType typeIn, int indexIn, const QString& prn);
|
---|
| 147 | ~t_pppParam();
|
---|
| 148 | double partial(t_satData* satData, bool phase);
|
---|
| 149 | bool isCrd() const {
|
---|
| 150 | return (type == CRD_X || type == CRD_Y || type == CRD_Z);
|
---|
| 151 | }
|
---|
| 152 | parType type;
|
---|
| 153 | double xx;
|
---|
| 154 | int index;
|
---|
| 155 | int index_old;
|
---|
| 156 | int numEpo;
|
---|
| 157 | QString prn;
|
---|
| 158 | };
|
---|
| 159 |
|
---|
| 160 | class t_pppFilter {
|
---|
| 161 | public:
|
---|
| 162 | t_pppFilter(t_pppClient* pppClient);
|
---|
| 163 | ~t_pppFilter();
|
---|
| 164 | t_irc update(t_epoData* epoData);
|
---|
| 165 | bncTime time() const {return _time;}
|
---|
| 166 | const SymmetricMatrix& Q() const {return _QQ;}
|
---|
| 167 | const ColumnVector& neu() const {return _neu;}
|
---|
| 168 | int numSat() const {return _numSat;}
|
---|
[7929] | 169 | double HDOP() const {return _hDop;}
|
---|
[7235] | 170 | double x() const {return _params[0]->xx;}
|
---|
| 171 | double y() const {return _params[1]->xx;}
|
---|
| 172 | double z() const {return _params[2]->xx;}
|
---|
| 173 | double clk() const {return _params[3]->xx;}
|
---|
| 174 | double trp0() {return delay_saast(M_PI/2.0);}
|
---|
| 175 | double trp() const {
|
---|
| 176 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 177 | t_pppParam* pp = _params[ii];
|
---|
| 178 | if (pp->type == t_pppParam::TROPO) {
|
---|
| 179 | return pp->xx;
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 | return 0.0;
|
---|
| 183 | }
|
---|
| 184 | double trpStdev() const {
|
---|
| 185 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 186 | t_pppParam* pp = _params[ii];
|
---|
| 187 | if (pp->type == t_pppParam::TROPO) {
|
---|
| 188 | return sqrt(Q()[ii][ii]);
|
---|
| 189 | }
|
---|
| 190 | }
|
---|
| 191 | return 0.0;
|
---|
| 192 | }
|
---|
| 193 | double Glonass_offset() const {
|
---|
| 194 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 195 | t_pppParam* pp = _params[ii];
|
---|
| 196 | if (pp->type == t_pppParam::GLONASS_OFFSET) {
|
---|
| 197 | return pp->xx;
|
---|
| 198 | }
|
---|
| 199 | }
|
---|
| 200 | return 0.0;
|
---|
| 201 | }
|
---|
| 202 | double Galileo_offset() const {
|
---|
| 203 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 204 | t_pppParam* pp = _params[ii];
|
---|
| 205 | if (pp->type == t_pppParam::GALILEO_OFFSET) {
|
---|
| 206 | return pp->xx;
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 | return 0.0;
|
---|
| 210 | }
|
---|
| 211 | double Bds_offset() const {
|
---|
| 212 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
| 213 | t_pppParam* pp = _params[ii];
|
---|
| 214 | if (pp->type == t_pppParam::BDS_OFFSET) {
|
---|
| 215 | return pp->xx;
|
---|
| 216 | }
|
---|
| 217 | }
|
---|
| 218 | return 0.0;
|
---|
| 219 | }
|
---|
| 220 | private:
|
---|
| 221 | void reset();
|
---|
| 222 | t_irc cmpBancroft(t_epoData* epoData);
|
---|
| 223 | void cmpEle(t_satData* satData);
|
---|
| 224 | void addAmb(t_satData* satData);
|
---|
| 225 | void addObs(int iPhase, unsigned& iObs, t_satData* satData,
|
---|
| 226 | Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
|
---|
[7627] | 227 | QByteArray printRes(int iPhase, const ColumnVector& vv,
|
---|
[7235] | 228 | const QMap<QString, t_satData*>& satDataMap);
|
---|
| 229 | void findMaxRes(const ColumnVector& vv,
|
---|
| 230 | const QMap<QString, t_satData*>& satData,
|
---|
[7627] | 231 | QString& prnGPS, QString& prnGlo,
|
---|
| 232 | double& maxResGPS, double& maxResGlo);
|
---|
[7235] | 233 | double cmpValue(t_satData* satData, bool phase);
|
---|
| 234 | double delay_saast(double Ele);
|
---|
| 235 | void predict(int iPhase, t_epoData* epoData);
|
---|
| 236 | t_irc update_p(t_epoData* epoData);
|
---|
| 237 | QString outlierDetection(int iPhase, const ColumnVector& vv,
|
---|
| 238 | QMap<QString, t_satData*>& satData);
|
---|
| 239 |
|
---|
| 240 | double windUp(const QString& prn, const ColumnVector& rSat,
|
---|
| 241 | const ColumnVector& rRec);
|
---|
| 242 |
|
---|
| 243 | bncTime _startTime;
|
---|
| 244 |
|
---|
| 245 | void rememberState(t_epoData* epoData);
|
---|
| 246 | void restoreState(t_epoData* epoData);
|
---|
[7627] | 247 |
|
---|
| 248 | t_irc selectSatellites(const QString& lastOutlierPrn,
|
---|
[7235] | 249 | QMap<QString, t_satData*>& satData);
|
---|
| 250 |
|
---|
| 251 | void bancroft(const Matrix& BBpass, ColumnVector& pos);
|
---|
| 252 |
|
---|
| 253 | void cmpDOP(t_epoData* epoData);
|
---|
| 254 |
|
---|
| 255 | t_pppClient* _pppClient;
|
---|
| 256 | bncTime _time;
|
---|
| 257 | bncTime _lastTimeOK;
|
---|
| 258 | QVector<t_pppParam*> _params;
|
---|
| 259 | SymmetricMatrix _QQ;
|
---|
| 260 | QVector<t_pppParam*> _params_sav;
|
---|
| 261 | SymmetricMatrix _QQ_sav;
|
---|
| 262 | t_epoData* _epoData_sav;
|
---|
| 263 | ColumnVector _xcBanc;
|
---|
| 264 | ColumnVector _ellBanc;
|
---|
| 265 | QMap<QString, double> _windUpTime;
|
---|
| 266 | QMap<QString, double> _windUpSum;
|
---|
| 267 | QStringList _outlierGPS;
|
---|
| 268 | QStringList _outlierGlo;
|
---|
| 269 | bncAntex* _antex;
|
---|
| 270 | t_tides* _tides;
|
---|
| 271 | ColumnVector _neu;
|
---|
| 272 | int _numSat;
|
---|
[7929] | 273 | double _hDop;
|
---|
[7235] | 274 | };
|
---|
| 275 |
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 | #endif
|
---|