1 | /* -------------------------------------------------------------------------
|
---|
2 | * BKG NTRIP Client
|
---|
3 | * -------------------------------------------------------------------------
|
---|
4 | *
|
---|
5 | * Class: t_pppParlist
|
---|
6 | *
|
---|
7 | * Purpose: List of estimated parameters
|
---|
8 | *
|
---|
9 | * Author: L. Mervart
|
---|
10 | *
|
---|
11 | * Created: 29-Jul-2014
|
---|
12 | *
|
---|
13 | * Changes:
|
---|
14 | *
|
---|
15 | * -----------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 | #include <cmath>
|
---|
18 | #include <iostream>
|
---|
19 | #include <sstream>
|
---|
20 | #include <iomanip>
|
---|
21 | #include <algorithm>
|
---|
22 | #include <newmatio.h>
|
---|
23 |
|
---|
24 | #include "pppParlist.h"
|
---|
25 | #include "pppSatObs.h"
|
---|
26 | #include "pppStation.h"
|
---|
27 | #include "bncutils.h"
|
---|
28 | #include "bncconst.h"
|
---|
29 | #include "pppClient.h"
|
---|
30 |
|
---|
31 | using namespace BNC_PPP;
|
---|
32 | using namespace std;
|
---|
33 |
|
---|
34 | // Constructor
|
---|
35 | ////////////////////////////////////////////////////////////////////////////
|
---|
36 | t_pppParam::t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC,
|
---|
37 | const vector<t_pppSatObs*>* obsVector) {
|
---|
38 |
|
---|
39 | _type = type;
|
---|
40 | _prn = prn;
|
---|
41 | _tLC = tLC;
|
---|
42 | _x0 = 0.0;
|
---|
43 | _indexOld = -1;
|
---|
44 | _indexNew = -1;
|
---|
45 | _noise = 0.0;
|
---|
46 | _ambInfo = 0;
|
---|
47 |
|
---|
48 | switch (_type) {
|
---|
49 | case crdX:
|
---|
50 | _epoSpec = false;
|
---|
51 | _sigma0 = OPT->_aprSigCrd[0];
|
---|
52 | _noise = OPT->_noiseCrd[0];
|
---|
53 | break;
|
---|
54 | case crdY:
|
---|
55 | _epoSpec = false;
|
---|
56 | _sigma0 = OPT->_aprSigCrd[1];
|
---|
57 | _noise = OPT->_noiseCrd[1];
|
---|
58 | break;
|
---|
59 | case crdZ:
|
---|
60 | _epoSpec = false;
|
---|
61 | _sigma0 = OPT->_aprSigCrd[2];
|
---|
62 | _noise = OPT->_noiseCrd[2];
|
---|
63 | break;
|
---|
64 | case clkR:
|
---|
65 | _epoSpec = true;
|
---|
66 | _sigma0 = OPT->_aprSigClk;
|
---|
67 | break;
|
---|
68 | case amb:
|
---|
69 | _epoSpec = false;
|
---|
70 | _sigma0 = OPT->_aprSigAmb;
|
---|
71 | _ambInfo = new t_ambInfo();
|
---|
72 | if (obsVector) {
|
---|
73 | for (unsigned ii = 0; ii < obsVector->size(); ii++) {
|
---|
74 | const t_pppSatObs* obs = obsVector->at(ii);
|
---|
75 | if (obs->prn() == _prn) {
|
---|
76 | double offGlo = 0;
|
---|
77 | if (_prn.system() == 'R' && tLC != t_lc::MW) {
|
---|
78 | offGlo = PPP_CLIENT->offGlo();
|
---|
79 | }
|
---|
80 | double offGal = 0;
|
---|
81 | if (_prn.system() == 'E' && tLC != t_lc::MW) {
|
---|
82 | offGal = PPP_CLIENT->offGal();
|
---|
83 | }
|
---|
84 | double offBds = 0;
|
---|
85 | if (_prn.system() == 'C' && tLC != t_lc::MW) {
|
---|
86 | offBds = PPP_CLIENT->offBds();
|
---|
87 | }
|
---|
88 | _x0 = floor((obs->obsValue(tLC) - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
|
---|
89 | break;
|
---|
90 | }
|
---|
91 | }
|
---|
92 | }
|
---|
93 | break;
|
---|
94 | case offGlo:
|
---|
95 | _epoSpec = true;
|
---|
96 | _sigma0 = OPT->_aprSigClk;
|
---|
97 | _x0 = PPP_CLIENT->offGlo();
|
---|
98 | break;
|
---|
99 | case offGal:
|
---|
100 | _epoSpec = true;
|
---|
101 | _sigma0 = OPT->_aprSigClk;
|
---|
102 | _x0 = PPP_CLIENT->offGal();
|
---|
103 | break;
|
---|
104 | case offBds:
|
---|
105 | _epoSpec = true;
|
---|
106 | _sigma0 = OPT->_aprSigClk;
|
---|
107 | _x0 = PPP_CLIENT->offBds();
|
---|
108 | break;
|
---|
109 | case trp:
|
---|
110 | _epoSpec = false;
|
---|
111 | _sigma0 = OPT->_aprSigTrp;
|
---|
112 | _noise = OPT->_noiseTrp;
|
---|
113 | break;
|
---|
114 | case ion:
|
---|
115 | _epoSpec = false;
|
---|
116 | _sigma0 = OPT->_aprSigIon;
|
---|
117 | _noise = OPT->_noiseIon;
|
---|
118 | break;
|
---|
119 | case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1:
|
---|
120 | case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2:
|
---|
121 | _epoSpec = false;
|
---|
122 | _sigma0 = OPT->_aprSigCodeBias;
|
---|
123 | _noise = OPT->_noiseCodeBias;
|
---|
124 | break;
|
---|
125 | case pBiasG1: case pBiasR1: case pBiasE1: case pBiasC1:
|
---|
126 | case pBiasG2: case pBiasR2: case pBiasE2: case pBiasC2:
|
---|
127 | _epoSpec = false;
|
---|
128 | _sigma0 = OPT->_aprSigPhaseBias;
|
---|
129 | _noise = OPT->_noisePhaseBias;
|
---|
130 | break;
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | // Destructor
|
---|
135 | ////////////////////////////////////////////////////////////////////////////
|
---|
136 | t_pppParam::~t_pppParam() {
|
---|
137 | if (_ambInfo) {
|
---|
138 | delete _ambInfo;
|
---|
139 | }
|
---|
140 | }
|
---|
141 | //
|
---|
142 | ////////////////////////////////////////////////////////////////////////////
|
---|
143 | double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
|
---|
144 | const t_lc::type& tLC) const {
|
---|
145 |
|
---|
146 | // Special Case - Melbourne-Wuebbena
|
---|
147 | // ---------------------------------
|
---|
148 | if (tLC == t_lc::MW && _type != amb) {
|
---|
149 | return 0.0;
|
---|
150 | }
|
---|
151 |
|
---|
152 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
153 | ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
|
---|
154 |
|
---|
155 | map<t_frequency::type, double> codeCoeff;
|
---|
156 | map<t_frequency::type, double> phaseCoeff;
|
---|
157 | map<t_frequency::type, double> ionoCoeff;
|
---|
158 | obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
|
---|
159 |
|
---|
160 | switch (_type) {
|
---|
161 | case crdX:
|
---|
162 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
163 | return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
|
---|
164 | case crdY:
|
---|
165 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
166 | return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
|
---|
167 | case crdZ:
|
---|
168 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
169 | return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
|
---|
170 | case clkR:
|
---|
171 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
172 | return 1.0;
|
---|
173 | case offGlo:
|
---|
174 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
175 | return (obs->prn().system() == 'R') ? 1.0 : 0.0;
|
---|
176 | case offGal:
|
---|
177 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
178 | return (obs->prn().system() == 'E') ? 1.0 : 0.0;
|
---|
179 | case offBds:
|
---|
180 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
181 | return (obs->prn().system() == 'C') ? 1.0 : 0.0;
|
---|
182 | case amb:
|
---|
183 | if (tLC == t_lc::GIM) {
|
---|
184 | return 0.0;
|
---|
185 | }
|
---|
186 | else {
|
---|
187 | if (obs->prn() == _prn) {
|
---|
188 | if (tLC == _tLC) {
|
---|
189 | return (obs->lambda(tLC));
|
---|
190 | }
|
---|
191 | else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
|
---|
192 | return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
|
---|
193 | }
|
---|
194 | else {
|
---|
195 | if (_tLC == t_lc::l1) {
|
---|
196 | return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
197 | }
|
---|
198 | else if (_tLC == t_lc::l2) {
|
---|
199 | return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
200 | }
|
---|
201 | }
|
---|
202 | }
|
---|
203 | }
|
---|
204 | break;
|
---|
205 | case trp:
|
---|
206 | if (tLC == t_lc::GIM) {
|
---|
207 | return 0.0;
|
---|
208 | }
|
---|
209 | else {
|
---|
210 | return 1.0 / sin(obs->eleSat());
|
---|
211 | }
|
---|
212 | case ion:
|
---|
213 | if (obs->prn() == _prn) {
|
---|
214 | if (tLC == t_lc::c1) {
|
---|
215 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
|
---|
216 | }
|
---|
217 | else if (tLC == t_lc::c2) {
|
---|
218 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
|
---|
219 | }
|
---|
220 | else if (tLC == t_lc::l1) {
|
---|
221 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
222 | }
|
---|
223 | else if (tLC == t_lc::l2) {
|
---|
224 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
225 | }
|
---|
226 | else if (tLC == t_lc::GIM) {
|
---|
227 | return 1.0;
|
---|
228 | }
|
---|
229 | }
|
---|
230 | break;
|
---|
231 | case cBiasG1:
|
---|
232 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
233 | break;
|
---|
234 | case cBiasR1:
|
---|
235 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
236 | break;
|
---|
237 | case cBiasE1:
|
---|
238 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
239 | break;
|
---|
240 | case cBiasC1:
|
---|
241 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
242 | break;
|
---|
243 | case cBiasG2:
|
---|
244 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
245 | break;
|
---|
246 | case cBiasR2:
|
---|
247 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
248 | break;
|
---|
249 | case cBiasE2:
|
---|
250 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
251 | break;
|
---|
252 | case cBiasC2:
|
---|
253 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
254 | break;
|
---|
255 | case pBiasG1:
|
---|
256 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
257 | break;
|
---|
258 | case pBiasR1:
|
---|
259 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
260 | break;
|
---|
261 | case pBiasE1:
|
---|
262 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
263 | break;
|
---|
264 | case pBiasC1:
|
---|
265 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
266 | break;
|
---|
267 | case pBiasG2:
|
---|
268 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
269 | break;
|
---|
270 | case pBiasR2:
|
---|
271 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
272 | break;
|
---|
273 | case pBiasE2:
|
---|
274 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
275 | break;
|
---|
276 | case pBiasC2:
|
---|
277 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
278 | break;
|
---|
279 |
|
---|
280 | }
|
---|
281 | return 0.0;
|
---|
282 | }
|
---|
283 |
|
---|
284 | //
|
---|
285 | ////////////////////////////////////////////////////////////////////////////
|
---|
286 | string t_pppParam::toString() const {
|
---|
287 | stringstream ss;
|
---|
288 | switch (_type) {
|
---|
289 | case crdX:
|
---|
290 | ss << "CRD_X";
|
---|
291 | break;
|
---|
292 | case crdY:
|
---|
293 | ss << "CRD_Y";
|
---|
294 | break;
|
---|
295 | case crdZ:
|
---|
296 | ss << "CRD_Z";
|
---|
297 | break;
|
---|
298 | case clkR:
|
---|
299 | ss << "REC_CLK ";
|
---|
300 | break;
|
---|
301 | case offGlo:
|
---|
302 | ss << "OFF_GLO ";
|
---|
303 | break;
|
---|
304 | case offGal:
|
---|
305 | ss << "OFF_GAL ";
|
---|
306 | break;
|
---|
307 | case offBds:
|
---|
308 | ss << "OFF_BDS ";
|
---|
309 | break;
|
---|
310 | case trp:
|
---|
311 | ss << "TRP ";
|
---|
312 | break;
|
---|
313 | case amb:
|
---|
314 | ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
315 | break;
|
---|
316 | case ion:
|
---|
317 | ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
318 | break;
|
---|
319 | case cBiasG1: case pBiasG1:
|
---|
320 | case cBiasG2: case pBiasG2:
|
---|
321 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
|
---|
322 | break;
|
---|
323 | case cBiasR1: case pBiasR1:
|
---|
324 | case cBiasR2: case pBiasR2:
|
---|
325 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
|
---|
326 | break;
|
---|
327 | case cBiasE1: case pBiasE1:
|
---|
328 | case cBiasE2: case pBiasE2:
|
---|
329 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
|
---|
330 | break;
|
---|
331 | case cBiasC1: case pBiasC1:
|
---|
332 | case cBiasC2: case pBiasC2:
|
---|
333 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
|
---|
334 | break;
|
---|
335 | }
|
---|
336 | return ss.str();
|
---|
337 | }
|
---|
338 |
|
---|
339 | // Constructor
|
---|
340 | ////////////////////////////////////////////////////////////////////////////
|
---|
341 | t_pppParlist::t_pppParlist() {
|
---|
342 | }
|
---|
343 |
|
---|
344 | // Destructor
|
---|
345 | ////////////////////////////////////////////////////////////////////////////
|
---|
346 | t_pppParlist::~t_pppParlist() {
|
---|
347 | _usedSystems.clear();
|
---|
348 |
|
---|
349 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
350 | delete _params[ii];
|
---|
351 | }
|
---|
352 | }
|
---|
353 |
|
---|
354 | //
|
---|
355 | ////////////////////////////////////////////////////////////////////////////
|
---|
356 | t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) {
|
---|
357 |
|
---|
358 | // Remove some Parameters
|
---|
359 | // ----------------------
|
---|
360 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
361 | while (it != _params.end()) {
|
---|
362 | t_pppParam* par = *it;
|
---|
363 |
|
---|
364 | bool remove = false;
|
---|
365 |
|
---|
366 | if (par->epoSpec()) {
|
---|
367 | remove = true;
|
---|
368 | }
|
---|
369 |
|
---|
370 | else if (par->type() == t_pppParam::amb ||
|
---|
371 | par->type() == t_pppParam::crdX ||
|
---|
372 | par->type() == t_pppParam::crdY ||
|
---|
373 | par->type() == t_pppParam::crdZ) {
|
---|
374 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
375 | remove = true;
|
---|
376 | }
|
---|
377 | }
|
---|
378 | else if (par->type() == t_pppParam::ion) {
|
---|
379 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 5.0)) {
|
---|
380 | remove = true;
|
---|
381 | }
|
---|
382 | }
|
---|
383 |
|
---|
384 | if (remove) {
|
---|
385 | #ifdef BNC_DEBUG_PPP
|
---|
386 | // LOG << "remove0 " << par->toString() << std::endl;
|
---|
387 | #endif
|
---|
388 | delete par;
|
---|
389 | it = _params.erase(it);
|
---|
390 | }
|
---|
391 | else {
|
---|
392 | ++it;
|
---|
393 | }
|
---|
394 | }
|
---|
395 |
|
---|
396 | // check which systems have observations
|
---|
397 | // -------------------------------------
|
---|
398 | _usedSystems.clear();
|
---|
399 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
400 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
401 | char sys = satObs->prn().system();
|
---|
402 | if (!_usedSystems.contains(sys)) {
|
---|
403 | _usedSystems.append(sys);
|
---|
404 | }
|
---|
405 | }
|
---|
406 |
|
---|
407 | // Check whether parameters have observations
|
---|
408 | // ------------------------------------------
|
---|
409 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
410 | t_pppParam* par = _params[ii];
|
---|
411 | if (par->prn() == 0) {
|
---|
412 | par->setLastObsTime(epoTime);
|
---|
413 | if (par->firstObsTime().undef()) {
|
---|
414 | par->setFirstObsTime(epoTime);
|
---|
415 | }
|
---|
416 | }
|
---|
417 | else {
|
---|
418 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
419 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
420 | if (satObs->prn() == par->prn()) {
|
---|
421 | par->setLastObsTime(epoTime);
|
---|
422 | if (par->firstObsTime().undef()) {
|
---|
423 | par->setFirstObsTime(epoTime);
|
---|
424 | }
|
---|
425 | break;
|
---|
426 | }
|
---|
427 | }
|
---|
428 | }
|
---|
429 | }
|
---|
430 |
|
---|
431 | if (OPT->_obsModelType == OPT->PPPRTK || OPT->_pseudoObsIono) {
|
---|
432 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
433 | while (it != _params.end()) {
|
---|
434 | t_pppParam* par = *it;
|
---|
435 | // Check if systems have to be presented per biases
|
---|
436 | // ----------------------------------------------
|
---|
437 | if (( par->type() == t_pppParam::cBiasG1 ||
|
---|
438 | par->type() == t_pppParam::cBiasG2 ||
|
---|
439 | par->type() == t_pppParam::pBiasG1 ||
|
---|
440 | par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
|
---|
441 | #ifdef BNC_DEBUG_PPP
|
---|
442 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
443 | #endif
|
---|
444 | delete par;
|
---|
445 | it = _params.erase(it);
|
---|
446 | }
|
---|
447 | else if ((par->type() == t_pppParam::cBiasR1 ||
|
---|
448 | par->type() == t_pppParam::cBiasR2 ||
|
---|
449 | par->type() == t_pppParam::pBiasR1 ||
|
---|
450 | par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
|
---|
451 | #ifdef BNC_DEBUG_PPP
|
---|
452 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
453 | #endif
|
---|
454 | delete par;
|
---|
455 | it = _params.erase(it);
|
---|
456 | }
|
---|
457 | else if ((par->type() == t_pppParam::cBiasE1 ||
|
---|
458 | par->type() == t_pppParam::cBiasE2 ||
|
---|
459 | par->type() == t_pppParam::pBiasE1 ||
|
---|
460 | par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
|
---|
461 | #ifdef BNC_DEBUG_PPP
|
---|
462 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
463 | #endif
|
---|
464 | delete par;
|
---|
465 | it = _params.erase(it);
|
---|
466 | }
|
---|
467 | else if ((par->type() == t_pppParam::cBiasC1 ||
|
---|
468 | par->type() == t_pppParam::cBiasC2 ||
|
---|
469 | par->type() == t_pppParam::pBiasC1 ||
|
---|
470 | par->type() == t_pppParam::pBiasC2) && !usedSystems().contains('C')) {
|
---|
471 | #ifdef BNC_DEBUG_PPP
|
---|
472 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
473 | #endif
|
---|
474 | delete par;
|
---|
475 | it = _params.erase(it);
|
---|
476 | }
|
---|
477 | else {
|
---|
478 | ++it;
|
---|
479 | }
|
---|
480 | }
|
---|
481 | }
|
---|
482 |
|
---|
483 | // Required Set of Parameters
|
---|
484 | // --------------------------
|
---|
485 | vector<t_pppParam*> required;
|
---|
486 |
|
---|
487 | // Coordinates
|
---|
488 | // -----------
|
---|
489 | required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
|
---|
490 | required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
|
---|
491 | required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
|
---|
492 |
|
---|
493 | // Receiver Clock
|
---|
494 | // --------------
|
---|
495 | required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
|
---|
496 |
|
---|
497 | // GLONASS Clock Offset
|
---|
498 | // --------------------
|
---|
499 | if ( _usedSystems.contains('R') &&
|
---|
500 | (_usedSystems.contains('G') || _usedSystems.contains('E') || _usedSystems.contains('C'))) {
|
---|
501 | required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
|
---|
502 | }
|
---|
503 |
|
---|
504 | // Galileo Clock Offset
|
---|
505 | // --------------------
|
---|
506 | if (_usedSystems.contains('E') && _usedSystems.contains('G')) {
|
---|
507 | required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
|
---|
508 | }
|
---|
509 |
|
---|
510 | // BDS Clock Offset
|
---|
511 | // ----------------
|
---|
512 | if (_usedSystems.contains('C') && (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
|
---|
513 | required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
|
---|
514 | }
|
---|
515 |
|
---|
516 | // Troposphere
|
---|
517 | // -----------
|
---|
518 | if (OPT->estTrp()) {
|
---|
519 | required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
|
---|
520 | }
|
---|
521 |
|
---|
522 | // Ionosphere
|
---|
523 | // ----------
|
---|
524 | if (OPT->_obsModelType == OPT->UncombPPP) {
|
---|
525 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
526 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
527 | required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
|
---|
528 | }
|
---|
529 | }
|
---|
530 | // Ambiguities
|
---|
531 | // -----------
|
---|
532 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
533 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
534 | const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
|
---|
535 | for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
|
---|
536 | required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
|
---|
537 | }
|
---|
538 | }
|
---|
539 |
|
---|
540 | // Receiver Code Biases
|
---|
541 | // --------------------
|
---|
542 | if (OPT->_obsModelType == OPT->PPPRTK) {
|
---|
543 | std::vector<t_lc::type> lc;
|
---|
544 | if (_usedSystems.contains('G')) {
|
---|
545 | lc = OPT->LCs('G');
|
---|
546 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
547 | required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
|
---|
548 | }
|
---|
549 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
550 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
551 | }
|
---|
552 | }
|
---|
553 | if (_usedSystems.contains('R')) {
|
---|
554 | lc = OPT->LCs('R');
|
---|
555 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
556 | required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
|
---|
557 | }
|
---|
558 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
559 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
560 | }
|
---|
561 | }
|
---|
562 | if (_usedSystems.contains('E')) {
|
---|
563 | lc = OPT->LCs('E');
|
---|
564 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
565 | required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
|
---|
566 | }
|
---|
567 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
568 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
569 | }
|
---|
570 | }
|
---|
571 | if (_usedSystems.contains('C')) {
|
---|
572 | lc = OPT->LCs('C');
|
---|
573 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
574 | required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
|
---|
575 | }
|
---|
576 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
577 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
578 | }
|
---|
579 | }
|
---|
580 | }
|
---|
581 | if (OPT->_pseudoObsIono) {
|
---|
582 | std::vector<t_lc::type> lc;
|
---|
583 | if (_usedSystems.contains('G')) {
|
---|
584 | lc = OPT->LCs('G');
|
---|
585 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
586 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
587 | }
|
---|
588 | }
|
---|
589 | if (_usedSystems.contains('R')) {
|
---|
590 | lc = OPT->LCs('R');
|
---|
591 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
592 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
593 | }
|
---|
594 | }
|
---|
595 | if (_usedSystems.contains('E')) {
|
---|
596 | lc = OPT->LCs('E');
|
---|
597 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
598 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
599 | }
|
---|
600 | }
|
---|
601 | if (_usedSystems.contains('C')) {
|
---|
602 | lc = OPT->LCs('C');
|
---|
603 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
604 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
605 | }
|
---|
606 | }
|
---|
607 | }
|
---|
608 |
|
---|
609 | // Receiver Phase Biases
|
---|
610 | // ---------------------
|
---|
611 | if (OPT->_obsModelType == OPT->PPPRTK) {
|
---|
612 | std::vector<t_lc::type> lc;
|
---|
613 | if (_usedSystems.contains('G')) {
|
---|
614 | lc = OPT->LCs('G');
|
---|
615 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
616 | required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
|
---|
617 | }
|
---|
618 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
619 | required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
|
---|
620 | }
|
---|
621 | }
|
---|
622 | if (_usedSystems.contains('R')) {
|
---|
623 | lc = OPT->LCs('R');
|
---|
624 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
625 | required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
|
---|
626 | }
|
---|
627 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
628 | required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
|
---|
629 | }
|
---|
630 | }
|
---|
631 | if (_usedSystems.contains('E')) {
|
---|
632 | lc = OPT->LCs('E');
|
---|
633 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
634 | required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
|
---|
635 | }
|
---|
636 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
637 | required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
|
---|
638 | }
|
---|
639 | }
|
---|
640 | if (_usedSystems.contains('C')) {
|
---|
641 | lc = OPT->LCs('C');
|
---|
642 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
643 | required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
|
---|
644 | }
|
---|
645 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
646 | required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
|
---|
647 | }
|
---|
648 | }
|
---|
649 | }
|
---|
650 |
|
---|
651 | // Check if all required parameters are present
|
---|
652 | // --------------------------------------------
|
---|
653 | for (unsigned ii = 0; ii < required.size(); ii++) {
|
---|
654 | t_pppParam* parReq = required[ii];
|
---|
655 |
|
---|
656 | bool found = false;
|
---|
657 | for (unsigned jj = 0; jj < _params.size(); jj++) {
|
---|
658 | t_pppParam* parOld = _params[jj];
|
---|
659 | if (parOld->isEqual(parReq)) {
|
---|
660 | found = true;
|
---|
661 | break;
|
---|
662 | }
|
---|
663 | }
|
---|
664 | if (found) {
|
---|
665 | delete parReq;
|
---|
666 | }
|
---|
667 | else {
|
---|
668 | #ifdef BNC_DEBUG_PPP
|
---|
669 | //LOG << "push_back parReq " << parReq->toString() << std::endl;
|
---|
670 | #endif
|
---|
671 | _params.push_back(parReq);
|
---|
672 | }
|
---|
673 | }
|
---|
674 |
|
---|
675 | // Set Parameter Indices
|
---|
676 | // ---------------------
|
---|
677 | sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
|
---|
678 |
|
---|
679 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
680 | t_pppParam* par = _params[ii];
|
---|
681 | par->setIndex(ii);
|
---|
682 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
683 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
684 | if (satObs->prn() == par->prn()) {
|
---|
685 | par->setAmbEleSat(satObs->eleSat());
|
---|
686 | par->stepAmbNumEpo();
|
---|
687 | }
|
---|
688 | }
|
---|
689 | }
|
---|
690 |
|
---|
691 | return success;
|
---|
692 | }
|
---|
693 |
|
---|
694 | //
|
---|
695 | ////////////////////////////////////////////////////////////////////////////
|
---|
696 | void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
|
---|
697 | const ColumnVector& xx) const {
|
---|
698 |
|
---|
699 | string epoTimeStr = string(epoTime);
|
---|
700 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
701 |
|
---|
702 | LOG << endl;
|
---|
703 |
|
---|
704 | t_pppParam* parX = 0;
|
---|
705 | t_pppParam* parY = 0;
|
---|
706 | t_pppParam* parZ = 0;
|
---|
707 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
708 | t_pppParam* par = _params[ii];
|
---|
709 | if (par->type() == t_pppParam::crdX) {
|
---|
710 | parX = par;
|
---|
711 | }
|
---|
712 | else if (par->type() == t_pppParam::crdY) {
|
---|
713 | parY = par;
|
---|
714 | }
|
---|
715 | else if (par->type() == t_pppParam::crdZ) {
|
---|
716 | parZ = par;
|
---|
717 | }
|
---|
718 | else {
|
---|
719 | int ind = par->indexNew();
|
---|
720 | double apr = (par->type() == t_pppParam::trp) ?
|
---|
721 | t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
|
---|
722 | LOG << epoTimeStr << ' ' << par->toString() << ' '
|
---|
723 | << setw(10) << setprecision(4) << apr << ' '
|
---|
724 | << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
|
---|
725 | << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
|
---|
726 | if (par->type() == t_pppParam::amb) {
|
---|
727 | LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
|
---|
728 | << " epo = " << setw(4) << par->ambNumEpo();
|
---|
729 | }
|
---|
730 | LOG << endl;
|
---|
731 | }
|
---|
732 | }
|
---|
733 |
|
---|
734 | if (parX && parY && parZ) {
|
---|
735 |
|
---|
736 | ColumnVector xyz(3);
|
---|
737 | xyz[0] = xx[parX->indexNew()];
|
---|
738 | xyz[1] = xx[parY->indexNew()];
|
---|
739 | xyz[2] = xx[parZ->indexNew()];
|
---|
740 |
|
---|
741 | ColumnVector neu(3);
|
---|
742 | xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
|
---|
743 |
|
---|
744 | SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
|
---|
745 |
|
---|
746 | SymmetricMatrix QQneu(3);
|
---|
747 | covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
|
---|
748 |
|
---|
749 | LOG << epoTimeStr << ' ' << sta->name()
|
---|
750 | << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
|
---|
751 | << setprecision(4) << sqrt(QQxyz[0][0])
|
---|
752 |
|
---|
753 | << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
|
---|
754 | << setprecision(4) << sqrt(QQxyz[1][1])
|
---|
755 |
|
---|
756 | << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
|
---|
757 | << setprecision(4) << sqrt(QQxyz[2][2])
|
---|
758 |
|
---|
759 | << " dN = " << setprecision(4) << neu[0] << " +- "
|
---|
760 | << setprecision(4) << sqrt(QQneu[0][0])
|
---|
761 |
|
---|
762 | << " dE = " << setprecision(4) << neu[1] << " +- "
|
---|
763 | << setprecision(4) << sqrt(QQneu[1][1])
|
---|
764 |
|
---|
765 | << " dU = " << setprecision(4) << neu[2] << " +- "
|
---|
766 | << setprecision(4) << sqrt(QQneu[2][2])
|
---|
767 |
|
---|
768 | << endl;
|
---|
769 | }
|
---|
770 | return;
|
---|
771 | }
|
---|
772 |
|
---|
773 | //
|
---|
774 | ////////////////////////////////////////////////////////////////////////////
|
---|
775 | void t_pppParlist::printParams(const bncTime& epoTime) {
|
---|
776 |
|
---|
777 | for (unsigned iPar = 0; iPar < _params.size(); iPar++) {
|
---|
778 | LOG << _params[iPar]->toString()
|
---|
779 | << "\t lastObsTime().valid() \t" << _params[iPar]->lastObsTime().valid()
|
---|
780 | << "\t epoTime - par->lastObsTime() \t" << (epoTime - _params[iPar]->lastObsTime())
|
---|
781 | << endl;
|
---|
782 | }
|
---|
783 | }
|
---|
784 |
|
---|