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