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