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

Last change on this file since 9636 was 9635, checked in by stuerze, 3 years ago

consideration of incoming Code Biases during clock combination

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