[7237] | 1 | #ifndef FILTER_H
|
---|
| 2 | #define FILTER_H
|
---|
| 3 |
|
---|
| 4 | #include <vector>
|
---|
| 5 | #include <newmat.h>
|
---|
| 6 | #include "pppInclude.h"
|
---|
| 7 | #include "pppParlist.h"
|
---|
| 8 | #include "bnctime.h"
|
---|
| 9 | #include "t_prn.h"
|
---|
[9386] | 10 | #include "pppClient.h"
|
---|
[7237] | 11 |
|
---|
| 12 | namespace BNC_PPP {
|
---|
| 13 |
|
---|
| 14 | class t_pppParlist;
|
---|
| 15 | class t_pppObsPool;
|
---|
| 16 | class t_pppSatObs;
|
---|
| 17 |
|
---|
| 18 | class t_pppFilter {
|
---|
| 19 | public:
|
---|
[8905] | 20 | t_pppFilter(t_pppObsPool* obsPool);
|
---|
[7237] | 21 | ~t_pppFilter();
|
---|
| 22 |
|
---|
[9386] | 23 | t_irc processEpoch();
|
---|
[7237] | 24 |
|
---|
[9386] | 25 | t_irc datumTransformation();
|
---|
| 26 | void initDatumTransformation(const std::vector<t_pppSatObs*>& allObs);
|
---|
[8912] | 27 |
|
---|
[7237] | 28 | const ColumnVector& x() const {return _xFlt;}
|
---|
| 29 | const SymmetricMatrix& Q() const {return _QFlt;}
|
---|
| 30 |
|
---|
| 31 | int numSat() const {return _numSat;}
|
---|
[7928] | 32 | double HDOP() const {return _dop.H;}
|
---|
| 33 | double HDOV() const {return _dop.V;}
|
---|
[7237] | 34 | double PDOP() const {return _dop.P;}
|
---|
| 35 | double GDOP() const {return _dop.G;}
|
---|
| 36 | double trp() const {
|
---|
| 37 | const std::vector<t_pppParam*>& par = _parlist->params();
|
---|
| 38 | for (unsigned ii = 0; ii < par.size(); ++ii) {
|
---|
| 39 | if (par[ii]->type() == t_pppParam::trp) {
|
---|
| 40 | return x()[ii];
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 | return 0.0;
|
---|
| 44 | };
|
---|
| 45 | double trpStdev() const {
|
---|
| 46 | const std::vector<t_pppParam*>& par = _parlist->params();
|
---|
| 47 | for (unsigned ii = 0; ii < par.size(); ++ii) {
|
---|
| 48 | if (par[ii]->type() == t_pppParam::trp) {
|
---|
| 49 | return sqrt(Q()[ii][ii]);
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 | return 0.0;
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | private:
|
---|
| 56 | class t_slip {
|
---|
| 57 | public:
|
---|
| 58 | t_slip() {
|
---|
| 59 | _slip = false;
|
---|
| 60 | _obsSlipCounter = -1;
|
---|
| 61 | _biasJumpCounter = -1;
|
---|
| 62 | }
|
---|
| 63 | bool _slip;
|
---|
| 64 | int _obsSlipCounter;
|
---|
| 65 | int _biasJumpCounter;
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | class t_dop {
|
---|
| 69 | public:
|
---|
| 70 | t_dop() {reset();}
|
---|
[7928] | 71 | void reset() {H = V = P = T = G = 0.0;}
|
---|
| 72 | double H;
|
---|
| 73 | double V;
|
---|
[7237] | 74 | double P;
|
---|
| 75 | double T;
|
---|
| 76 | double G;
|
---|
| 77 | };
|
---|
| 78 |
|
---|
[8956] | 79 | class t_datumTrafo {
|
---|
[8915] | 80 | public:
|
---|
| 81 | t_datumTrafo () {initIndices();}
|
---|
| 82 | void initIndices() {_firstRow = 1; _lastRow = 0;}
|
---|
| 83 | void setFirstSystem(bool firstSys) {_firstSys = firstSys;}
|
---|
| 84 | bool firstSystem() {return _firstSys;}
|
---|
[9386] | 85 | void updateIndices(int maxObsSys) {
|
---|
[8956] | 86 | if (firstSystem()) {
|
---|
[8915] | 87 | initIndices();
|
---|
| 88 | }
|
---|
| 89 | else {
|
---|
[9304] | 90 | _firstRow = _lastRow + 1;
|
---|
[8915] | 91 | }
|
---|
[9386] | 92 | _lastRow += maxObsSys;
|
---|
| 93 |
|
---|
[8915] | 94 | };
|
---|
[9386] | 95 | void setObsNum(int maxObs) {_maxObs = maxObs;}
|
---|
| 96 | void setParNum(int numPar) {_numPar = numPar;}
|
---|
| 97 | int obsNum() {return _maxObs;}
|
---|
| 98 | int parNum() {return _numPar;}
|
---|
| 99 | const Matrix& AA1() {return _AA1;}
|
---|
| 100 | const Matrix& AA2() {return _AA2;}
|
---|
| 101 |
|
---|
| 102 | void initAA() {
|
---|
| 103 | _AA1.ReSize(_maxObs, _numPar); _AA1 = 0.0;
|
---|
| 104 | _AA2.ReSize(_maxObs, _numPar); _AA2 = 0.0;
|
---|
[8915] | 105 | }
|
---|
[9386] | 106 |
|
---|
| 107 | void prepareAA(const Matrix& AA, int ind) {
|
---|
[8956] | 108 | Matrix* Prep = &_AA2;
|
---|
[9386] | 109 | if (ind == 1) {
|
---|
[8956] | 110 | Prep = &_AA1;
|
---|
[8915] | 111 | }
|
---|
[9386] | 112 | Prep->SubMatrix(_firstRow, _lastRow, 1, _numPar) << AA;
|
---|
[8915] | 113 | }
|
---|
[9386] | 114 | void switchAA() {
|
---|
| 115 | _AA1 = _AA2;
|
---|
| 116 | }
|
---|
| 117 | Matrix& getAA(int ind) {
|
---|
| 118 | if (ind == 1) {
|
---|
| 119 | return _AA1;
|
---|
| 120 | }
|
---|
| 121 | return _AA2;
|
---|
| 122 | }
|
---|
[8956] | 123 | Matrix computeTrafoMatrix() {
|
---|
[9386] | 124 | Matrix D21 = ((_AA2.t() * _AA2).i()) * _AA2.t() * _AA1;
|
---|
[8956] | 125 | return D21;
|
---|
[8915] | 126 | }
|
---|
[9386] | 127 | void printMatrix(const Matrix& X, int nRow, int nCol) {
|
---|
[8956] | 128 | for (int rr = 0; rr < nRow; rr++) {
|
---|
| 129 | for (int cc = 0; cc < nCol; cc++) {
|
---|
[9386] | 130 | LOG << setw(6) << setprecision(3) << X[rr][cc] << " ;";
|
---|
[8956] | 131 | }
|
---|
[9386] | 132 | LOG << endl;
|
---|
| 133 | }
|
---|
| 134 | LOG << endl;
|
---|
[8956] | 135 | }
|
---|
[9386] | 136 |
|
---|
| 137 | int _firstRow;
|
---|
| 138 | int _lastRow;
|
---|
| 139 | Matrix _AA1;
|
---|
| 140 | Matrix _AA2;
|
---|
| 141 | bool _firstSys;
|
---|
| 142 | int _maxObs;
|
---|
| 143 | int _numPar;
|
---|
| 144 | QMap<char, t_prn> _refSatMapPseudoObs;
|
---|
[8915] | 145 | };
|
---|
| 146 |
|
---|
[7302] | 147 | t_irc processSystem(const std::vector<t_lc::type>& LCs,
|
---|
[8905] | 148 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
| 149 | const t_prn& refPrn,
|
---|
| 150 | bool pseudoObsIonoAvailable,
|
---|
| 151 | bool preProcessing);
|
---|
[7237] | 152 |
|
---|
[7302] | 153 | t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs,
|
---|
[8905] | 154 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
| 155 | const t_prn& refPrn,
|
---|
| 156 | bool preProcessing);
|
---|
[7237] | 157 |
|
---|
| 158 | t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector,
|
---|
| 159 | SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0);
|
---|
| 160 |
|
---|
| 161 | void cmpDOP(const std::vector<t_pppSatObs*>& obsVector);
|
---|
| 162 |
|
---|
| 163 | void predictCovCrdPart(const SymmetricMatrix& QFltOld);
|
---|
| 164 |
|
---|
[9386] | 165 | t_irc addNoiseToIono(char sys);
|
---|
[8956] | 166 |
|
---|
[9386] | 167 | bool resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector);
|
---|
| 168 |
|
---|
[7237] | 169 | bncTime _epoTime;
|
---|
| 170 | t_pppParlist* _parlist;
|
---|
[8905] | 171 | t_pppObsPool* _obsPool;
|
---|
[8915] | 172 | t_datumTrafo* _datumTrafo;
|
---|
[7237] | 173 | SymmetricMatrix _QFlt;
|
---|
| 174 | ColumnVector _xFlt;
|
---|
| 175 | ColumnVector _x0;
|
---|
| 176 | t_slip _slips[t_prn::MAXPRN+1];
|
---|
| 177 | int _numSat;
|
---|
| 178 | t_dop _dop;
|
---|
| 179 | bncTime _firstEpoTime;
|
---|
[7302] | 180 | bncTime _lastEpoTimeOK;
|
---|
[8910] | 181 | t_prn _refPrn;
|
---|
[7237] | 182 | };
|
---|
| 183 |
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | #endif
|
---|