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