| 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 | /* -------------------------------------------------------------------------
|
|---|
| 26 | * BKG NTRIP Client
|
|---|
| 27 | * -------------------------------------------------------------------------
|
|---|
| 28 | *
|
|---|
| 29 | * Class: t_pppOptions
|
|---|
| 30 | *
|
|---|
| 31 | * Purpose: Options for PPP client
|
|---|
| 32 | *
|
|---|
| 33 | * Author: L. Mervart
|
|---|
| 34 | *
|
|---|
| 35 | * Created: 29-Jul-2014
|
|---|
| 36 | *
|
|---|
| 37 | * Changes:
|
|---|
| 38 | *
|
|---|
| 39 | * -----------------------------------------------------------------------*/
|
|---|
| 40 |
|
|---|
| 41 | #include <QtCore>
|
|---|
| 42 | #include <set>
|
|---|
| 43 | #include <newmatio.h>
|
|---|
| 44 | #include "pppOptions.h"
|
|---|
| 45 |
|
|---|
| 46 | using namespace BNC_PPP;
|
|---|
| 47 | using namespace std;
|
|---|
| 48 |
|
|---|
| 49 | // Constructor
|
|---|
| 50 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 51 | t_pppOptions::t_pppOptions() {
|
|---|
| 52 | _xyzAprRover.ReSize(3); _xyzAprRover = 0.0;
|
|---|
| 53 | _neuEccRover.ReSize(3); _neuEccRover = 0.0;
|
|---|
| 54 | _aprSigCrd.ReSize(3); _aprSigCrd = 0.0;
|
|---|
| 55 | _noiseCrd.ReSize(3); _noiseCrd = 0.0;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | // Destructor
|
|---|
| 59 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 60 | t_pppOptions::~t_pppOptions() {
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | //
|
|---|
| 64 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 65 | const std::vector<t_lc>& t_pppOptions::LCs(char system) const {
|
|---|
| 66 |
|
|---|
| 67 | if (system == 'R') {
|
|---|
| 68 | return _LCsGLONASS;
|
|---|
| 69 | }
|
|---|
| 70 | else if (system == 'E') {
|
|---|
| 71 | return _LCsGalileo;
|
|---|
| 72 | }
|
|---|
| 73 | else if (system == 'C') {
|
|---|
| 74 | return _LCsBDS;
|
|---|
| 75 | }
|
|---|
| 76 | else {
|
|---|
| 77 | return _LCsGPS;
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | //
|
|---|
| 82 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 83 | bool t_pppOptions::useOrbClkCorr() const {
|
|---|
| 84 | if (_realTime) {
|
|---|
| 85 | return !_corrMount.empty();
|
|---|
| 86 | }
|
|---|
| 87 | else {
|
|---|
| 88 | return !_corrFile.empty();
|
|---|
| 89 | }
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | // Processed satellite systems
|
|---|
| 93 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 94 | vector<char> t_pppOptions::systems() const {
|
|---|
| 95 | vector<char> answ;
|
|---|
| 96 | if (_LCsGPS.size() > 0) answ.push_back('G');
|
|---|
| 97 | if (_LCsGLONASS.size() > 0) answ.push_back('R');
|
|---|
| 98 | if (_LCsGalileo.size() > 0) answ.push_back('E');
|
|---|
| 99 | if (_LCsBDS.size() > 0) answ.push_back('C');
|
|---|
| 100 | return answ;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | //
|
|---|
| 104 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 105 | vector<t_lc> t_pppOptions::ambLCs(char system) const {
|
|---|
| 106 |
|
|---|
| 107 | set<t_frequency::type> frqs;
|
|---|
| 108 |
|
|---|
| 109 | int numPhaseLCs = 0;
|
|---|
| 110 | const vector<t_lc>& allLCs = LCs(system);
|
|---|
| 111 | for (unsigned ii = 0; ii < allLCs.size(); ii++) {
|
|---|
| 112 | const t_lc& LC = allLCs[ii];
|
|---|
| 113 | if (LC.includesPhase()) {
|
|---|
| 114 | numPhaseLCs += 1;
|
|---|
| 115 | frqs.insert(LC._frq1);
|
|---|
| 116 | if (LC._frq2 != t_frequency::dummy) {
|
|---|
| 117 | frqs.insert(LC._frq2);
|
|---|
| 118 | }
|
|---|
| 119 | }
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | vector<t_lc> answ;
|
|---|
| 123 | for (auto it = frqs.begin(); it != frqs.end(); ++it) {
|
|---|
| 124 | answ.push_back(t_lc(t_lc::phase, *it));
|
|---|
| 125 | if (numPhaseLCs == 1) {
|
|---|
| 126 | break;
|
|---|
| 127 | }
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | return answ;
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | //
|
|---|
| 134 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 135 | void t_pppOptions::setTrkModes(const std::string& trkStr) {
|
|---|
| 136 |
|
|---|
| 137 | QStringList priorList = QString::fromStdString(trkStr).split(" ", Qt::SkipEmptyParts);
|
|---|
| 138 | for (int ii = 0; ii < priorList.size(); ii++) {
|
|---|
| 139 | if (priorList[ii].indexOf(":") != -1) {
|
|---|
| 140 | QStringList sysList = priorList[ii].split(":", Qt::SkipEmptyParts);
|
|---|
| 141 | if (sysList.size() == 2 && sysList[0].length() == 1) {
|
|---|
| 142 | char sys = sysList[0].toStdString()[0];
|
|---|
| 143 | SysTrkModes& sysTrkModes = _trkModesMap[sys];
|
|---|
| 144 | QStringList hlpList = sysList[1].split("&", Qt::SkipEmptyParts);
|
|---|
| 145 | if (hlpList.size() == 2) {
|
|---|
| 146 | string frqStr = hlpList[0].toStdString();
|
|---|
| 147 | string trkStr = hlpList[1].toStdString();
|
|---|
| 148 | for (unsigned jj = 0; jj < frqStr.length(); jj++) {
|
|---|
| 149 | char frqChar = frqStr[jj];
|
|---|
| 150 | t_frequency::type frq = t_frequency::toFreq(sys, frqChar);
|
|---|
| 151 | sysTrkModes._frqTrkModes.push_back(SysTrkModes::FrqTrkModes(frq, trkStr));
|
|---|
| 152 | }
|
|---|
| 153 | }
|
|---|
| 154 | }
|
|---|
| 155 | }
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | //// beg test
|
|---|
| 159 | // for (const auto& [key, value] : _trkModesMap) {
|
|---|
| 160 | // cout << "system: " << key << endl;
|
|---|
| 161 | // for (const auto& frqTrk : value._frqTrkModes) {
|
|---|
| 162 | // cout << " freq: " << t_frequency::toString(frqTrk._frq) << ' '
|
|---|
| 163 | // << frqTrk._trkModes << endl;
|
|---|
| 164 | // }
|
|---|
| 165 | // }
|
|---|
| 166 | //// end test
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | //
|
|---|
| 170 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 171 | void t_pppOptions::defaultFrqs(char sys, t_frequency::type& frq1, t_frequency::type& frq2) const {
|
|---|
| 172 |
|
|---|
| 173 | frq1 = t_frequency::dummy;
|
|---|
| 174 | frq2 = t_frequency::dummy;
|
|---|
| 175 |
|
|---|
| 176 | const SysTrkModes* sysTrkModes = this->sysTrkModes(sys);
|
|---|
| 177 |
|
|---|
| 178 | if (sysTrkModes) {
|
|---|
| 179 | if (sysTrkModes->_frqTrkModes.size() > 0) {
|
|---|
| 180 | frq1 = sysTrkModes->_frqTrkModes[0]._frq;
|
|---|
| 181 | }
|
|---|
| 182 | if (sysTrkModes->_frqTrkModes.size() > 1) {
|
|---|
| 183 | frq2 = sysTrkModes->_frqTrkModes[1]._frq;
|
|---|
| 184 | }
|
|---|
| 185 | }
|
|---|
| 186 | else {
|
|---|
| 187 | if (sys == 'G') {
|
|---|
| 188 | frq1 = t_frequency::G1;
|
|---|
| 189 | frq2 = t_frequency::G2;
|
|---|
| 190 | }
|
|---|
| 191 | else if (sys == 'R') {
|
|---|
| 192 | frq1 = t_frequency::R1;
|
|---|
| 193 | frq2 = t_frequency::R2;
|
|---|
| 194 | }
|
|---|
| 195 | else if (sys == 'E') {
|
|---|
| 196 | frq1 = t_frequency::E1;
|
|---|
| 197 | frq2 = t_frequency::E5;
|
|---|
| 198 | }
|
|---|
| 199 | else if (sys == 'C') {
|
|---|
| 200 | frq1 = t_frequency::C1;
|
|---|
| 201 | frq2 = t_frequency::C5;
|
|---|
| 202 | }
|
|---|
| 203 | }
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | //
|
|---|
| 207 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 208 | void t_pppOptions::setLCs(char sys, const std::string& lcStr) {
|
|---|
| 209 |
|
|---|
| 210 | std::vector<t_lc>* LCs = 0;
|
|---|
| 211 | if (sys == 'G') {
|
|---|
| 212 | LCs = &_LCsGPS;
|
|---|
| 213 | }
|
|---|
| 214 | else if (sys == 'R') {
|
|---|
| 215 | LCs = &_LCsGLONASS;
|
|---|
| 216 | }
|
|---|
| 217 | else if (sys == 'E') {
|
|---|
| 218 | LCs = &_LCsGalileo;
|
|---|
| 219 | }
|
|---|
| 220 | else if (sys == 'C') {
|
|---|
| 221 | LCs = &_LCsBDS;
|
|---|
| 222 | }
|
|---|
| 223 | else {
|
|---|
| 224 | return;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | t_frequency::type frq1 = t_frequency::dummy;
|
|---|
| 228 | t_frequency::type frq2 = t_frequency::dummy;
|
|---|
| 229 | defaultFrqs(sys, frq1, frq2);
|
|---|
| 230 |
|
|---|
| 231 | if (lcStr == "Pi&Li") {
|
|---|
| 232 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
|
|---|
| 233 | if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq2));
|
|---|
| 234 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq1));
|
|---|
| 235 | if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq2));
|
|---|
| 236 | if (_pseudoObsIono) {
|
|---|
| 237 | LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
|
|---|
| 238 | }
|
|---|
| 239 | }
|
|---|
| 240 | else if (lcStr == "Pi") {
|
|---|
| 241 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
|
|---|
| 242 | if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq2));
|
|---|
| 243 | if (_pseudoObsIono) {
|
|---|
| 244 | LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
|
|---|
| 245 | }
|
|---|
| 246 | }
|
|---|
| 247 | else if (lcStr == "P1&L1") {
|
|---|
| 248 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
|
|---|
| 249 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq1));
|
|---|
| 250 | if (_pseudoObsIono) {
|
|---|
| 251 | LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
|
|---|
| 252 | }
|
|---|
| 253 | }
|
|---|
| 254 | else if (lcStr == "P1") {
|
|---|
| 255 | if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
|
|---|
| 256 | if (_pseudoObsIono) {
|
|---|
| 257 | LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
|
|---|
| 258 | }
|
|---|
| 259 | }
|
|---|
| 260 | else if (lcStr == "P3&L3") {
|
|---|
| 261 | if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
|
|---|
| 262 | LCs->push_back(t_lc(t_lc::codeIF, frq1, frq2));
|
|---|
| 263 | LCs->push_back(t_lc(t_lc::phaseIF, frq1, frq2));
|
|---|
| 264 | }
|
|---|
| 265 | }
|
|---|
| 266 | else if (lcStr == "P3") {
|
|---|
| 267 | if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
|
|---|
| 268 | LCs->push_back(t_lc(t_lc::codeIF, frq1, frq2));
|
|---|
| 269 | }
|
|---|
| 270 | }
|
|---|
| 271 | else if (lcStr == "L3") {
|
|---|
| 272 | if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
|
|---|
| 273 | LCs->push_back(t_lc(t_lc::phaseIF, frq1, frq2));
|
|---|
| 274 | }
|
|---|
| 275 | }
|
|---|
| 276 | else {
|
|---|
| 277 | QStringListIterator it(QString(lcStr.c_str()).split("&", Qt::SkipEmptyParts));
|
|---|
| 278 | while (it.hasNext()) {
|
|---|
| 279 | string hlp = it.next().toStdString();
|
|---|
| 280 | for (unsigned ii = 1; ii < hlp.length(); ++ii) {
|
|---|
| 281 | t_frequency::type frq = t_frequency::toFreq(sys, hlp[ii]);
|
|---|
| 282 | if (frq != t_frequency::dummy) {
|
|---|
| 283 | if (hlp[0] == 'P') {
|
|---|
| 284 | LCs->push_back(t_lc(t_lc::code, frq));
|
|---|
| 285 | }
|
|---|
| 286 | else if (hlp[0] == 'L') {
|
|---|
| 287 | LCs->push_back(t_lc(t_lc::phase, frq));
|
|---|
| 288 | }
|
|---|
| 289 | }
|
|---|
| 290 | }
|
|---|
| 291 | }
|
|---|
| 292 | }
|
|---|
| 293 | }
|
|---|