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

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