source: ntrip/trunk/BNC/src/pppOptions.cpp@ 11031

Last change on this file since 11031 was 11022, checked in by stuerze, 2 weeks ago

delete 'www' from 'bkg.bund.de'

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