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

Last change on this file since 10113 was 10096, checked in by stuerze, 20 months ago

minor changes

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