| 1 | // Part of BNC, a utility for retrieving decoding and
|
|---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
|---|
| 3 | //
|
|---|
| 4 | // Copyright (C) 2007
|
|---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
|---|
| 6 | // http://www.bkg.bund.de
|
|---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
|---|
| 8 | // http://www.fsv.cvut.cz
|
|---|
| 9 | //
|
|---|
| 10 | // Email: euref-ip@bkg.bund.de
|
|---|
| 11 | //
|
|---|
| 12 | // This program is free software; you can redistribute it and/or
|
|---|
| 13 | // modify it under the terms of the GNU General Public License
|
|---|
| 14 | // as published by the Free Software Foundation, version 2.
|
|---|
| 15 | //
|
|---|
| 16 | // This program is distributed in the hope that it will be useful,
|
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | // GNU General Public License for more details.
|
|---|
| 20 | //
|
|---|
| 21 | // You should have received a copy of the GNU General Public License
|
|---|
| 22 | // along with this program; if not, write to the Free Software
|
|---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 24 |
|
|---|
| 25 | #ifndef BNCANTEX_H
|
|---|
| 26 | #define BNCANTEX_H
|
|---|
| 27 |
|
|---|
| 28 | #include <QtCore>
|
|---|
| 29 | #include <QString>
|
|---|
| 30 | #include <string>
|
|---|
| 31 | #include <newmat.h>
|
|---|
| 32 | #include "bncconst.h"
|
|---|
| 33 | #include "bnctime.h"
|
|---|
| 34 |
|
|---|
| 35 | class bncAntex {
|
|---|
| 36 | public:
|
|---|
| 37 | bncAntex(const char* fileName);
|
|---|
| 38 | bncAntex();
|
|---|
| 39 | ~bncAntex();
|
|---|
| 40 | t_irc readFile(const QString& fileName);
|
|---|
| 41 | void print() const;
|
|---|
| 42 | QString pcoSinexString(const std::string& antName, t_frequency::type frqType);
|
|---|
| 43 | QString snxCodeSinexString(const std::string& antName);
|
|---|
| 44 | double satCorr(const QString& prn, t_frequency::type frqType,
|
|---|
| 45 | double eleSat, double azSat, bool& found) const;
|
|---|
| 46 | double rcvCorr(const std::string& antName, t_frequency::type frqType,
|
|---|
| 47 | double eleSat, double azSat, bool& found) const;
|
|---|
| 48 |
|
|---|
| 49 | // Attitude model selection for satCoMcorrection().
|
|---|
| 50 | enum e_attMode {
|
|---|
| 51 | ATT_COMPUTED = 0, // full model: GLONASS yaw-fixed + GPS noon/midnight turn
|
|---|
| 52 | ATT_NOMINAL = 1, // simple nominal Sun-pointing only (no maneuver model)
|
|---|
| 53 | ATT_EXTERNAL = 2, // use caller-supplied externalYaw angle [rad]
|
|---|
| 54 | };
|
|---|
| 55 |
|
|---|
| 56 | t_irc satCoMcorrection(const QString& prn, double Mjd,
|
|---|
| 57 | const ColumnVector& xSat, const ColumnVector& vSat,
|
|---|
| 58 | ColumnVector& dx,
|
|---|
| 59 | e_attMode mode = ATT_COMPUTED,
|
|---|
| 60 | double externalYaw = 0.0);
|
|---|
| 61 |
|
|---|
| 62 | // Drain and return diagnostic logs accumulated by the yaw models.
|
|---|
| 63 | // Empty most of the time; only non-empty right after a transition.
|
|---|
| 64 | QString takeGlonassYawLog() {
|
|---|
| 65 | QString s = _glonassYawLog;
|
|---|
| 66 | _glonassYawLog.clear();
|
|---|
| 67 | return s;
|
|---|
| 68 | }
|
|---|
| 69 | QString takeGpsYawLog() {
|
|---|
| 70 | QString s = _gpsYawLog;
|
|---|
| 71 | _gpsYawLog.clear();
|
|---|
| 72 | return s;
|
|---|
| 73 | }
|
|---|
| 74 | QString takeOnYawLog() {
|
|---|
| 75 | QString s = _onYawLog;
|
|---|
| 76 | _onYawLog.clear();
|
|---|
| 77 | return s;
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | private:
|
|---|
| 81 | // Per-satellite GLONASS yaw state: freezes the yaw angle while the
|
|---|
| 82 | // satellite cannot follow the nominal Sun-pointing law (Dilssner 2011).
|
|---|
| 83 | class t_glonassYaw {
|
|---|
| 84 | public:
|
|---|
| 85 | t_glonassYaw() {
|
|---|
| 86 | yaw = 0.0;
|
|---|
| 87 | lastCallMjd = 0.0;
|
|---|
| 88 | valid = false;
|
|---|
| 89 | fixed = false;
|
|---|
| 90 | }
|
|---|
| 91 | double yaw;
|
|---|
| 92 | double lastCallMjd; // Mjd of the most recent call (any branch) for this PRN
|
|---|
| 93 | bool valid;
|
|---|
| 94 | bool fixed; // true while the yaw-fixed override is currently active
|
|---|
| 95 | };
|
|---|
| 96 |
|
|---|
| 97 | // Per-satellite GPS yaw state: rate-limits the yaw during noon/midnight
|
|---|
| 98 | // turns when the required yaw rate exceeds the block's mechanical maximum
|
|---|
| 99 | // (Kouba 2009/2015, Bar-Sever 1996).
|
|---|
| 100 | class t_gpsYaw {
|
|---|
| 101 | public:
|
|---|
| 102 | t_gpsYaw() {
|
|---|
| 103 | yaw = 0.0;
|
|---|
| 104 | lastCallMjd = 0.0;
|
|---|
| 105 | valid = false;
|
|---|
| 106 | inTurn = false;
|
|---|
| 107 | }
|
|---|
| 108 | double yaw;
|
|---|
| 109 | double lastCallMjd;
|
|---|
| 110 | bool valid;
|
|---|
| 111 | bool inTurn; // true while in a constrained noon/midnight turn
|
|---|
| 112 | };
|
|---|
| 113 |
|
|---|
| 114 | // Per-satellite Galileo/BDS yaw state: tracks rate-limited rotation between
|
|---|
| 115 | // yaw-steering (psiNom) and orbit-normal mode (psi=0) when |beta| crosses
|
|---|
| 116 | // the constellation-specific threshold (Kouba 2017, Dai et al. 2015).
|
|---|
| 117 | class t_onYaw {
|
|---|
| 118 | public:
|
|---|
| 119 | t_onYaw() {
|
|---|
| 120 | yaw = 0.0;
|
|---|
| 121 | lastCallMjd = 0.0;
|
|---|
| 122 | valid = false;
|
|---|
| 123 | inON = false;
|
|---|
| 124 | }
|
|---|
| 125 | double yaw;
|
|---|
| 126 | double lastCallMjd;
|
|---|
| 127 | bool valid;
|
|---|
| 128 | bool inON; // true while satellite is in (or transitioning to) orbit-normal mode
|
|---|
| 129 | };
|
|---|
| 130 |
|
|---|
| 131 | QString _glonassYawLog;
|
|---|
| 132 | QString _gpsYawLog;
|
|---|
| 133 | QString _onYawLog;
|
|---|
| 134 |
|
|---|
| 135 | double glonassYawAngle(const QString& prn, double Mjd, const ColumnVector& xSat,
|
|---|
| 136 | const ColumnVector& vSat, const ColumnVector& xSun);
|
|---|
| 137 |
|
|---|
| 138 | double gpsYawAngle(const QString& prn, const QString& blockType, double Mjd,
|
|---|
| 139 | const ColumnVector& xSat, const ColumnVector& vSat,
|
|---|
| 140 | const ColumnVector& xSun);
|
|---|
| 141 |
|
|---|
| 142 | double onModeYawAngle(const QString& prn, double betaThr, double psiDotMax,
|
|---|
| 143 | double Mjd, const ColumnVector& xSat,
|
|---|
| 144 | const ColumnVector& vSat, const ColumnVector& xSun);
|
|---|
| 145 |
|
|---|
| 146 | double galileoYawAngle(const QString& prn, const QString& blockType, double Mjd,
|
|---|
| 147 | const ColumnVector& xSat, const ColumnVector& vSat,
|
|---|
| 148 | const ColumnVector& xSun);
|
|---|
| 149 |
|
|---|
| 150 | double bdsYawAngle(const QString& prn, const QString& blockType, double Mjd,
|
|---|
| 151 | const ColumnVector& xSat, const ColumnVector& vSat,
|
|---|
| 152 | const ColumnVector& xSun);
|
|---|
| 153 |
|
|---|
| 154 | QMap<QString, t_glonassYaw> _glonassYaw;
|
|---|
| 155 | QMap<QString, t_gpsYaw> _gpsYaw;
|
|---|
| 156 | QMap<QString, t_onYaw> _onYaw;
|
|---|
| 157 |
|
|---|
| 158 | class t_frqMap {
|
|---|
| 159 | public:
|
|---|
| 160 | t_frqMap() {
|
|---|
| 161 | for (unsigned ii = 0; ii < 3; ii++) {
|
|---|
| 162 | neu[ii] = 0.0;
|
|---|
| 163 | }
|
|---|
| 164 | }
|
|---|
| 165 | double neu[3];
|
|---|
| 166 | ColumnVector pattern;
|
|---|
| 167 | };
|
|---|
| 168 |
|
|---|
| 169 | class t_antMap {
|
|---|
| 170 | public:
|
|---|
| 171 | t_antMap() {
|
|---|
| 172 | zen1 = 0.0;
|
|---|
| 173 | zen2 = 0.0;
|
|---|
| 174 | dZen = 0.0;
|
|---|
| 175 | snxCode = "";
|
|---|
| 176 | }
|
|---|
| 177 | ~t_antMap() {
|
|---|
| 178 | QMapIterator<t_frequency::type, t_frqMap*> it(frqMap);
|
|---|
| 179 | while (it.hasNext()) {
|
|---|
| 180 | it.next();
|
|---|
| 181 | delete it.value();
|
|---|
| 182 | }
|
|---|
| 183 | }
|
|---|
| 184 | QString antName;
|
|---|
| 185 | QString blockType; // e.g. "IIF", "IIR-M", "IIA", "IIIA" (GPS only)
|
|---|
| 186 | double zen1;
|
|---|
| 187 | double zen2;
|
|---|
| 188 | double dZen;
|
|---|
| 189 | QString snxCode;
|
|---|
| 190 | QMap<t_frequency::type, t_frqMap*> frqMap;
|
|---|
| 191 | bncTime validFrom;
|
|---|
| 192 | bncTime validTo;
|
|---|
| 193 | };
|
|---|
| 194 |
|
|---|
| 195 | QMap<QString, t_antMap*> _maps;
|
|---|
| 196 | };
|
|---|
| 197 |
|
|---|
| 198 | #endif
|
|---|