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

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

minor chenges to allow streams without code biases within the combination

File size: 7.5 KB
RevLine 
[2898]1
2#ifndef BNCCOMB_H
3#define BNCCOMB_H
4
[3035]5#include <fstream>
[9635]6#include <map>
[2933]7#include <newmat.h>
[2906]8#include "bncephuser.h"
[6141]9#include "satObs.h"
[9635]10#include "bncconst.h"
[9025]11#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
12#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
[2898]13
[3201]14class bncRtnetDecoder;
[3181]15class bncSP3;
[3052]16class bncAntex;
[9676]17class bncBiasSnx;
[2927]18
[6443]19class bncComb : public QObject {
[2898]20 Q_OBJECT
21 public:
22 bncComb();
[3297]23 virtual ~bncComb();
[7299]24 static bncComb* instance();
[2918]25 int nStreams() const {return _ACs.size();}
[2898]26
[5583]27 public slots:
28 void slotProviderIDChanged(QString mountPoint);
[6155]29 void slotNewOrbCorrections(QList<t_orbCorr> orbCorrections);
30 void slotNewClkCorrections(QList<t_clkCorr> clkCorrections);
[9530]31 void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
[5583]32
[9676]33
34 private slots:
35 void slotReadBiasSnxFile();
36
[2898]37 signals:
38 void newMessage(QByteArray msg, bool showOnScreen);
[7085]39 void newOrbCorrections(QList<t_orbCorr>);
40 void newClkCorrections(QList<t_clkCorr>);
[9529]41 void newCodeBiases(QList<t_satCodeBias>);
[2898]42
43 private:
[3470]44 enum e_method{singleEpoch, filter};
45
[6154]46 class cmbParam {
47 public:
[9258]48 enum parType {offACgnss, offACSat, clkSat};
[6154]49 cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_);
50 ~cmbParam();
[9258]51 double partial(char sys, const QString& AC_, const QString& prn_);
52 QString toString(char sys) const;
[6154]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
[2918]64 class cmbAC {
65 public:
[3433]66 cmbAC() {
67 weight = 0.0;
[9258]68 numObs['G'] = 0;
69 numObs['R'] = 0;
70 numObs['E'] = 0;
71 numObs['C'] = 0;
72 numObs['J'] = 0;
73 numObs['S'] = 0;
[9292]74 numObs['I'] = 0;
[3433]75 }
[3430]76 ~cmbAC() {}
[3434]77 QString mountPoint;
78 QString name;
79 double weight;
[9258]80 QMap<char, unsigned> numObs;
[2918]81 };
82
[6155]83 class cmbCorr {
[3423]84 public:
[6155]85 cmbCorr() {
[9819]86 _eph = 0;
87 _iod = 0;
88 _dClkResult = 0.0;
89 _satCodeBiasIF = 0.0;
[6155]90 }
[6159]91 ~cmbCorr() {}
[9676]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;
[9819]100 double _satCodeBiasIF;
[9676]101 double _dClkResult;
102 ColumnVector _diffRao;
[6157]103 QString ID() {return _acName + "_" + _prn;}
[3423]104 };
105
[3434]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
[9676]118 class cmbRefSig {
[9635]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;
[9676]190 case cmbRefSig::dummy:
[9635]191 return;
192 }
193 return;
194 }
195 };
196
197
[9258]198 void processEpoch(char sys);
199 t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
[3475]200 ColumnVector& dx);
[9258]201 t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
[3475]202 ColumnVector& dx);
[9258]203 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
[6155]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);
[7011]207 void switchToLastEph(t_eph* lastEph, cmbCorr* corr);
[9258]208 t_irc checkOrbits(char sys, QTextStream& out);
209 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;}
[2918]210
[9529]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;
[9676]220 bncBiasSnx* _bsx;
[9529]221 double _MAXRES;
222 QMap<char, QString> _masterOrbitAC;
223 QMap<char, unsigned> _masterMissingEpochs;
224 e_method _method;
225 int _cmbSampl;
[9695]226 int _ms;
[9635]227 QString _cmbRefAttributes;
[9529]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;
[2898]240};
241
[7299]242#define BNC_CMB (bncComb::instance())
243
[2898]244#endif
Note: See TracBrowser for help on using the repository browser.