source: ntrip/trunk/BNC/src/combination/bnccomb.h@ 10042

Last change on this file since 10042 was 10042, checked in by stuerze, 11 months ago

minor changes

File size: 8.6 KB
Line 
1
2#ifndef BNCCOMB_H
3#define BNCCOMB_H
4
5#include <fstream>
6#include <iostream>
7#include <map>
8#include <newmat.h>
9#include <deque>
10#include "bncephuser.h"
11#include "satObs.h"
12#include "bncconst.h"
13#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
14#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
15
16class bncRtnetDecoder;
17class bncSP3;
18class bncAntex;
19class bncBiasSnx;
20
21class bncComb : public QObject {
22 Q_OBJECT
23 public:
24 static bncComb* getInstance() {
25 if (instance == 0) {
26 instance = new bncComb;
27 }
28 return instance;
29 }
30 bncComb(const bncComb&) = delete;
31 bncComb& operator=(const bncComb&) = delete;
32 static void destruct() {
33 delete instance;
34 instance = nullptr;
35 }
36 int nStreams() const {return _ACs.size();}
37
38 public slots:
39 void slotProviderIDChanged(QString mountPoint);
40 void slotNewOrbCorrections(QList<t_orbCorr> orbCorrections);
41 void slotNewClkCorrections(QList<t_clkCorr> clkCorrections);
42 void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
43
44 private slots:
45 void slotReadBiasSnxFile();
46
47 signals:
48 void newMessage(QByteArray msg, bool showOnScreen);
49 void newOrbCorrections(QList<t_orbCorr>);
50 void newClkCorrections(QList<t_clkCorr>);
51 void newCodeBiases(QList<t_satCodeBias>);
52
53 private:
54 bncComb(); // no public constructor
55 ~bncComb(); // no public destructor
56 static bncComb* instance; // declaration class variable
57 enum e_method{singleEpoch, filter};
58
59 class cmbParam {
60 public:
61 enum parType {offACgnss, offACSat, clkSat};
62 cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_);
63 ~cmbParam();
64 double partial(char sys, const QString& AC_, const QString& prn_);
65 QString toString(char sys) const;
66 parType type;
67 int index;
68 QString AC;
69 QString prn;
70 double xx;
71 double sig0;
72 double sigP;
73 bool epoSpec;
74 const t_eph* eph;
75 };
76
77 class cmbAC {
78 public:
79 cmbAC() {
80 weightFactor = 1.0;
81 numObs['G'] = 0;
82 numObs['R'] = 0;
83 numObs['E'] = 0;
84 numObs['C'] = 0;
85 numObs['J'] = 0;
86 numObs['S'] = 0;
87 numObs['I'] = 0;
88 }
89 ~cmbAC() {}
90 QString mountPoint;
91 QString name;
92 double weightFactor;
93 QMap<char, unsigned> numObs;
94 };
95
96 class cmbCorr {
97 public:
98 cmbCorr() {
99 _eph = 0;
100 _orbCorr = 0;
101 _clkCorr = 0;
102 _satCodeBias = 0;
103 _iod = 0;
104 _dClkResult = 0.0;
105 _satCodeBiasIF = 0.0;
106 _weightFactor = 1.0;
107 }
108 ~cmbCorr() {}
109 QString _prn;
110 bncTime _time;
111 unsigned long _iod;
112 t_eph* _eph;
113 t_orbCorr* _orbCorr;
114 t_clkCorr* _clkCorr;
115 t_satCodeBias* _satCodeBias;
116 QString _acName;
117 double _satCodeBiasIF;
118 double _dClkResult;
119 ColumnVector _diffRao;
120 double _weightFactor;
121 QString ID() {return _acName + "_" + _prn;}
122 };
123
124 class cmbEpoch {
125 public:
126 cmbEpoch() {}
127 ~cmbEpoch() {
128 clear();
129 }
130 void clear() {
131 QVectorIterator<cmbCorr*> it(corrs);
132 while (it.hasNext()) {
133 delete it.next();
134 }
135 }
136 QVector<cmbCorr*> corrs;
137 };
138
139 class epoClkData {
140 public:
141 epoClkData() {}
142 ~epoClkData() {
143 for (unsigned ii = 0; ii < _clkCorr.size(); ii++) {
144 delete _clkCorr[ii];
145 }
146 }
147 bncTime _time;
148 std::vector<t_clkCorr*> _clkCorr;
149 };
150
151
152
153 class cmbRefSig {
154 public:
155 enum type {dummy = 0, c1, c2, cIF};
156
157 static t_frequency::type toFreq(char sys, type tt) {
158 switch (tt) {
159 case c1:
160 if (sys == 'G') return t_frequency::G1;
161 else if (sys == 'R') return t_frequency::R1;
162 else if (sys == 'E') return t_frequency::E1;
163 else if (sys == 'C') return t_frequency::C2;
164 else if (sys == 'J') return t_frequency::J1;
165 else if (sys == 'S') return t_frequency::S1;
166 else return t_frequency::dummy;
167 case c2:
168 if (sys == 'G') return t_frequency::G2;
169 else if (sys == 'R') return t_frequency::R2;
170 else if (sys == 'E') return t_frequency::E5;
171 else if (sys == 'C') return t_frequency::C6;
172 else if (sys == 'J') return t_frequency::J2;
173 else if (sys == 'S') return t_frequency::S5;
174 else return t_frequency::dummy;
175 case dummy:
176 case cIF:
177 return t_frequency::dummy;
178 }
179 return t_frequency::dummy;
180 }
181
182 static char toAttrib(char sys, type LC) {
183 switch (LC) {
184 case c1:
185 if (sys == 'G') return 'W';
186 else if (sys == 'R') return 'P';
187 else if (sys == 'E') return 'C';
188 else if (sys == 'C') return 'I';
189 else if (sys == 'J') return 'C';
190 else if (sys == 'S') return 'C';
191 break;
192 case c2:
193 if (sys == 'G') return 'W';
194 else if (sys == 'R') return 'P';
195 else if (sys == 'E') return 'Q';
196 else if (sys == 'C') return 'I';
197 else if (sys == 'J') return 'L';
198 else if (sys == 'S') return 'Q';
199 break;
200 case dummy:
201 case cIF:
202 return '_';
203 break;
204 }
205 return '_';
206 }
207
208 static void coeff(char sys, type tLC, double channel, std::map<t_frequency::type, double>& codeCoeff) {
209 codeCoeff.clear();
210 t_frequency::type fType1 = toFreq(sys, c1);
211 t_frequency::type fType2 = toFreq(sys, c2);
212 double f1 = t_CST::freq(fType1, channel);
213 double f2 = t_CST::freq(fType2, channel);
214 switch (tLC) {
215 case c1:
216 codeCoeff[fType1] = 1.0;
217 return;
218 case c2:
219 codeCoeff[fType2] = 1.0;
220 return;
221 case cIF:
222 codeCoeff[fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
223 codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
224 return;
225 case cmbRefSig::dummy:
226 return;
227 }
228 return;
229 }
230 };
231
232 void processEpoch(bncTime epoTime, const std::vector<t_clkCorr*>& clkCorrVec);
233 void processSystem(bncTime epoTime, char sys, QTextStream& out);
234 t_irc processEpoch_filter(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
235 t_irc processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
236 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
237 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr);
238 void dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr);
239 void printResults(bncTime epoTime, QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
240 void switchToLastEph(t_eph* lastEph, cmbCorr* corr);
241 t_irc checkOrbits(bncTime epoTime, char sys, QTextStream& out);
242 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys].corrs;}
243
244 QMutex _mutex;
245 QList<cmbAC*> _ACs;
246 std::deque<epoClkData*> _epoClkData;
247 bncTime _lastClkCorrTime;
248 bncTime _resTime;
249 QMap<char, QVector<cmbParam*>> _params;
250 QMap<char, cmbEpoch> _buffer;
251 bncRtnetDecoder* _rtnetDecoder;
252 QMap<char, SymmetricMatrix> _QQ;
253 QByteArray _log;
254 bncAntex* _antex;
255 bncBiasSnx* _bsx;
256 double _MAXRES;
257 QMap<char, QString> _masterOrbitAC;
258 QMap<char, unsigned> _masterMissingEpochs;
259 e_method _method;
260 int _cmbSampl;
261 int _ms;
262 QString _cmbRefAttributes;
263 QMap<QString, QMap<t_prn, t_orbCorr*> > _orbCorrections;
264 QMap<QString, QMap<t_prn, t_satCodeBias*> > _satCodeBiases;
265 bncEphUser _ephUser;
266 SsrCorr* _ssrCorr;
267 QMap<char, unsigned> _cmbSysPrn;
268 bool _useGps;
269 bool _useGlo;
270 bool _useGal;
271 bool _useBds;
272 bool _useQzss;
273 bool _useSbas;
274 bool _useIrnss;
275};
276
277#define BNC_CMB (bncComb::getInstance())
278
279#endif
Note: See TracBrowser for help on using the repository browser.