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