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

Last change on this file since 10039 was 10039, checked in by stuerze, 12 months ago

revert some changes temporary

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