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

Last change on this file since 10232 was 10229, checked in by stuerze, 22 months ago

minor changes

File size: 8.7 KB
RevLine 
[2898]1
2#ifndef BNCCOMB_H
3#define BNCCOMB_H
4
[3035]5#include <fstream>
[10038]6#include <iostream>
[10227]7#include <unistd.h>
[9635]8#include <map>
[2933]9#include <newmat.h>
[10038]10#include <deque>
[2906]11#include "bncephuser.h"
[6141]12#include "satObs.h"
[9635]13#include "bncconst.h"
[9025]14#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
15#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
[2898]16
[3201]17class bncRtnetDecoder;
[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;
[10116]88 isAPC = false;
[3433]89 }
[10229]90 ~cmbAC() {
91 numObs.clear();
92 }
[3434]93 QString mountPoint;
94 QString name;
[9821]95 double weightFactor;
[10116]96 bool isAPC;
[9258]97 QMap<char, unsigned> numObs;
[2918]98 };
99
[6155]100 class cmbCorr {
[3423]101 public:
[6155]102 cmbCorr() {
[9819]103 _eph = 0;
104 _iod = 0;
105 _dClkResult = 0.0;
106 _satCodeBiasIF = 0.0;
[10038]107 _weightFactor = 1.0;
[6155]108 }
[10224]109 ~cmbCorr() {
110 }
[9676]111 QString _prn;
112 bncTime _time;
113 unsigned long _iod;
114 t_eph* _eph;
[10216]115 t_orbCorr _orbCorr;
[10225]116 t_clkCorr _clkCorr;
[10216]117 t_satCodeBias _satCodeBias;
[9676]118 QString _acName;
[9819]119 double _satCodeBiasIF;
[9676]120 double _dClkResult;
121 ColumnVector _diffRao;
[9821]122 double _weightFactor;
[6157]123 QString ID() {return _acName + "_" + _prn;}
[3423]124 };
125
[3434]126 class cmbEpoch {
127 public:
128 cmbEpoch() {}
129 ~cmbEpoch() {
[10038]130 clear();
131 }
132 void clear() {
[3434]133 QVectorIterator<cmbCorr*> it(corrs);
134 while (it.hasNext()) {
135 delete it.next();
136 }
137 }
138 QVector<cmbCorr*> corrs;
139 };
140
[10038]141 class epoClkData {
142 public:
143 epoClkData() {}
144 ~epoClkData() {
[10225]145 _clkCorr.erase(_clkCorr.begin(), _clkCorr.end());
[10038]146 }
147 bncTime _time;
[10225]148 std::vector<t_clkCorr> _clkCorr;
[10038]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
[10225]232 void processEpoch(bncTime epoTime, const std::vector<t_clkCorr>& clkCorrVec);
[10038]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);
[10229]238 void dumpResults(bncTime epoTime, QMap<QString, cmbCorr*>& resCorr);
[10038]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;
[10227]249 cmbCorr* _newCorr;
[9529]250 bncRtnetDecoder* _rtnetDecoder;
251 QByteArray _log;
252 bncAntex* _antex;
[9676]253 bncBiasSnx* _bsx;
[9529]254 double _MAXRES;
[10216]255 e_method _method;
256 int _cmbSampl;
257 int _ms;
[10229]258 QMap<char, cmbEpoch> _buffer;
259 QMap<char, SymmetricMatrix> _QQ;
[9529]260 QMap<char, QString> _masterOrbitAC;
261 QMap<char, unsigned> _masterMissingEpochs;
[10116]262 QMap<char, bool> _masterIsAPC;
[10216]263 QMap<char, QVector<cmbParam*>> _params;
264 QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections;
265 QMap<QString, QMap<t_prn, t_satCodeBias> > _satCodeBiases;
266 QMap<char, unsigned> _cmbSysPrn;
[9529]267 bncEphUser _ephUser;
268 SsrCorr* _ssrCorr;
[10229]269 QString _cmbRefAttributes;
[9529]270 bool _useGps;
271 bool _useGlo;
272 bool _useGal;
273 bool _useBds;
274 bool _useQzss;
275 bool _useSbas;
276 bool _useIrnss;
[10227]277 bool _running;
[2898]278};
279
[10040]280#define BNC_CMB (bncComb::getInstance())
[7299]281
[2898]282#endif
Note: See TracBrowser for help on using the repository browser.