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

Last change on this file since 10038 was 10038, checked in by stuerze, 14 months ago

minor changes

File size: 8.4 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 virtual ~bncComb();
25 static bncComb* instance();
26 int nStreams() const {return _ACs.size();}
27
28 public slots:
29 void slotProviderIDChanged(QString mountPoint);
30 void slotNewOrbCorrections(QList<t_orbCorr> orbCorrections);
31 void slotNewClkCorrections(QList<t_clkCorr> clkCorrections);
32 void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
33
34
35 private slots:
36 void slotReadBiasSnxFile();
37
38 signals:
39 void newMessage(QByteArray msg, bool showOnScreen);
40 void newOrbCorrections(QList<t_orbCorr>);
41 void newClkCorrections(QList<t_clkCorr>);
42 void newCodeBiases(QList<t_satCodeBias>);
43
44 private:
45 static bncComb* _instPtr; // The one, single instance
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 class cmbRefSig {
145 public:
146 enum type {dummy = 0, c1, c2, cIF};
147
148 static t_frequency::type toFreq(char sys, type tt) {
149 switch (tt) {
150 case c1:
151 if (sys == 'G') return t_frequency::G1;
152 else if (sys == 'R') return t_frequency::R1;
153 else if (sys == 'E') return t_frequency::E1;
154 else if (sys == 'C') return t_frequency::C2;
155 else if (sys == 'J') return t_frequency::J1;
156 else if (sys == 'S') return t_frequency::S1;
157 else return t_frequency::dummy;
158 case c2:
159 if (sys == 'G') return t_frequency::G2;
160 else if (sys == 'R') return t_frequency::R2;
161 else if (sys == 'E') return t_frequency::E5;
162 else if (sys == 'C') return t_frequency::C6;
163 else if (sys == 'J') return t_frequency::J2;
164 else if (sys == 'S') return t_frequency::S5;
165 else return t_frequency::dummy;
166 case dummy:
167 case cIF:
168 return t_frequency::dummy;
169 }
170 return t_frequency::dummy;
171 }
172
173 static char toAttrib(char sys, type LC) {
174 switch (LC) {
175 case c1:
176 if (sys == 'G') return 'W';
177 else if (sys == 'R') return 'P';
178 else if (sys == 'E') return 'C';
179 else if (sys == 'C') return 'I';
180 else if (sys == 'J') return 'C';
181 else if (sys == 'S') return 'C';
182 break;
183 case c2:
184 if (sys == 'G') return 'W';
185 else if (sys == 'R') return 'P';
186 else if (sys == 'E') return 'Q';
187 else if (sys == 'C') return 'I';
188 else if (sys == 'J') return 'L';
189 else if (sys == 'S') return 'Q';
190 break;
191 case dummy:
192 case cIF:
193 return '_';
194 break;
195 }
196 return '_';
197 }
198
199 static void coeff(char sys, type tLC, double channel, std::map<t_frequency::type, double>& codeCoeff) {
200 codeCoeff.clear();
201 t_frequency::type fType1 = toFreq(sys, c1);
202 t_frequency::type fType2 = toFreq(sys, c2);
203 double f1 = t_CST::freq(fType1, channel);
204 double f2 = t_CST::freq(fType2, channel);
205 switch (tLC) {
206 case c1:
207 codeCoeff[fType1] = 1.0;
208 return;
209 case c2:
210 codeCoeff[fType2] = 1.0;
211 return;
212 case cIF:
213 codeCoeff[fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
214 codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
215 return;
216 case cmbRefSig::dummy:
217 return;
218 }
219 return;
220 }
221 };
222
223 void processEpoch(bncTime epoTime, const std::vector<t_clkCorr*>& clkCorrVec);
224 void processSystem(bncTime epoTime, char sys, QTextStream& out);
225 t_irc processEpoch_filter(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
226 t_irc processEpoch_singleEpoch(bncTime epoTime, char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr, ColumnVector& dx);
227 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
228 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr);
229 void dumpResults(bncTime epoTime, const QMap<QString, cmbCorr*>& resCorr);
230 void printResults(bncTime epoTime, QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
231 void switchToLastEph(t_eph* lastEph, cmbCorr* corr);
232 t_irc checkOrbits(bncTime epoTime, char sys, QTextStream& out);
233 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys].corrs;}
234
235 QMutex _mutex;
236 QList<cmbAC*> _ACs;
237 std::deque<epoClkData*> _epoClkData;
238 bncTime _lastClkCorrTime;
239 QMap<char, QVector<cmbParam*>> _params;
240 QMap<char, cmbEpoch> _buffer;
241 bncRtnetDecoder* _rtnetDecoder;
242 QMap<char, SymmetricMatrix> _QQ;
243 QByteArray _log;
244 bncAntex* _antex;
245 bncBiasSnx* _bsx;
246 double _MAXRES;
247 QMap<char, QString> _masterOrbitAC;
248 QMap<char, unsigned> _masterMissingEpochs;
249 e_method _method;
250 int _cmbSampl;
251 int _ms;
252 QString _cmbRefAttributes;
253 QMap<QString, QMap<t_prn, t_orbCorr*> > _orbCorrections;
254 QMap<QString, QMap<t_prn, t_satCodeBias*> > _satCodeBiases;
255 bncEphUser _ephUser;
256 SsrCorr* _ssrCorr;
257 QMap<char, unsigned> _cmbSysPrn;
258 bool _useGps;
259 bool _useGlo;
260 bool _useGal;
261 bool _useBds;
262 bool _useQzss;
263 bool _useSbas;
264 bool _useIrnss;
265};
266
267#define BNC_CMB (bncComb::instance())
268
269#endif
Note: See TracBrowser for help on using the repository browser.