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

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

consideration of incoming Code Biases during clock combination

File size: 7.2 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;
[2927]17
[6443]18class bncComb : public QObject {
[2898]19 Q_OBJECT
20 public:
21 bncComb();
[3297]22 virtual ~bncComb();
[7299]23 static bncComb* instance();
[2918]24 int nStreams() const {return _ACs.size();}
[2898]25
[5583]26 public slots:
27 void slotProviderIDChanged(QString mountPoint);
[6155]28 void slotNewOrbCorrections(QList<t_orbCorr> orbCorrections);
29 void slotNewClkCorrections(QList<t_clkCorr> clkCorrections);
[9530]30 void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
[5583]31
[2898]32 signals:
33 void newMessage(QByteArray msg, bool showOnScreen);
[7085]34 void newOrbCorrections(QList<t_orbCorr>);
35 void newClkCorrections(QList<t_clkCorr>);
[9529]36 void newCodeBiases(QList<t_satCodeBias>);
[2898]37
38 private:
[3470]39 enum e_method{singleEpoch, filter};
40
[6154]41 class cmbParam {
42 public:
[9258]43 enum parType {offACgnss, offACSat, clkSat};
[6154]44 cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_);
45 ~cmbParam();
[9258]46 double partial(char sys, const QString& AC_, const QString& prn_);
47 QString toString(char sys) const;
[6154]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
[2918]59 class cmbAC {
60 public:
[3433]61 cmbAC() {
62 weight = 0.0;
[9258]63 numObs['G'] = 0;
64 numObs['R'] = 0;
65 numObs['E'] = 0;
66 numObs['C'] = 0;
67 numObs['J'] = 0;
68 numObs['S'] = 0;
[9292]69 numObs['I'] = 0;
[3433]70 }
[3430]71 ~cmbAC() {}
[3434]72 QString mountPoint;
73 QString name;
74 double weight;
[9258]75 QMap<char, unsigned> numObs;
[2918]76 };
77
[6155]78 class cmbCorr {
[3423]79 public:
[6155]80 cmbCorr() {
[6160]81 _eph = 0;
82 _iod = 0;
83 _dClkResult = 0.0;
[9635]84 _codeBiasIF = 0.0;
[6155]85 }
[6159]86 ~cmbCorr() {}
[7055]87 QString _prn;
88 bncTime _time;
89 unsigned long _iod;
90 t_eph* _eph;
91 t_orbCorr _orbCorr;
92 t_clkCorr _clkCorr;
[9529]93 t_satCodeBias _satCodeBias;
[7055]94 QString _acName;
[9635]95 double _codeBiasIF;
[7055]96 double _dClkResult;
97 ColumnVector _diffRao;
[6157]98 QString ID() {return _acName + "_" + _prn;}
[3423]99 };
100
[3434]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
[9635]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
[9258]193 void processEpoch(char sys);
194 t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
[3475]195 ColumnVector& dx);
[9258]196 t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
[3475]197 ColumnVector& dx);
[9258]198 t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
[6155]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);
[7011]202 void switchToLastEph(t_eph* lastEph, cmbCorr* corr);
[9258]203 t_irc checkOrbits(char sys, QTextStream& out);
204 QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;}
[2918]205
[9529]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;
[9635]220 QString _cmbRefAttributes;
[9529]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;
[2898]233};
234
[7299]235#define BNC_CMB (bncComb::instance())
236
[2898]237#endif
Note: See TracBrowser for help on using the repository browser.