source: ntrip/trunk/BNC/src/PPP_free/pppFilter.h@ 6100

Last change on this file since 6100 was 6100, checked in by mervart, 10 years ago
File size: 6.2 KB
Line 
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>
30#include <newmat.h>
31
32#include "bncconst.h"
33#include "bnctime.h"
34
35class bncAntex;
36
37namespace BNC_PPP {
38
39class t_pppClient;
40class t_pppOptions;
41class t_epoData;
42class t_satData;
43class t_tides;
44
45class 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 }
58 ~t_satData() {}
59 bncTime tt;
60 QString prn;
61 double P1;
62 double P2;
63 double P5;
64 double P3;
65 double L1;
66 double L2;
67 double L5;
68 double L3;
69 ColumnVector xx;
70 ColumnVector vv;
71 double clk;
72 double eleSat;
73 double azSat;
74 double rho;
75 bool slipFlag;
76 double lambda3;
77 unsigned obsIndex;
78 char system() const {return prn.toAscii()[0];}
79};
80
81class t_epoData {
82 public:
83 t_epoData() {}
84
85 ~t_epoData() {
86 clear();
87 }
88
89 void clear() {
90 QMapIterator<QString, t_satData*> it(satData);
91 while (it.hasNext()) {
92 it.next();
93 delete it.value();
94 }
95 satData.clear();
96 tt.reset();
97 }
98
99 void deepCopy(const t_epoData* from) {
100 clear();
101 tt = from->tt;
102 QMapIterator<QString, t_satData*> it(from->satData);
103 while (it.hasNext()) {
104 it.next();
105 satData[it.key()] = new t_satData(*it.value());
106 }
107 }
108
109 unsigned sizeSys(char system) const {
110 unsigned ans = 0;
111 QMapIterator<QString, t_satData*> it(satData);
112 while (it.hasNext()) {
113 it.next();
114 if (it.value()->system() == system) {
115 ++ans;
116 }
117 }
118 return ans;
119 }
120 unsigned sizeAll() const {return satData.size();}
121
122 bncTime tt;
123 QMap<QString, t_satData*> satData;
124};
125
126class t_pppParam {
127 public:
128 enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
129 GLONASS_OFFSET, GALILEO_OFFSET};
130 t_pppParam(parType typeIn, int indexIn, const QString& prn);
131 ~t_pppParam();
132 double partial(t_satData* satData, bool phase);
133 bool isCrd() const {
134 return (type == CRD_X || type == CRD_Y || type == CRD_Z);
135 }
136 parType type;
137 double xx;
138 int index;
139 int index_old;
140 int numEpo;
141 QString prn;
142};
143
144class t_pppFilter {
145 public:
146 t_pppFilter(t_pppClient* pppClient);
147 ~t_pppFilter();
148 t_irc update(t_epoData* epoData);
149 bncTime time() const {return _time;}
150 double x() const {return _params[0]->xx;}
151 double y() const {return _params[1]->xx;}
152 double z() const {return _params[2]->xx;}
153 double clk() const {return _params[3]->xx;}
154 double trp() const {
155 for (int ii = 0; ii < _params.size(); ++ii) {
156 t_pppParam* pp = _params[ii];
157 if (pp->type == t_pppParam::TROPO) {
158 return pp->xx;
159 }
160 }
161 return 0.0;
162 }
163 double Glonass_offset() const {
164 for (int ii = 0; ii < _params.size(); ++ii) {
165 t_pppParam* pp = _params[ii];
166 if (pp->type == t_pppParam::GLONASS_OFFSET) {
167 return pp->xx;
168 }
169 }
170 return 0.0;
171 }
172 double Galileo_offset() const {
173 for (int ii = 0; ii < _params.size(); ++ii) {
174 t_pppParam* pp = _params[ii];
175 if (pp->type == t_pppParam::GALILEO_OFFSET) {
176 return pp->xx;
177 }
178 }
179 return 0.0;
180 }
181
182 static void kalman(const Matrix& AA, const ColumnVector& ll,
183 const DiagonalMatrix& PP,
184 SymmetricMatrix& QQ, ColumnVector& dx);
185
186 private:
187 void reset();
188 t_irc cmpBancroft(t_epoData* epoData);
189 void cmpEle(t_satData* satData);
190 void addAmb(t_satData* satData);
191 void addObs(int iPhase, unsigned& iObs, t_satData* satData,
192 Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
193 QByteArray printRes(int iPhase, const ColumnVector& vv,
194 const QMap<QString, t_satData*>& satDataMap);
195 void findMaxRes(const ColumnVector& vv,
196 const QMap<QString, t_satData*>& satData,
197 QString& prnGPS, QString& prnGlo,
198 double& maxResGPS, double& maxResGlo);
199 double cmpValue(t_satData* satData, bool phase);
200 double delay_saast(double Ele);
201 void predict(int iPhase, t_epoData* epoData);
202 t_irc update_p(t_epoData* epoData);
203 QString outlierDetection(int iPhase, const ColumnVector& vv,
204 QMap<QString, t_satData*>& satData);
205
206 double windUp(const QString& prn, const ColumnVector& rSat,
207 const ColumnVector& rRec);
208
209 bncTime _startTime;
210
211 void rememberState(t_epoData* epoData);
212 void restoreState(t_epoData* epoData);
213
214 t_irc selectSatellites(const QString& lastOutlierPrn,
215 QMap<QString, t_satData*>& satData);
216
217 void bancroft(const Matrix& BBpass, ColumnVector& pos);
218
219 t_pppClient* _pppClient;
220 bncTime _time;
221 bncTime _lastTimeOK;
222 QVector<t_pppParam*> _params;
223 SymmetricMatrix _QQ;
224 QVector<t_pppParam*> _params_sav;
225 SymmetricMatrix _QQ_sav;
226 t_epoData* _epoData_sav;
227 ColumnVector _xcBanc;
228 ColumnVector _ellBanc;
229 QMap<QString, double> _windUpTime;
230 QMap<QString, double> _windUpSum;
231 QStringList _outlierGPS;
232 QStringList _outlierGlo;
233 bncAntex* _antex;
234 t_tides* _tides;
235};
236
237}
238
239#endif
Note: See TracBrowser for help on using the repository browser.