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