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"
|
---|
10 |
|
---|
11 | namespace BNC_PPP {
|
---|
12 |
|
---|
13 | class t_pppParlist;
|
---|
14 | class t_pppObsPool;
|
---|
15 | class t_pppSatObs;
|
---|
16 |
|
---|
17 | class t_pppFilter {
|
---|
18 | public:
|
---|
19 | t_pppFilter(t_pppObsPool* obsPool);
|
---|
20 | ~t_pppFilter();
|
---|
21 |
|
---|
22 | t_irc processEpoch(int num);
|
---|
23 |
|
---|
24 | void datumTransformation(const ColumnVector& xFltOld, const SymmetricMatrix& QFltOld);
|
---|
25 |
|
---|
26 | const ColumnVector& x() const {return _xFlt;}
|
---|
27 | const SymmetricMatrix& Q() const {return _QFlt;}
|
---|
28 |
|
---|
29 | int numSat() const {return _numSat;}
|
---|
30 | double HDOP() const {return _dop.H;}
|
---|
31 | double HDOV() const {return _dop.V;}
|
---|
32 | double PDOP() const {return _dop.P;}
|
---|
33 | double GDOP() const {return _dop.G;}
|
---|
34 | double trp() const {
|
---|
35 | const std::vector<t_pppParam*>& par = _parlist->params();
|
---|
36 | for (unsigned ii = 0; ii < par.size(); ++ii) {
|
---|
37 | if (par[ii]->type() == t_pppParam::trp) {
|
---|
38 | return x()[ii];
|
---|
39 | }
|
---|
40 | }
|
---|
41 | return 0.0;
|
---|
42 | };
|
---|
43 | double trpStdev() const {
|
---|
44 | const std::vector<t_pppParam*>& par = _parlist->params();
|
---|
45 | for (unsigned ii = 0; ii < par.size(); ++ii) {
|
---|
46 | if (par[ii]->type() == t_pppParam::trp) {
|
---|
47 | return sqrt(Q()[ii][ii]);
|
---|
48 | }
|
---|
49 | }
|
---|
50 | return 0.0;
|
---|
51 | };
|
---|
52 |
|
---|
53 | private:
|
---|
54 | class t_slip {
|
---|
55 | public:
|
---|
56 | t_slip() {
|
---|
57 | _slip = false;
|
---|
58 | _obsSlipCounter = -1;
|
---|
59 | _biasJumpCounter = -1;
|
---|
60 | }
|
---|
61 | bool _slip;
|
---|
62 | int _obsSlipCounter;
|
---|
63 | int _biasJumpCounter;
|
---|
64 | };
|
---|
65 |
|
---|
66 | class t_dop {
|
---|
67 | public:
|
---|
68 | t_dop() {reset();}
|
---|
69 | void reset() {H = V = P = T = G = 0.0;}
|
---|
70 | double H;
|
---|
71 | double V;
|
---|
72 | double P;
|
---|
73 | double T;
|
---|
74 | double G;
|
---|
75 | };
|
---|
76 |
|
---|
77 | class t_datumTrafo {
|
---|
78 | public:
|
---|
79 | t_datumTrafo () {initIndices();}
|
---|
80 | void initIndices() {_firstRow = 1; _lastRow = 0;}
|
---|
81 | void setFirstSystem(bool firstSys) {_firstSys = firstSys;}
|
---|
82 | bool firstSystem() {return _firstSys;}
|
---|
83 | void updateIndices(int maxObs) {
|
---|
84 | if (firstSystem()) {
|
---|
85 | initIndices();
|
---|
86 | }
|
---|
87 | else {
|
---|
88 | _firstRow += maxObs;
|
---|
89 | }
|
---|
90 | _lastRow += maxObs;
|
---|
91 | };
|
---|
92 | void initAA(int maxObs, int numPar) {
|
---|
93 | _AA1.ReSize(maxObs, numPar); _AA1 = 0.0;
|
---|
94 | _AA2.ReSize(maxObs, numPar); _AA2 = 0.0;
|
---|
95 | }
|
---|
96 | void prepareAA(const Matrix& AA, int numEpoProcessing, int nPar) {
|
---|
97 | Matrix* Prep = &_AA2;
|
---|
98 | if (numEpoProcessing == 1) {
|
---|
99 | Prep = &_AA1;
|
---|
100 | }
|
---|
101 | Prep->SubMatrix(_firstRow, _lastRow, 1, nPar) << AA;
|
---|
102 | }
|
---|
103 |
|
---|
104 | Matrix computeTrafoMatrix() {
|
---|
105 | Matrix D21 = (_AA2.t() * _AA2).i() * _AA2.t() * _AA1;
|
---|
106 | return D21;
|
---|
107 | }
|
---|
108 |
|
---|
109 | static void printMatrix(const Matrix& X, int nRow, int nCol) {
|
---|
110 | for (int rr = 0; rr < nRow; rr++) {
|
---|
111 | for (int cc = 0; cc < nCol; cc++) {
|
---|
112 | cout << setw(7) << setprecision(4) << X[rr][cc] << " ";
|
---|
113 | }
|
---|
114 | cout << endl; }
|
---|
115 | cout << endl;
|
---|
116 | }
|
---|
117 | int _firstRow;
|
---|
118 | int _lastRow;
|
---|
119 | Matrix _AA1;
|
---|
120 | Matrix _AA2;
|
---|
121 | bool _firstSys;
|
---|
122 | };
|
---|
123 |
|
---|
124 | t_irc processSystem(const std::vector<t_lc::type>& LCs,
|
---|
125 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
126 | const t_prn& refPrn,
|
---|
127 | bool pseudoObsIonoAvailable,
|
---|
128 | bool preProcessing);
|
---|
129 |
|
---|
130 | t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs,
|
---|
131 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
132 | const t_prn& refPrn,
|
---|
133 | bool preProcessing);
|
---|
134 |
|
---|
135 | t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector,
|
---|
136 | SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0);
|
---|
137 |
|
---|
138 | void cmpDOP(const std::vector<t_pppSatObs*>& obsVector);
|
---|
139 |
|
---|
140 | void predictCovCrdPart(const SymmetricMatrix& QFltOld);
|
---|
141 |
|
---|
142 | t_irc addInfiniteNoise(t_pppParam::e_type para);
|
---|
143 |
|
---|
144 | bncTime _epoTime;
|
---|
145 | t_pppParlist* _parlist;
|
---|
146 | t_pppObsPool* _obsPool;
|
---|
147 | t_datumTrafo* _datumTrafo;
|
---|
148 | SymmetricMatrix _QFlt;
|
---|
149 | ColumnVector _xFlt;
|
---|
150 | ColumnVector _x0;
|
---|
151 | t_slip _slips[t_prn::MAXPRN+1];
|
---|
152 | int _numSat;
|
---|
153 | int _numEpoProcessing;
|
---|
154 | int _numAllUsedLCs;
|
---|
155 | t_dop _dop;
|
---|
156 | bncTime _firstEpoTime;
|
---|
157 | bncTime _lastEpoTimeOK;
|
---|
158 | t_prn _refPrn;
|
---|
159 | };
|
---|
160 |
|
---|
161 | }
|
---|
162 |
|
---|
163 | #endif
|
---|