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 offGR = 0;
|
---|
77 | if (_prn.system() == 'R' && tLC != t_lc::MW) {
|
---|
78 | offGR = PPP_CLIENT->offGR();
|
---|
79 | }
|
---|
80 | double offGE = 0;
|
---|
81 | if (_prn.system() == 'E' && tLC != t_lc::MW) {
|
---|
82 | offGE = PPP_CLIENT->offGE();
|
---|
83 | }
|
---|
84 | double offGC = 0;
|
---|
85 | if (_prn.system() == 'C' && tLC != t_lc::MW) {
|
---|
86 | offGC = PPP_CLIENT->offGC();
|
---|
87 | }
|
---|
88 | _x0 = floor((obs->obsValue(tLC) - offGR -offGE - offGC - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
|
---|
89 | break;
|
---|
90 | }
|
---|
91 | }
|
---|
92 | }
|
---|
93 | break;
|
---|
94 | case offGR:
|
---|
95 | _epoSpec = true;
|
---|
96 | _sigma0 = OPT->_aprSigOGR;
|
---|
97 | _x0 = PPP_CLIENT->offGR();
|
---|
98 | break;
|
---|
99 | case offGE:
|
---|
100 | _epoSpec = true;
|
---|
101 | _sigma0 = OPT->_aprSigOGE;
|
---|
102 | _x0 = PPP_CLIENT->offGE();
|
---|
103 | break;
|
---|
104 | case offGC:
|
---|
105 | _epoSpec = true;
|
---|
106 | _sigma0 = OPT->_aprSigOGC;
|
---|
107 | _x0 = PPP_CLIENT->offGC();
|
---|
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 = true;
|
---|
122 | _sigma0 = OPT->_aprSigCodeBias;
|
---|
123 | break;
|
---|
124 | case pBiasG1: case pBiasE1: case pBiasR1: case pBiasC1:
|
---|
125 | case pBiasG2: case pBiasE2: case pBiasR2: case pBiasC2:
|
---|
126 | _epoSpec = true;
|
---|
127 | _sigma0 = OPT->_aprSigPhaseBias;
|
---|
128 | break;
|
---|
129 | }
|
---|
130 | }
|
---|
131 |
|
---|
132 | // Destructor
|
---|
133 | ////////////////////////////////////////////////////////////////////////////
|
---|
134 | t_pppParam::~t_pppParam() {
|
---|
135 | delete _ambInfo;
|
---|
136 | }
|
---|
137 |
|
---|
138 | //
|
---|
139 | ////////////////////////////////////////////////////////////////////////////
|
---|
140 | double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
|
---|
141 | const t_lc::type& tLC, const t_prn refPrn) const {
|
---|
142 |
|
---|
143 | // Special Case - Melbourne-Wuebbena
|
---|
144 | // ---------------------------------
|
---|
145 | if (tLC == t_lc::MW && _type != amb) {
|
---|
146 | return 0.0;
|
---|
147 | }
|
---|
148 |
|
---|
149 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
150 | ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
|
---|
151 |
|
---|
152 | map<t_frequency::type, double> codeCoeff;
|
---|
153 | map<t_frequency::type, double> phaseCoeff;
|
---|
154 | map<t_frequency::type, double> ionoCoeff;
|
---|
155 | obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
|
---|
156 |
|
---|
157 | switch (_type) {
|
---|
158 | case crdX:
|
---|
159 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
160 | return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
|
---|
161 | case crdY:
|
---|
162 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
163 | return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
|
---|
164 | case crdZ:
|
---|
165 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
166 | return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
|
---|
167 | case clkR:
|
---|
168 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
169 | return 1.0;
|
---|
170 | case offGR:
|
---|
171 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
172 | return (obs->prn().system() == 'R') ? 1.0 : 0.0;
|
---|
173 | case offGE:
|
---|
174 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
175 | return (obs->prn().system() == 'E') ? 1.0 : 0.0;
|
---|
176 | case offGC:
|
---|
177 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
178 | return (obs->prn().system() == 'C') ? 1.0 : 0.0;
|
---|
179 | case amb:
|
---|
180 | if (tLC == t_lc::GIM || tLC == t_lc::Tz0) {return 0.0;}
|
---|
181 | else if ((OPT->_obsModelType == OPT->IF) ||
|
---|
182 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
183 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
184 | (OPT->_obsModelType == OPT->DCMcodeBias && !obs->isReference()) ||
|
---|
185 | (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference()) ) {
|
---|
186 |
|
---|
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 if (tLC == t_lc::Tz0) {
|
---|
210 | return 1.0;
|
---|
211 | }
|
---|
212 | else {
|
---|
213 | return 1.0 / sin(obs->eleSat());
|
---|
214 | }
|
---|
215 | case ion:
|
---|
216 | if (obs->prn() == _prn) {
|
---|
217 | if (tLC == t_lc::c1) {
|
---|
218 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c1)];
|
---|
219 | }
|
---|
220 | else if (tLC == t_lc::c2) {
|
---|
221 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::c2)];
|
---|
222 | }
|
---|
223 | else if (tLC == t_lc::l1) {
|
---|
224 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l1)];
|
---|
225 | }
|
---|
226 | else if (tLC == t_lc::l2) {
|
---|
227 | return ionoCoeff[t_lc::toFreq(obs->prn().system(),t_lc::l2)];
|
---|
228 | }
|
---|
229 | else if (tLC == t_lc::GIM) {
|
---|
230 | return -1.0;
|
---|
231 | }
|
---|
232 | }
|
---|
233 | if (tLC == t_lc::GIM && _prn == refPrn) {
|
---|
234 | return 1.0;
|
---|
235 | }
|
---|
236 | break;
|
---|
237 | case cBiasG1:
|
---|
238 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
239 | break;
|
---|
240 | case cBiasR1:
|
---|
241 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
242 | break;
|
---|
243 | case cBiasE1:
|
---|
244 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
245 | break;
|
---|
246 | case cBiasC1:
|
---|
247 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
248 | break;
|
---|
249 | case cBiasG2:
|
---|
250 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
251 | break;
|
---|
252 | case cBiasR2:
|
---|
253 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
254 | break;
|
---|
255 | case cBiasE2:
|
---|
256 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
257 | break;
|
---|
258 | case cBiasC2:
|
---|
259 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
260 | break;
|
---|
261 | case pBiasG1:
|
---|
262 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
263 | break;
|
---|
264 | case pBiasR1:
|
---|
265 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
266 | break;
|
---|
267 | case pBiasE1:
|
---|
268 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
269 | break;
|
---|
270 | case pBiasC1:
|
---|
271 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
272 | break;
|
---|
273 | case pBiasG2:
|
---|
274 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
275 | break;
|
---|
276 | case pBiasR2:
|
---|
277 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
278 | break;
|
---|
279 | case pBiasE2:
|
---|
280 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
281 | break;
|
---|
282 | case pBiasC2:
|
---|
283 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
284 | break;
|
---|
285 |
|
---|
286 | }
|
---|
287 | return 0.0;
|
---|
288 | }
|
---|
289 |
|
---|
290 | //
|
---|
291 | ////////////////////////////////////////////////////////////////////////////
|
---|
292 | string t_pppParam::toString() const {
|
---|
293 | stringstream ss;
|
---|
294 | switch (_type) {
|
---|
295 | case crdX:
|
---|
296 | ss << "CRD_X";
|
---|
297 | break;
|
---|
298 | case crdY:
|
---|
299 | ss << "CRD_Y";
|
---|
300 | break;
|
---|
301 | case crdZ:
|
---|
302 | ss << "CRD_Z";
|
---|
303 | break;
|
---|
304 | case clkR:
|
---|
305 | ss << "REC_CLK ";
|
---|
306 | break;
|
---|
307 | case offGR:
|
---|
308 | ss << "OGR ";
|
---|
309 | break;
|
---|
310 | case offGE:
|
---|
311 | ss << "OGE ";
|
---|
312 | break;
|
---|
313 | case offGC:
|
---|
314 | ss << "OGC ";
|
---|
315 | break;
|
---|
316 | case trp:
|
---|
317 | ss << "TRP ";
|
---|
318 | break;
|
---|
319 | case amb:
|
---|
320 | ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
321 | break;
|
---|
322 | case ion:
|
---|
323 | ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
324 | break;
|
---|
325 | case cBiasG1: case pBiasG1:
|
---|
326 | case cBiasG2: case pBiasG2:
|
---|
327 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
|
---|
328 | break;
|
---|
329 | case cBiasR1: case pBiasR1:
|
---|
330 | case cBiasR2: case pBiasR2:
|
---|
331 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
|
---|
332 | break;
|
---|
333 | case cBiasE1: case pBiasE1:
|
---|
334 | case cBiasE2: case pBiasE2:
|
---|
335 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
|
---|
336 | break;
|
---|
337 | case cBiasC1: case pBiasC1:
|
---|
338 | case cBiasC2: case pBiasC2:
|
---|
339 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
|
---|
340 | break;
|
---|
341 | }
|
---|
342 | return ss.str();
|
---|
343 | }
|
---|
344 |
|
---|
345 | // Constructor
|
---|
346 | ////////////////////////////////////////////////////////////////////////////
|
---|
347 | t_pppParlist::t_pppParlist() {
|
---|
348 | }
|
---|
349 |
|
---|
350 | // Destructor
|
---|
351 | ////////////////////////////////////////////////////////////////////////////
|
---|
352 | t_pppParlist::~t_pppParlist() {
|
---|
353 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
354 | delete _params[ii];
|
---|
355 | }
|
---|
356 | }
|
---|
357 |
|
---|
358 | //
|
---|
359 | ////////////////////////////////////////////////////////////////////////////
|
---|
360 | t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
|
---|
361 | const QMap<char, t_pppRefSat*>& refSatMap) {
|
---|
362 |
|
---|
363 | // Remove some Parameters
|
---|
364 | // ----------------------
|
---|
365 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
366 | while (it != _params.end()) {
|
---|
367 | t_pppParam* par = *it;
|
---|
368 |
|
---|
369 | bool remove = false;
|
---|
370 |
|
---|
371 | if (par->epoSpec()) {
|
---|
372 | remove = true;
|
---|
373 | }
|
---|
374 |
|
---|
375 | else if (par->type() == t_pppParam::crdX ||
|
---|
376 | par->type() == t_pppParam::crdY ||
|
---|
377 | par->type() == t_pppParam::crdZ) {
|
---|
378 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
379 | remove = true;
|
---|
380 | }
|
---|
381 | }
|
---|
382 |
|
---|
383 | else if (par->type() == t_pppParam::amb) {
|
---|
384 | if (OPT->_obsModelType == OPT->DCMcodeBias || OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
385 | t_prn refPrn = (refSatMap[par->prn().system()])->prn();
|
---|
386 | if (par->lastObsTime().valid() &&
|
---|
387 | ((epoTime - par->lastObsTime() > 1.0) || (par->prn() == refPrn))) {
|
---|
388 | remove = true;
|
---|
389 | }
|
---|
390 | }
|
---|
391 | else {
|
---|
392 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
393 | remove = true;
|
---|
394 | }
|
---|
395 | }
|
---|
396 | }
|
---|
397 |
|
---|
398 | else if (par->type() == t_pppParam::ion) {
|
---|
399 | if (OPT->_obsModelType == OPT->DCMcodeBias || OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
400 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 1.0)) {
|
---|
401 | remove = true;
|
---|
402 | }
|
---|
403 | }
|
---|
404 | else {
|
---|
405 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
406 | remove = true;
|
---|
407 | }
|
---|
408 | }
|
---|
409 | }
|
---|
410 | if (remove) {
|
---|
411 | delete par;
|
---|
412 | it = _params.erase(it);
|
---|
413 | }
|
---|
414 | else {
|
---|
415 | ++it;
|
---|
416 | }
|
---|
417 | }
|
---|
418 |
|
---|
419 | // Check whether parameters have observations
|
---|
420 | // ------------------------------------------
|
---|
421 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
422 | t_pppParam* par = _params[ii];
|
---|
423 | if (par->prn() == 0) {
|
---|
424 | par->setLastObsTime(epoTime);
|
---|
425 | if (par->firstObsTime().undef()) {
|
---|
426 | par->setFirstObsTime(epoTime);
|
---|
427 | }
|
---|
428 | }
|
---|
429 | else {
|
---|
430 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
431 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
432 | if (satObs->prn() == par->prn()) {
|
---|
433 | par->setLastObsTime(epoTime);
|
---|
434 | if (par->firstObsTime().undef()) {
|
---|
435 | par->setFirstObsTime(epoTime);
|
---|
436 | }
|
---|
437 | break;
|
---|
438 | }
|
---|
439 | }
|
---|
440 | }
|
---|
441 | }
|
---|
442 |
|
---|
443 | // Check if ambiguity parameters have observations
|
---|
444 | // -----------------------------------------------
|
---|
445 | if (OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
446 | OPT->_obsModelType == OPT->DCMphaseBias) {
|
---|
447 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
448 | while (it != _params.end()) {
|
---|
449 | t_pppParam* par = *it;
|
---|
450 | bool remove = false;
|
---|
451 | if (par->type() == t_pppParam::amb && !par->lastObsTime().valid()) {
|
---|
452 | remove = true;
|
---|
453 | }
|
---|
454 | if (remove) {
|
---|
455 | delete par;
|
---|
456 | it = _params.erase(it);
|
---|
457 | }
|
---|
458 | else {
|
---|
459 | ++it;
|
---|
460 | }
|
---|
461 | }
|
---|
462 | }
|
---|
463 |
|
---|
464 | // check which systems have observations
|
---|
465 | // -------------------------------------
|
---|
466 | _usedSystems.clear();
|
---|
467 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
468 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
469 | char sys = satObs->prn().system();
|
---|
470 | if (!_usedSystems.contains(sys)) {
|
---|
471 | _usedSystems.append(sys);
|
---|
472 | }
|
---|
473 | }
|
---|
474 |
|
---|
475 | if (_usedSystems.size() > 1 &&
|
---|
476 | !_usedSystems.contains('G')) { // required to setup ISB w. r. t. GPS
|
---|
477 | return failure;
|
---|
478 | }
|
---|
479 |
|
---|
480 | // Required Set of Parameters
|
---|
481 | // --------------------------
|
---|
482 | vector<t_pppParam*> required;
|
---|
483 |
|
---|
484 | // Coordinates
|
---|
485 | // -----------
|
---|
486 | required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
|
---|
487 | required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
|
---|
488 | required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
|
---|
489 |
|
---|
490 | // Receiver Code Biases
|
---|
491 | // --------------------
|
---|
492 | if (OPT->_obsModelType == OPT->DCMcodeBias) {
|
---|
493 | if (_usedSystems.contains('G')) {
|
---|
494 | required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
|
---|
495 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
496 | }
|
---|
497 | if (_usedSystems.contains('R')) {
|
---|
498 | required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
|
---|
499 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
500 | }
|
---|
501 | if (_usedSystems.contains('E')) {
|
---|
502 | required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
|
---|
503 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
504 | }
|
---|
505 | if (_usedSystems.contains('C')) {
|
---|
506 | required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
|
---|
507 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
508 | }
|
---|
509 | }
|
---|
510 |
|
---|
511 | // Receiver Phase Biases
|
---|
512 | // ---------------------
|
---|
513 | if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
|
---|
514 | (OPT->_obsModelType == OPT->PPPRTK) ) {
|
---|
515 | if (_usedSystems.contains('G')) {
|
---|
516 | required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
|
---|
517 | required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
|
---|
518 | }
|
---|
519 | if (_usedSystems.contains('R')) {
|
---|
520 | required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
|
---|
521 | required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
|
---|
522 | }
|
---|
523 | if (_usedSystems.contains('E')) {
|
---|
524 | required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
|
---|
525 | required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
|
---|
526 | }
|
---|
527 | if (_usedSystems.contains('C')) {
|
---|
528 | required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
|
---|
529 | required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
|
---|
530 | }
|
---|
531 | }
|
---|
532 |
|
---|
533 | // Receiver Clock
|
---|
534 | // --------------
|
---|
535 | required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
|
---|
536 |
|
---|
537 | // GPS-GLONASS Clock Offset
|
---|
538 | // ------------------------
|
---|
539 | if (_usedSystems.contains('G') && _usedSystems.contains('R')) {
|
---|
540 | required.push_back(new t_pppParam(t_pppParam::offGR, t_prn(), t_lc::dummy));
|
---|
541 | }
|
---|
542 |
|
---|
543 | //GPS-Galileo Clock Offset
|
---|
544 | // ------------------------
|
---|
545 | if (_usedSystems.contains('G') && _usedSystems.contains('E')) {
|
---|
546 | required.push_back(new t_pppParam(t_pppParam::offGE, t_prn(), t_lc::dummy));
|
---|
547 | }
|
---|
548 |
|
---|
549 | // GPS-BDS Clock Offset
|
---|
550 | // ------------------------
|
---|
551 | if (_usedSystems.contains('G') && _usedSystems.contains('C')) {
|
---|
552 | required.push_back(new t_pppParam(t_pppParam::offGC, t_prn(), t_lc::dummy));
|
---|
553 | }
|
---|
554 |
|
---|
555 | // Troposphere
|
---|
556 | // -----------
|
---|
557 | if (OPT->estTrp()) {
|
---|
558 | required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
|
---|
559 | }
|
---|
560 |
|
---|
561 | // Ionosphere
|
---|
562 | // ----------
|
---|
563 | if (OPT->_obsModelType == OPT->UncombPPP ||
|
---|
564 | OPT->_obsModelType == OPT->DCMcodeBias ||
|
---|
565 | OPT->_obsModelType == OPT->DCMphaseBias ) {
|
---|
566 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
567 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
568 | required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
|
---|
569 | }
|
---|
570 | }
|
---|
571 | // Ambiguities
|
---|
572 | // -----------
|
---|
573 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
574 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
575 | if ((OPT->_obsModelType == OPT->IF) ||
|
---|
576 | (OPT->_obsModelType == OPT->PPPRTK) ||
|
---|
577 | (OPT->_obsModelType == OPT->UncombPPP) ||
|
---|
578 | (OPT->_obsModelType == OPT->DCMcodeBias && !satObs->isReference()) ||
|
---|
579 | (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference()) ) {
|
---|
580 | const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
|
---|
581 | for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
|
---|
582 | required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
|
---|
583 | }
|
---|
584 | }
|
---|
585 | }
|
---|
586 |
|
---|
587 | // Check if all required parameters are present
|
---|
588 | // --------------------------------------------
|
---|
589 | for (unsigned ii = 0; ii < required.size(); ii++) {
|
---|
590 | t_pppParam* parReq = required[ii];
|
---|
591 |
|
---|
592 | bool found = false;
|
---|
593 | for (unsigned jj = 0; jj < _params.size(); jj++) {
|
---|
594 | t_pppParam* parOld = _params[jj];
|
---|
595 | if (parOld->isEqual(parReq)) {
|
---|
596 | found = true;
|
---|
597 | break;
|
---|
598 | }
|
---|
599 | }
|
---|
600 | if (found) {
|
---|
601 | delete parReq;
|
---|
602 | }
|
---|
603 | else {
|
---|
604 | _params.push_back(parReq);
|
---|
605 | }
|
---|
606 | }
|
---|
607 |
|
---|
608 | // Set Parameter Indices
|
---|
609 | // ---------------------
|
---|
610 | sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
|
---|
611 |
|
---|
612 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
613 | t_pppParam* par = _params[ii];
|
---|
614 | par->setIndex(ii);
|
---|
615 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
616 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
617 | if (satObs->prn() == par->prn()) {
|
---|
618 | par->setAmbEleSat(satObs->eleSat());
|
---|
619 | par->stepAmbNumEpo();
|
---|
620 | }
|
---|
621 | }
|
---|
622 | }
|
---|
623 |
|
---|
624 | return success;
|
---|
625 | }
|
---|
626 |
|
---|
627 | //
|
---|
628 | ////////////////////////////////////////////////////////////////////////////
|
---|
629 | void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
|
---|
630 | const ColumnVector& xx) const {
|
---|
631 |
|
---|
632 | string epoTimeStr = string(epoTime);
|
---|
633 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
634 |
|
---|
635 | LOG << endl;
|
---|
636 |
|
---|
637 | t_pppParam* parX = 0;
|
---|
638 | t_pppParam* parY = 0;
|
---|
639 | t_pppParam* parZ = 0;
|
---|
640 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
641 | t_pppParam* par = _params[ii];
|
---|
642 | if (par->type() == t_pppParam::crdX) {
|
---|
643 | parX = par;
|
---|
644 | }
|
---|
645 | else if (par->type() == t_pppParam::crdY) {
|
---|
646 | parY = par;
|
---|
647 | }
|
---|
648 | else if (par->type() == t_pppParam::crdZ) {
|
---|
649 | parZ = par;
|
---|
650 | }
|
---|
651 | else {
|
---|
652 | int ind = par->indexNew();
|
---|
653 | double apr = (par->type() == t_pppParam::trp) ?
|
---|
654 | t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
|
---|
655 | LOG << epoTimeStr << ' ' << par->toString() << ' '
|
---|
656 | << setw(10) << setprecision(4) << apr << ' '
|
---|
657 | << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
|
---|
658 | << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
|
---|
659 | if (par->type() == t_pppParam::amb) {
|
---|
660 | LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
|
---|
661 | << " epo = " << setw(4) << par->ambNumEpo();
|
---|
662 | }
|
---|
663 | LOG << endl;
|
---|
664 | }
|
---|
665 | }
|
---|
666 |
|
---|
667 | if (parX && parY && parZ) {
|
---|
668 |
|
---|
669 | ColumnVector xyz(3);
|
---|
670 | xyz[0] = xx[parX->indexNew()];
|
---|
671 | xyz[1] = xx[parY->indexNew()];
|
---|
672 | xyz[2] = xx[parZ->indexNew()];
|
---|
673 |
|
---|
674 | ColumnVector neu(3);
|
---|
675 | xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
|
---|
676 |
|
---|
677 | SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
|
---|
678 |
|
---|
679 | SymmetricMatrix QQneu(3);
|
---|
680 | covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
|
---|
681 |
|
---|
682 | LOG << epoTimeStr << ' ' << sta->name()
|
---|
683 | << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
|
---|
684 | << setprecision(4) << sqrt(QQxyz[0][0])
|
---|
685 |
|
---|
686 | << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
|
---|
687 | << setprecision(4) << sqrt(QQxyz[1][1])
|
---|
688 |
|
---|
689 | << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
|
---|
690 | << setprecision(4) << sqrt(QQxyz[2][2])
|
---|
691 |
|
---|
692 | << " dN = " << setprecision(4) << neu[0] << " +- "
|
---|
693 | << setprecision(4) << sqrt(QQneu[0][0])
|
---|
694 |
|
---|
695 | << " dE = " << setprecision(4) << neu[1] << " +- "
|
---|
696 | << setprecision(4) << sqrt(QQneu[1][1])
|
---|
697 |
|
---|
698 | << " dU = " << setprecision(4) << neu[2] << " +- "
|
---|
699 | << setprecision(4) << sqrt(QQneu[2][2])
|
---|
700 |
|
---|
701 | << endl;
|
---|
702 | }
|
---|
703 | }
|
---|
704 |
|
---|