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 | //
|
---|
135 | ////////////////////////////////////////////////////////////////////////////
|
---|
136 | t_pppParam::t_pppParam(const t_pppParam* old) {
|
---|
137 | _type = old->type();
|
---|
138 | _prn = old->prn();
|
---|
139 | _tLC = old->tLC();
|
---|
140 | _indexOld = old->indexOld();
|
---|
141 | _indexNew = old->indexNew();
|
---|
142 | _noise = old->noise();
|
---|
143 | _sigma0 = old->sigma0();
|
---|
144 | _epoSpec = old->epoSpec();
|
---|
145 | _x0 = old->x0();
|
---|
146 | setFirstObsTime(old->firstObsTime());
|
---|
147 | setLastObsTime(old->lastObsTime());
|
---|
148 | _ambInfo = 0;
|
---|
149 | if (_type == t_pppParam::amb) {
|
---|
150 | _ambInfo = new t_ambInfo();
|
---|
151 | _ambInfo->_resetCandidate = old->_ambInfo->_resetCandidate;
|
---|
152 | _ambInfo->_eleSat = old->_ambInfo->_eleSat;
|
---|
153 | _ambInfo->_numEpo = old->_ambInfo->_numEpo;
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 | // Destructor
|
---|
158 | ////////////////////////////////////////////////////////////////////////////
|
---|
159 | t_pppParam::~t_pppParam() {
|
---|
160 | if (_ambInfo) {
|
---|
161 | delete _ambInfo;
|
---|
162 | }
|
---|
163 | }
|
---|
164 | //
|
---|
165 | ////////////////////////////////////////////////////////////////////////////
|
---|
166 | double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
|
---|
167 | const t_lc::type& tLC, const t_prn refPrn) const {
|
---|
168 |
|
---|
169 | // Special Case - Melbourne-Wuebbena
|
---|
170 | // ---------------------------------
|
---|
171 | if (tLC == t_lc::MW && _type != amb) {
|
---|
172 | return 0.0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
176 | ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
|
---|
177 |
|
---|
178 | map<t_frequency::type, double> codeCoeff;
|
---|
179 | map<t_frequency::type, double> phaseCoeff;
|
---|
180 | map<t_frequency::type, double> ionoCoeff;
|
---|
181 | obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
|
---|
182 |
|
---|
183 | switch (_type) {
|
---|
184 | case crdX:
|
---|
185 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
186 | return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
|
---|
187 | case crdY:
|
---|
188 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
189 | return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
|
---|
190 | case crdZ:
|
---|
191 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
192 | return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
|
---|
193 | case clkR:
|
---|
194 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
195 | return 1.0;
|
---|
196 | case offGlo:
|
---|
197 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
198 | return (obs->prn().system() == 'R') ? 1.0 : 0.0;
|
---|
199 | case offGal:
|
---|
200 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
201 | return (obs->prn().system() == 'E') ? 1.0 : 0.0;
|
---|
202 | case offBds:
|
---|
203 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
204 | return (obs->prn().system() == 'C') ? 1.0 : 0.0;
|
---|
205 | case amb:
|
---|
206 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
207 | else if ((OPT->_obsModelType == OPT->IF) ||
|
---|
208 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
209 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
210 | (OPT->_obsModelType == OPT->DCMcodeBias && !obs->isReference()) ||
|
---|
211 | (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference()) ) {
|
---|
212 |
|
---|
213 | if (obs->prn() == _prn) {
|
---|
214 | if (tLC == _tLC) {
|
---|
215 | return (obs->lambda(tLC));
|
---|
216 | }
|
---|
217 | else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
|
---|
218 | return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
|
---|
219 | }
|
---|
220 | else {
|
---|
221 | if (_tLC == t_lc::l1) {
|
---|
222 | return obs->lambda(t_lc::l1) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
223 | }
|
---|
224 | else if (_tLC == t_lc::l2) {
|
---|
225 | return obs->lambda(t_lc::l2) * phaseCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
226 | }
|
---|
227 | }
|
---|
228 | }
|
---|
229 | }
|
---|
230 | break;
|
---|
231 | case trp:
|
---|
232 | if (tLC == t_lc::GIM) {
|
---|
233 | return 0.0;
|
---|
234 | }
|
---|
235 | else {
|
---|
236 | return 1.0 / sin(obs->eleSat());
|
---|
237 | }
|
---|
238 | case ion:
|
---|
239 | if (obs->prn() == _prn) {
|
---|
240 | if (tLC == t_lc::c1) {
|
---|
241 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
|
---|
242 | }
|
---|
243 | else if (tLC == t_lc::c2) {
|
---|
244 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
|
---|
245 | }
|
---|
246 | else if (tLC == t_lc::l1) {
|
---|
247 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
248 | }
|
---|
249 | else if (tLC == t_lc::l2) {
|
---|
250 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
251 | }
|
---|
252 | else if (tLC == t_lc::GIM) {
|
---|
253 | return -1.0;
|
---|
254 | }
|
---|
255 | }
|
---|
256 | if (tLC == t_lc::GIM && _prn == refPrn) {
|
---|
257 | return 1.0;
|
---|
258 | }
|
---|
259 | break;
|
---|
260 | case cBiasG1:
|
---|
261 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
262 | break;
|
---|
263 | case cBiasR1:
|
---|
264 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
265 | break;
|
---|
266 | case cBiasE1:
|
---|
267 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
268 | break;
|
---|
269 | case cBiasC1:
|
---|
270 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
271 | break;
|
---|
272 | case cBiasG2:
|
---|
273 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
274 | break;
|
---|
275 | case cBiasR2:
|
---|
276 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
277 | break;
|
---|
278 | case cBiasE2:
|
---|
279 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
280 | break;
|
---|
281 | case cBiasC2:
|
---|
282 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
283 | break;
|
---|
284 | case pBiasG1:
|
---|
285 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
286 | break;
|
---|
287 | case pBiasR1:
|
---|
288 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
289 | break;
|
---|
290 | case pBiasE1:
|
---|
291 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
292 | break;
|
---|
293 | case pBiasC1:
|
---|
294 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
295 | break;
|
---|
296 | case pBiasG2:
|
---|
297 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
298 | break;
|
---|
299 | case pBiasR2:
|
---|
300 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
301 | break;
|
---|
302 | case pBiasE2:
|
---|
303 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
304 | break;
|
---|
305 | case pBiasC2:
|
---|
306 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
307 | break;
|
---|
308 |
|
---|
309 | }
|
---|
310 | return 0.0;
|
---|
311 | }
|
---|
312 |
|
---|
313 | //
|
---|
314 | ////////////////////////////////////////////////////////////////////////////
|
---|
315 | string t_pppParam::toString() const {
|
---|
316 | stringstream ss;
|
---|
317 | switch (_type) {
|
---|
318 | case crdX:
|
---|
319 | ss << "CRD_X";
|
---|
320 | break;
|
---|
321 | case crdY:
|
---|
322 | ss << "CRD_Y";
|
---|
323 | break;
|
---|
324 | case crdZ:
|
---|
325 | ss << "CRD_Z";
|
---|
326 | break;
|
---|
327 | case clkR:
|
---|
328 | ss << "REC_CLK ";
|
---|
329 | break;
|
---|
330 | case offGlo:
|
---|
331 | ss << "OFF_GLO ";
|
---|
332 | break;
|
---|
333 | case offGal:
|
---|
334 | ss << "OFF GAL ";
|
---|
335 | break;
|
---|
336 | case offBds:
|
---|
337 | ss << "OFF_BDS ";
|
---|
338 | break;
|
---|
339 | case trp:
|
---|
340 | ss << "TRP ";
|
---|
341 | break;
|
---|
342 | case amb:
|
---|
343 | ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
344 | break;
|
---|
345 | case ion:
|
---|
346 | ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
347 | break;
|
---|
348 | case cBiasG1: case pBiasG1:
|
---|
349 | case cBiasG2: case pBiasG2:
|
---|
350 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
|
---|
351 | break;
|
---|
352 | case cBiasR1: case pBiasR1:
|
---|
353 | case cBiasR2: case pBiasR2:
|
---|
354 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
|
---|
355 | break;
|
---|
356 | case cBiasE1: case pBiasE1:
|
---|
357 | case cBiasE2: case pBiasE2:
|
---|
358 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
|
---|
359 | break;
|
---|
360 | case cBiasC1: case pBiasC1:
|
---|
361 | case cBiasC2: case pBiasC2:
|
---|
362 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
|
---|
363 | break;
|
---|
364 | }
|
---|
365 | return ss.str();
|
---|
366 | }
|
---|
367 |
|
---|
368 | // Constructor
|
---|
369 | ////////////////////////////////////////////////////////////////////////////
|
---|
370 | t_pppParlist::t_pppParlist() {
|
---|
371 | }
|
---|
372 |
|
---|
373 | // Destructor
|
---|
374 | ////////////////////////////////////////////////////////////////////////////
|
---|
375 | t_pppParlist::~t_pppParlist() {
|
---|
376 | _usedSystems.clear();
|
---|
377 |
|
---|
378 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
379 | while (it != _params.end()) {
|
---|
380 | t_pppParam* par = *it;
|
---|
381 | delete par;
|
---|
382 | it = _params.erase(it);
|
---|
383 | }
|
---|
384 | }
|
---|
385 |
|
---|
386 | //
|
---|
387 | ////////////////////////////////////////////////////////////////////////////
|
---|
388 | t_pppParlist::t_pppParlist(const t_pppParlist& old) {
|
---|
389 |
|
---|
390 | _usedSystems = old._usedSystems;
|
---|
391 |
|
---|
392 | vector<t_pppParam*>::const_iterator it = old.params().begin();
|
---|
393 | while (it != old.params().end()) {
|
---|
394 | const t_pppParam* oldParam = *it;
|
---|
395 | _params.push_back(new t_pppParam(oldParam));
|
---|
396 | }
|
---|
397 | }
|
---|
398 |
|
---|
399 | //
|
---|
400 | ////////////////////////////////////////////////////////////////////////////
|
---|
401 | const t_pppParlist& t_pppParlist::operator= (const t_pppParlist& p) {
|
---|
402 |
|
---|
403 | _usedSystems.clear();
|
---|
404 |
|
---|
405 | _usedSystems = p._usedSystems;
|
---|
406 |
|
---|
407 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
408 | while (it != _params.end()) {
|
---|
409 | t_pppParam* par = *it;
|
---|
410 | delete par;
|
---|
411 | it = _params.erase(it);
|
---|
412 | }
|
---|
413 |
|
---|
414 | for (unsigned jj = 0; jj < p.params().size(); jj++) {
|
---|
415 | t_pppParam* parFrom = p.params()[jj];
|
---|
416 | _params.push_back(new t_pppParam(parFrom));
|
---|
417 | }
|
---|
418 | return *this;
|
---|
419 | }
|
---|
420 |
|
---|
421 | //
|
---|
422 | ////////////////////////////////////////////////////////////////////////////
|
---|
423 | t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
|
---|
424 | const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
425 |
|
---|
426 | // Remove some Parameters
|
---|
427 | // ----------------------
|
---|
428 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
429 | while (it != _params.end()) {
|
---|
430 | t_pppParam* par = *it;
|
---|
431 |
|
---|
432 | bool remove = false;
|
---|
433 |
|
---|
434 | if (par->epoSpec()) {
|
---|
435 | remove = true;
|
---|
436 | }
|
---|
437 |
|
---|
438 | else if (par->type() == t_pppParam::crdX ||
|
---|
439 | par->type() == t_pppParam::crdY ||
|
---|
440 | par->type() == t_pppParam::crdZ) {
|
---|
441 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
442 | remove = true;
|
---|
443 | }
|
---|
444 | }
|
---|
445 |
|
---|
446 | else if (par->type() == t_pppParam::amb) {
|
---|
447 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
448 | remove = true;
|
---|
449 | }
|
---|
450 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
451 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
452 | char sys = par->prn().system();
|
---|
453 | t_prn refPrn = (refSatMap[sys])->prn();
|
---|
454 | if (par->lastObsTime().valid() && par->prn() == refPrn) {
|
---|
455 | remove = true;
|
---|
456 | }
|
---|
457 | }
|
---|
458 | }
|
---|
459 |
|
---|
460 | else if (par->type() == t_pppParam::ion) {
|
---|
461 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
462 | remove = true;
|
---|
463 | }
|
---|
464 | }
|
---|
465 | if (remove) {
|
---|
466 | #ifdef BNC_DEBUG_PPP
|
---|
467 | LOG << "remove0 " << par->toString() << std::endl;
|
---|
468 | #endif
|
---|
469 | delete par;
|
---|
470 | it = _params.erase(it);
|
---|
471 | }
|
---|
472 | else {
|
---|
473 | ++it;
|
---|
474 | }
|
---|
475 | }
|
---|
476 |
|
---|
477 | // check which systems have observations
|
---|
478 | // -------------------------------------
|
---|
479 | _usedSystems.clear();
|
---|
480 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
481 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
482 | char sys = satObs->prn().system();
|
---|
483 | if (!_usedSystems.contains(sys)) {
|
---|
484 | _usedSystems.append(sys);
|
---|
485 | }
|
---|
486 | }
|
---|
487 |
|
---|
488 | // Check whether parameters have observations
|
---|
489 | // ------------------------------------------
|
---|
490 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
491 | t_pppParam* par = _params[ii];
|
---|
492 | if (par->prn() == 0) {
|
---|
493 | par->setLastObsTime(epoTime);
|
---|
494 | if (par->firstObsTime().undef()) {
|
---|
495 | par->setFirstObsTime(epoTime);
|
---|
496 | }
|
---|
497 | }
|
---|
498 | else {
|
---|
499 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
500 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
501 | if (satObs->prn() == par->prn()) {
|
---|
502 | par->setLastObsTime(epoTime);
|
---|
503 | if (par->firstObsTime().undef()) {
|
---|
504 | par->setFirstObsTime(epoTime);
|
---|
505 | }
|
---|
506 | break;
|
---|
507 | }
|
---|
508 | }
|
---|
509 | }
|
---|
510 | }
|
---|
511 |
|
---|
512 |
|
---|
513 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
514 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
515 | // Check if ambiguity parameters have observations
|
---|
516 | // -----------------------------------------------
|
---|
517 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
518 | QList<t_prn> lostSats;
|
---|
519 | while (it != _params.end()) {
|
---|
520 | t_pppParam* par = *it;
|
---|
521 | if ((par->type() == t_pppParam::amb) &&
|
---|
522 | (!par->lastObsTime().valid() || (epoTime - par->lastObsTime() > 0.0))) {
|
---|
523 | #ifdef BNC_DEBUG_PPP
|
---|
524 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
525 | #endif
|
---|
526 | lostSats.append(par->prn());
|
---|
527 | delete par;
|
---|
528 | it = _params.erase(it);
|
---|
529 | }
|
---|
530 | // Check if systems have to be presented per biases
|
---|
531 | // ----------------------------------------------
|
---|
532 | else if ((par->type() == t_pppParam::cBiasG1 ||
|
---|
533 | par->type() == t_pppParam::cBiasG2 ||
|
---|
534 | par->type() == t_pppParam::pBiasG1 ||
|
---|
535 | par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
|
---|
536 | #ifdef BNC_DEBUG_PPP
|
---|
537 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
538 | #endif
|
---|
539 | delete par;
|
---|
540 | it = _params.erase(it);
|
---|
541 | }
|
---|
542 | else if ((par->type() == t_pppParam::cBiasR1 ||
|
---|
543 | par->type() == t_pppParam::cBiasR2 ||
|
---|
544 | par->type() == t_pppParam::pBiasR1 ||
|
---|
545 | par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
|
---|
546 | #ifdef BNC_DEBUG_PPP
|
---|
547 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
548 | #endif
|
---|
549 | delete par;
|
---|
550 | it = _params.erase(it);
|
---|
551 | }
|
---|
552 | else if ((par->type() == t_pppParam::cBiasE1 ||
|
---|
553 | par->type() == t_pppParam::cBiasE2 ||
|
---|
554 | par->type() == t_pppParam::pBiasE1 ||
|
---|
555 | par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
|
---|
556 | #ifdef BNC_DEBUG_PPP
|
---|
557 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
558 | #endif
|
---|
559 | delete par;
|
---|
560 | it = _params.erase(it);
|
---|
561 | }
|
---|
562 | else if ((par->type() == t_pppParam::cBiasC1 ||
|
---|
563 | par->type() == t_pppParam::cBiasC2 ||
|
---|
564 | par->type() == t_pppParam::pBiasC1 ||
|
---|
565 | par->type() == t_pppParam::pBiasC2) && !usedSystems().contains('C')) {
|
---|
566 | #ifdef BNC_DEBUG_PPP
|
---|
567 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
568 | #endif
|
---|
569 | delete par;
|
---|
570 | it = _params.erase(it);
|
---|
571 | }
|
---|
572 | else {
|
---|
573 | ++it;
|
---|
574 | }
|
---|
575 | }
|
---|
576 | // remove respective iono parameters
|
---|
577 | // ---------------------------------
|
---|
578 | it = _params.begin();
|
---|
579 | while (it != _params.end()) {
|
---|
580 | t_pppParam* par = *it;
|
---|
581 | if ((par->type() == t_pppParam::ion) &&
|
---|
582 | (lostSats.contains(par->prn()) || (epoTime - par->lastObsTime() > 0.0))) {
|
---|
583 | #ifdef BNC_DEBUG_PPP
|
---|
584 | LOG << "remove1 " << par->toString() << std::endl;
|
---|
585 | #endif
|
---|
586 | delete par;
|
---|
587 | it = _params.erase(it);
|
---|
588 | }
|
---|
589 | else {
|
---|
590 | ++it;
|
---|
591 | }
|
---|
592 | }
|
---|
593 | }
|
---|
594 |
|
---|
595 |
|
---|
596 | // Required Set of Parameters
|
---|
597 | // --------------------------
|
---|
598 | vector<t_pppParam*> required;
|
---|
599 |
|
---|
600 | // Coordinates
|
---|
601 | // -----------
|
---|
602 | required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
|
---|
603 | required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
|
---|
604 | required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
|
---|
605 |
|
---|
606 | // Receiver Code Biases
|
---|
607 | // --------------------
|
---|
608 | if (OPT->_obsModelType == OPT->DCMcodeBias) {
|
---|
609 | std::vector<t_lc::type> lc;
|
---|
610 | if (_usedSystems.contains('G')) {
|
---|
611 | lc = OPT->LCs('G');
|
---|
612 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
613 | required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
|
---|
614 | }
|
---|
615 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
616 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
617 | }
|
---|
618 | }
|
---|
619 | if (_usedSystems.contains('R')) {
|
---|
620 | lc = OPT->LCs('R');
|
---|
621 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
622 | required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
|
---|
623 | }
|
---|
624 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
625 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
626 | }
|
---|
627 | }
|
---|
628 | if (_usedSystems.contains('E')) {
|
---|
629 | lc = OPT->LCs('E');
|
---|
630 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
631 | required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
|
---|
632 | }
|
---|
633 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
634 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
635 | }
|
---|
636 | }
|
---|
637 | if (_usedSystems.contains('C')) {
|
---|
638 | lc = OPT->LCs('C');
|
---|
639 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
640 | required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
|
---|
641 | }
|
---|
642 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
643 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
644 | }
|
---|
645 | }
|
---|
646 | }
|
---|
647 |
|
---|
648 | // Receiver Phase Biases
|
---|
649 | // ---------------------
|
---|
650 | if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
|
---|
651 | (OPT->_obsModelType == OPT->PPPRTK) ) {
|
---|
652 | std::vector<t_lc::type> lc;
|
---|
653 | if (_usedSystems.contains('G')) {
|
---|
654 | lc = OPT->LCs('G');
|
---|
655 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
656 | required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
|
---|
657 | }
|
---|
658 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
659 | required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
|
---|
660 | }
|
---|
661 | }
|
---|
662 | if (_usedSystems.contains('R')) {
|
---|
663 | lc = OPT->LCs('R');
|
---|
664 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
665 | required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
|
---|
666 | }
|
---|
667 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
668 | required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
|
---|
669 | }
|
---|
670 | }
|
---|
671 | if (_usedSystems.contains('E')) {
|
---|
672 | lc = OPT->LCs('E');
|
---|
673 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
674 | required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
|
---|
675 | }
|
---|
676 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
677 | required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
|
---|
678 | }
|
---|
679 | }
|
---|
680 | if (_usedSystems.contains('C')) {
|
---|
681 | lc = OPT->LCs('C');
|
---|
682 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
683 | required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
|
---|
684 | }
|
---|
685 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
686 | required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
|
---|
687 | }
|
---|
688 | }
|
---|
689 | }
|
---|
690 |
|
---|
691 | // Receiver Clock
|
---|
692 | // --------------
|
---|
693 | required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
|
---|
694 |
|
---|
695 | // Glonass Clock Offset
|
---|
696 | // --------------------
|
---|
697 | if (_usedSystems.contains('R') && (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
|
---|
698 | required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
|
---|
699 | }
|
---|
700 |
|
---|
701 | // Galileo Clock Offset
|
---|
702 | // --------------------
|
---|
703 | if (_usedSystems.contains('E') && _usedSystems.contains('G')) {
|
---|
704 | required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
|
---|
705 | }
|
---|
706 |
|
---|
707 | // BDS Clock Offset
|
---|
708 | // ----------------
|
---|
709 | if (_usedSystems.contains('C') && (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
|
---|
710 | required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
|
---|
711 | }
|
---|
712 |
|
---|
713 | // Troposphere
|
---|
714 | // -----------
|
---|
715 | if (OPT->estTrp()) {
|
---|
716 | required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
|
---|
717 | }
|
---|
718 |
|
---|
719 | // Ionosphere
|
---|
720 | // ----------
|
---|
721 | if (OPT->_obsModelType == OPT->UncombPPP ||
|
---|
722 | OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
723 | OPT->_obsModelType == OPT->DCMphaseBias ) {
|
---|
724 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
725 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
726 | required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
|
---|
727 | }
|
---|
728 | }
|
---|
729 | // Ambiguities
|
---|
730 | // -----------
|
---|
731 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
732 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
733 | if ((OPT->_obsModelType == OPT->IF) ||
|
---|
734 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
735 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
736 | (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) ||
|
---|
737 | (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) {
|
---|
738 | const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
|
---|
739 | for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
|
---|
740 | required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
|
---|
741 | }
|
---|
742 | }
|
---|
743 | }
|
---|
744 |
|
---|
745 | // Check if all required parameters are present
|
---|
746 | // --------------------------------------------
|
---|
747 | for (unsigned ii = 0; ii < required.size(); ii++) {
|
---|
748 | t_pppParam* parReq = required[ii];
|
---|
749 |
|
---|
750 | bool found = false;
|
---|
751 | for (unsigned jj = 0; jj < _params.size(); jj++) {
|
---|
752 | t_pppParam* parOld = _params[jj];
|
---|
753 | if (parOld->isEqual(parReq)) {
|
---|
754 | found = true;
|
---|
755 | break;
|
---|
756 | }
|
---|
757 | }
|
---|
758 | if (found) {
|
---|
759 | delete parReq;
|
---|
760 | }
|
---|
761 | else {
|
---|
762 | #ifdef BNC_DEBUG_PPP
|
---|
763 | LOG << "push_back parReq " << parReq->toString() << std::endl;
|
---|
764 | #endif
|
---|
765 | _params.push_back(parReq);
|
---|
766 | }
|
---|
767 | }
|
---|
768 |
|
---|
769 | // Set Parameter Indices
|
---|
770 | // ---------------------
|
---|
771 | sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
|
---|
772 |
|
---|
773 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
774 | t_pppParam* par = _params[ii];
|
---|
775 | par->setIndex(ii);
|
---|
776 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
777 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
778 | if (satObs->prn() == par->prn()) {
|
---|
779 | par->setAmbEleSat(satObs->eleSat());
|
---|
780 | par->stepAmbNumEpo();
|
---|
781 | }
|
---|
782 | }
|
---|
783 | }
|
---|
784 |
|
---|
785 | return success;
|
---|
786 | }
|
---|
787 |
|
---|
788 | //
|
---|
789 | ////////////////////////////////////////////////////////////////////////////
|
---|
790 | void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
|
---|
791 | const ColumnVector& xx) const {
|
---|
792 |
|
---|
793 | string epoTimeStr = string(epoTime);
|
---|
794 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
795 |
|
---|
796 | LOG << endl;
|
---|
797 |
|
---|
798 | t_pppParam* parX = 0;
|
---|
799 | t_pppParam* parY = 0;
|
---|
800 | t_pppParam* parZ = 0;
|
---|
801 | vector<t_pppParam*>::const_iterator it = _params.begin();
|
---|
802 | while (it != _params.end()) {
|
---|
803 | t_pppParam* par = *it;
|
---|
804 | if (par->type() == t_pppParam::crdX) {
|
---|
805 | parX = par;
|
---|
806 | }
|
---|
807 | else if (par->type() == t_pppParam::crdY) {
|
---|
808 | parY = par;
|
---|
809 | }
|
---|
810 | else if (par->type() == t_pppParam::crdZ) {
|
---|
811 | parZ = par;
|
---|
812 | }
|
---|
813 | else {
|
---|
814 | int ind = par->indexNew();
|
---|
815 | double apr = (par->type() == t_pppParam::trp) ?
|
---|
816 | t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
|
---|
817 | LOG << epoTimeStr << ' ' << par->toString() << ' '
|
---|
818 | << setw(10) << setprecision(4) << apr << ' '
|
---|
819 | << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
|
---|
820 | << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
|
---|
821 | if (par->type() == t_pppParam::amb) {
|
---|
822 | LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
|
---|
823 | << " epo = " << setw(4) << par->ambNumEpo();
|
---|
824 | }
|
---|
825 | LOG << endl;
|
---|
826 | }
|
---|
827 | ++it;
|
---|
828 | }
|
---|
829 |
|
---|
830 | if (parX && parY && parZ) {
|
---|
831 |
|
---|
832 | ColumnVector xyz(3);
|
---|
833 | xyz[0] = xx[parX->indexNew()];
|
---|
834 | xyz[1] = xx[parY->indexNew()];
|
---|
835 | xyz[2] = xx[parZ->indexNew()];
|
---|
836 |
|
---|
837 | ColumnVector neu(3);
|
---|
838 | xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
|
---|
839 |
|
---|
840 | SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
|
---|
841 |
|
---|
842 | SymmetricMatrix QQneu(3);
|
---|
843 | covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
|
---|
844 |
|
---|
845 | LOG << epoTimeStr << ' ' << sta->name()
|
---|
846 | << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
|
---|
847 | << setprecision(4) << sqrt(QQxyz[0][0])
|
---|
848 |
|
---|
849 | << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
|
---|
850 | << setprecision(4) << sqrt(QQxyz[1][1])
|
---|
851 |
|
---|
852 | << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
|
---|
853 | << setprecision(4) << sqrt(QQxyz[2][2])
|
---|
854 |
|
---|
855 | << " dN = " << setprecision(4) << neu[0] << " +- "
|
---|
856 | << setprecision(4) << sqrt(QQneu[0][0])
|
---|
857 |
|
---|
858 | << " dE = " << setprecision(4) << neu[1] << " +- "
|
---|
859 | << setprecision(4) << sqrt(QQneu[1][1])
|
---|
860 |
|
---|
861 | << " dU = " << setprecision(4) << neu[2] << " +- "
|
---|
862 | << setprecision(4) << sqrt(QQneu[2][2])
|
---|
863 |
|
---|
864 | << endl;
|
---|
865 | }
|
---|
866 | return;
|
---|
867 | }
|
---|
868 |
|
---|
869 | //
|
---|
870 | ////////////////////////////////////////////////////////////////////////////
|
---|
871 | void t_pppParlist::printParams(const bncTime& epoTime) {
|
---|
872 |
|
---|
873 | for (unsigned iPar = 0; iPar < _params.size(); iPar++) {
|
---|
874 | LOG << _params[iPar]->toString()
|
---|
875 | << "\t lastObsTime().valid() \t" << _params[iPar]->lastObsTime().valid()
|
---|
876 | << "\t epoTime - par->lastObsTime() \t" << (epoTime - _params[iPar]->lastObsTime())
|
---|
877 | << endl;
|
---|
878 | }
|
---|
879 | }
|
---|
880 |
|
---|