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

Last change on this file since 9695 was 9695, checked in by stuerze, 2 years ago

minor changes to read the bsx file every 6 hours

File size: 7.4 KB
Line 
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
14class bncRtnetDecoder;
15class bncSP3;
16class bncAntex;
17class bncBiasSnx;
18
19class 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 weight = 0.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 weight;
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 _codeBiasIF = 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 _codeBiasIF;
101 double _dClkResult;
102 ColumnVector _diffRao;
103 QString ID() {return _acName + "_" + _prn;}
104 };
105
106 class cmbEpoch {
107 public:
108 cmbEpoch() {}
109 ~cmbEpoch() {
110 QVectorIterator<cmbCorr*> it(corrs);
111 while (it.hasNext()) {
112 delete it.next();
113 }
114 }
115 QVector<cmbCorr*> corrs;
116 };
117
118 class cmbRefSig {
119 public:
120 enum type {dummy = 0, c1, c2, cIF};
121
122 static t_frequency::type toFreq(char sys, type tt) {
123 switch (tt) {
124 case c1:
125 if (sys == 'G') return t_frequency::G1;
126 else if (sys == 'R') return t_frequency::R1;
127 else if (sys == 'E') return t_frequency::E1;
128 else if (sys == 'C') return t_frequency::C2;
129 else if (sys == 'J') return t_frequency::J1;
130 else if (sys == 'S') return t_frequency::S1;
131 else return t_frequency::dummy;
132 case c2:
133 if (sys == 'G') return t_frequency::G2;
134 else if (sys == 'R') return t_frequency::R2;
135 else if (sys == 'E') return t_frequency::E5;
136 else if (sys == 'C') return t_frequency::C6;
137 else if (sys == 'J') return t_frequency::J2;
138 else if (sys == 'S') return t_frequency::S5;
139 else return t_frequency::dummy;
140 case dummy:
141 case cIF:
142 return t_frequency::dummy;
143 }
144 return t_frequency::dummy;
145 }
146
147 static char toAttrib(char sys, type LC) {
148 switch (LC) {
149 case c1:
150 if (sys == 'G') return 'W';
151 else if (sys == 'R') return 'P';
152 else if (sys == 'E') return 'C';
153 else if (sys == 'C') return 'I';
154 else if (sys == 'J') return 'C';
155 else if (sys == 'S') return 'C';
156 break;
157 case c2:
158 if (sys == 'G') return 'W';
159 else if (sys == 'R') return 'P';
160 else if (sys == 'E') return 'Q';
161 else if (sys == 'C') return 'I';
162 else if (sys == 'J') return 'L';
163 else if (sys == 'S') return 'Q';
164 break;
165 case dummy:
166 case cIF:
167 return '_';
168 break;
169 }
170 return '_';
171 }
172
173 static void coeff(char sys, type tLC, double channel, std::map<t_frequency::type, double>& codeCoeff) {
174 codeCoeff.clear();
175 t_frequency::type fType1 = toFreq(sys, c1);
176 t_frequency::type fType2 = toFreq(sys, c2);
177 double f1 = t_CST::freq(fType1, channel);
178 double f2 = t_CST::freq(fType2, channel);
179 switch (tLC) {
180 case c1:
181 codeCoeff[fType1] = 1.0;
182 return;
183 case c2:
184 codeCoeff[fType2] = 1.0;
185 return;
186 case cIF:
187 codeCoeff[fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
188 codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
189 return;
190 case cmbRefSig::dummy:
191 return;
192 }
193 return;
194 }
195 };
196
197
198 void processEpoch(char sys);
199 t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
200 ColumnVector& dx);
201 t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
202 ColumnVector& dx);
203 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
204 const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr);
205 void dumpResults(const QMap<QString, cmbCorr*>& resCorr);
206 void printResults(QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
207 void switchToLastEph(t_eph* lastEph, cmbCorr* corr);
208 t_irc checkOrbits(char sys, QTextStream& out);
209 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;}
210
211 QMutex _mutex;
212 QList<cmbAC*> _ACs;
213 bncTime _resTime;
214 QMap<char, QVector<cmbParam*>> _params;
215 QMap<char, QMap<bncTime, cmbEpoch>> _buffer;
216 bncRtnetDecoder* _rtnetDecoder;
217 QMap<char, SymmetricMatrix> _QQ;
218 QByteArray _log;
219 bncAntex* _antex;
220 bncBiasSnx* _bsx;
221 double _MAXRES;
222 QMap<char, QString> _masterOrbitAC;
223 QMap<char, unsigned> _masterMissingEpochs;
224 e_method _method;
225 int _cmbSampl;
226 int _ms;
227 QString _cmbRefAttributes;
228 QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections;
229 QMap<QString, QMap<t_prn, t_satCodeBias> > _satCodeBiases;
230 bncEphUser _ephUser;
231 SsrCorr* _ssrCorr;
232 QMap<char, unsigned> _cmbSysPrn;
233 bool _useGps;
234 bool _useGlo;
235 bool _useGal;
236 bool _useBds;
237 bool _useQzss;
238 bool _useSbas;
239 bool _useIrnss;
240};
241
242#define BNC_CMB (bncComb::instance())
243
244#endif
Note: See TracBrowser for help on using the repository browser.