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 | #include "pppClient.h"
|
---|
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:
|
---|
20 | t_pppFilter(t_pppObsPool* obsPool);
|
---|
21 | ~t_pppFilter();
|
---|
22 |
|
---|
23 | t_irc processEpoch();
|
---|
24 |
|
---|
25 | t_irc datumTransformation();
|
---|
26 | void initDatumTransformation(const std::vector<t_pppSatObs*>& allObs);
|
---|
27 |
|
---|
28 | const ColumnVector& x() const {return _xFlt;}
|
---|
29 | const SymmetricMatrix& Q() const {return _QFlt;}
|
---|
30 |
|
---|
31 | int numSat() const {return _numSat;}
|
---|
32 | double HDOP() const {return _dop.H;}
|
---|
33 | double HDOV() const {return _dop.V;}
|
---|
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();}
|
---|
71 | void reset() {H = V = P = T = G = 0.0;}
|
---|
72 | double H;
|
---|
73 | double V;
|
---|
74 | double P;
|
---|
75 | double T;
|
---|
76 | double G;
|
---|
77 | };
|
---|
78 |
|
---|
79 | class t_datumTrafo {
|
---|
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;}
|
---|
85 | void updateIndices(int maxObsSys) {
|
---|
86 | if (firstSystem()) {
|
---|
87 | initIndices();
|
---|
88 | }
|
---|
89 | else {
|
---|
90 | _firstRow = _lastRow + 1;
|
---|
91 | }
|
---|
92 | _lastRow += maxObsSys;
|
---|
93 |
|
---|
94 | };
|
---|
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;
|
---|
105 | }
|
---|
106 |
|
---|
107 | void prepareAA(const Matrix& AA, int ind) {
|
---|
108 | Matrix* Prep = &_AA2;
|
---|
109 | if (ind == 1) {
|
---|
110 | Prep = &_AA1;
|
---|
111 | }
|
---|
112 | Prep->SubMatrix(_firstRow, _lastRow, 1, _numPar) << AA;
|
---|
113 | }
|
---|
114 | void switchAA() {
|
---|
115 | _AA1 = _AA2;
|
---|
116 | }
|
---|
117 | Matrix& getAA(int ind) {
|
---|
118 | if (ind == 1) {
|
---|
119 | return _AA1;
|
---|
120 | }
|
---|
121 | return _AA2;
|
---|
122 | }
|
---|
123 | Matrix computeTrafoMatrix() {
|
---|
124 | Matrix D21 = ((_AA2.t() * _AA2).i()) * _AA2.t() * _AA1;
|
---|
125 | return D21;
|
---|
126 | }
|
---|
127 | void printMatrix(const Matrix& X, int nRow, int nCol) {
|
---|
128 | for (int rr = 0; rr < nRow; rr++) {
|
---|
129 | for (int cc = 0; cc < nCol; cc++) {
|
---|
130 | LOG << setw(6) << setprecision(3) << X[rr][cc] << " ;";
|
---|
131 | }
|
---|
132 | LOG << endl;
|
---|
133 | }
|
---|
134 | LOG << endl;
|
---|
135 | }
|
---|
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;
|
---|
145 | };
|
---|
146 |
|
---|
147 | t_irc processSystem(const std::vector<t_lc::type>& LCs,
|
---|
148 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
149 | const t_prn& refPrn,
|
---|
150 | bool pseudoObsIonoAvailable,
|
---|
151 | bool preProcessing);
|
---|
152 |
|
---|
153 | t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs,
|
---|
154 | const std::vector<t_pppSatObs*>& obsVector,
|
---|
155 | const t_prn& refPrn,
|
---|
156 | bool preProcessing);
|
---|
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 |
|
---|
165 | t_irc addNoiseToIono(char sys);
|
---|
166 |
|
---|
167 | bool resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector);
|
---|
168 |
|
---|
169 | bncTime _epoTime;
|
---|
170 | t_pppParlist* _parlist;
|
---|
171 | t_pppObsPool* _obsPool;
|
---|
172 | t_datumTrafo* _datumTrafo;
|
---|
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;
|
---|
180 | bncTime _lastEpoTimeOK;
|
---|
181 | t_prn _refPrn;
|
---|
182 | };
|
---|
183 |
|
---|
184 | }
|
---|
185 |
|
---|
186 | #endif
|
---|