source: ntrip/branches/BNC_2.13.beta/src/combination/bnccomb.h@ 10212

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