source: ntrip/trunk/BNC/src/PPP/pppSatObs.cpp@ 10946

Last change on this file since 10946 was 10942, checked in by stuerze, 5 weeks ago

handling of ionospheric constraints descrived/updated

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 23.8 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: t_pppSatObs
6 *
7 * Purpose: Satellite observations
8 *
9 * Author: L. Mervart
10 *
11 * Created: 29-Jul-2014
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17
18#include <iostream>
19#include <iomanip>
20#include <cmath>
21#include <algorithm>
22#include <set>
23#include <newmatio.h>
24
25#include "pppSatObs.h"
26#include "bncconst.h"
27#include "pppEphPool.h"
28#include "pppStation.h"
29#include "bncutils.h"
30#include "bncantex.h"
31#include "pppObsPool.h"
32#include "pppClient.h"
33
34using namespace BNC_PPP;
35using namespace std;
36
37
38// Constructor
39////////////////////////////////////////////////////////////////////////////
40t_pppSatObs::t_pppSatObs(const t_satObs& pppSatObs) {
41 _prn = pppSatObs._prn;
42 _time = pppSatObs._time;
43 _outlier = false;
44 _valid = true;
45 _reference = false;
46 _stecSat = 0.0;
47 _stecRefSat = 0.0;
48 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
49 _obs[ii] = 0;
50 }
51 prepareObs(pppSatObs);
52}
53
54// Destructor
55////////////////////////////////////////////////////////////////////////////
56t_pppSatObs::~t_pppSatObs() {
57 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
58 delete _obs[iFreq];
59 }
60}
61
62//
63////////////////////////////////////////////////////////////////////////////
64bool t_pppSatObs::isBetter(const t_frqObs* aa, t_frqObs* bb, const string& trkModes) const {
65
66 if (!trkModes.empty()) {
67 size_t posA = trkModes.find(aa->trkChar());
68 size_t posB = trkModes.find(bb->trkChar());
69 if (posA != posB) {
70 if (posA == string::npos) {
71 return false;
72 }
73 else if (posB == string::npos) {
74 return true;
75 }
76 else {
77 return posA < posB;
78 }
79 }
80 }
81
82 unsigned numValA = 0;
83 if (aa->_codeValid) numValA += 1;
84 if (aa->_phaseValid) numValA += 1;
85
86 unsigned numValB = 0;
87 if (bb->_codeValid) numValB += 1;
88 if (bb->_phaseValid) numValB += 1;
89
90 if (numValA != numValB) {
91 return numValA > numValB;
92 }
93
94 return false;
95}
96
97//
98////////////////////////////////////////////////////////////////////////////
99void t_pppSatObs::prepareObs(const t_satObs& satObs) {
100
101 _model.reset();
102
103 const t_pppOptions::SysTrkModes* sysTrkModes = OPT->sysTrkModes(_prn.system());
104 using FrqTrkModes = t_pppOptions::SysTrkModes::FrqTrkModes;
105
106 for (const t_frqObs* obs : satObs._obs) {
107 if ( (obs->_codeValid || obs->_phaseValid)) {
108 t_frequency::type frq = t_frequency::toFreq(_prn.system(), obs->frqChar());
109 if (frq == t_frequency::dummy) {
110 continue;
111 }
112 string trkModes;
113 if (sysTrkModes) {
114 const vector<FrqTrkModes>& frqTrkModes = sysTrkModes->_frqTrkModes;
115 auto it = find_if(frqTrkModes.begin(), frqTrkModes.end(),
116 [frq](const FrqTrkModes& mm){return mm._frq == frq;});
117 if (it != frqTrkModes.end()) {
118 trkModes = it->_trkModes;
119 }
120 }
121 if (_obs[frq] == 0 || isBetter(obs, _obs[frq], trkModes)) {
122 delete _obs[frq];
123 _obs[frq] = new t_frqObs(*obs);
124 }
125 }
126 }
127
128 // Check whether all required frequencies available
129 // ------------------------------------------------
130 const std::vector<t_lc>& LCs = OPT->LCs(_prn.system());
131 for (unsigned ii = 0; ii < LCs.size(); ii++) {
132 t_lc LC = LCs[ii];
133 if (LC._type == t_lc::GIM) {
134 continue;
135 }
136 if (LC._frq1 != t_frequency::G5 && !isValid(LC)) {
137 _valid = false;
138 return;
139 }
140 }
141
142 // Find GLONASS Channel Number
143 // ---------------------------
144 if (_prn.system() == 'R') {
145 _channel = PPP_CLIENT->ephPool()->getChannel(_prn);
146 }
147 else {
148 _channel = 0;
149 }
150
151 // Compute Satellite Coordinates at Time of Transmission
152 // -----------------------------------------------------
153 _xcSat.ReSize(6); _xcSat = 0.0;
154 _vvSat.ReSize(3); _vvSat = 0.0;
155 bool totOK = false;
156 ColumnVector satPosOld(6); satPosOld = 0.0;
157
158 _valid = false;
159 t_frequency::type frq1 = t_frequency::dummy;
160 t_frequency::type frq2 = t_frequency::dummy;
161 OPT->defaultFrqs(_prn.system(), frq1, frq2);
162 if (frq1 != t_frequency::dummy) {
163 t_lc lc1(t_lc::code, frq1);
164 if (isValid(lc1)) {
165 _valid = true;
166 _rangeLC = lc1;
167 }
168 if (frq2 != t_frequency::dummy) {
169 t_lc lcIF(t_lc::codeIF, frq1, frq2);
170 if (isValid(lcIF)) {
171 _valid = true;
172 _rangeLC = lcIF;
173 }
174 }
175 }
176 if (!_valid) {
177 return;
178 }
179
180 double prange = obsValue(_rangeLC);
181 for (int ii = 1; ii <= 10; ii++) {
182 bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
183 if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
184 _valid = false;
185 return;
186 }
187 ColumnVector dx = _xcSat - satPosOld;
188 dx[3] *= t_CST::c;
189 if (dx.NormFrobenius() < 1.e-4) {
190 totOK = true;
191 break;
192 }
193 satPosOld = _xcSat;
194 }
195 if (totOK) {
196 _signalPropagationTime = prange / t_CST::c - _xcSat[3];
197 _model._satClkM = _xcSat[3] * t_CST::c;
198 }
199 else {
200 _valid = false;
201 }
202}
203
204//
205////////////////////////////////////////////////////////////////////////////
206void t_pppSatObs::lcCoeff(t_lc LC,
207 map<t_frequency::type, double>& codeCoeff,
208 map<t_frequency::type, double>& phaseCoeff,
209 map<t_frequency::type, double>& ionoCoeff) const {
210
211 codeCoeff.clear();
212 phaseCoeff.clear();
213 ionoCoeff.clear();
214
215 double f1 = t_CST::freq(LC._frq1, _channel);
216 double f2 = t_CST::freq(LC._frq2, _channel);
217 double f1GPS = t_CST::freq(t_frequency::G1, 0);
218
219 switch (LC._type) {
220 case t_lc::phase:
221 phaseCoeff[LC._frq1] = 1.0;
222 ionoCoeff [LC._frq1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);
223 return;
224 case t_lc::code:
225 codeCoeff[LC._frq1] = 1.0;
226 ionoCoeff[LC._frq1] = pow(f1GPS, 2) / pow(f1, 2);
227 return;
228 case t_lc::phaseIF:
229 phaseCoeff[LC._frq1] = f1 * f1 / (f1 * f1 - f2 * f2);
230 phaseCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2);
231 return;
232 case t_lc::codeIF:
233 codeCoeff[LC._frq1] = f1 * f1 / (f1 * f1 - f2 * f2);
234 codeCoeff[LC._frq2] = -f2 * f2 / (f1 * f1 - f2 * f2);
235 return;
236 case t_lc::MW:
237 phaseCoeff[LC._frq1] = f1 / (f1 - f2);
238 phaseCoeff[LC._frq2] = -f2 / (f1 - f2);
239 codeCoeff [LC._frq1] = -f1 / (f1 + f2);
240 codeCoeff [LC._frq2] = -f2 / (f1 + f2);
241 return;
242 case t_lc::CL:
243 phaseCoeff[LC._frq1] = 0.5;
244 codeCoeff [LC._frq1] = 0.5;
245 return;
246 case t_lc::GIM:
247 case t_lc::dummy:
248 case t_lc::maxLc:
249 return;
250 }
251}
252
253//
254////////////////////////////////////////////////////////////////////////////
255bool t_pppSatObs::isValid(t_lc LC) const {
256 bool valid = true;
257 obsValue(LC, &valid);
258
259 return valid;
260}
261//
262////////////////////////////////////////////////////////////////////////////
263double t_pppSatObs::obsValue(t_lc LC, bool* valid) const {
264
265 double retVal = 0.0;
266 if (valid) *valid = true;
267
268 // Pseudo observations (single-differenced: reference minus satellite)
269 if (LC._type == t_lc::GIM) {
270 if (_stecSat == 0.0 || _stecRefSat == 0.0) {
271 if (valid) *valid = false;
272 return 0.0;
273 }
274 else {
275 return _stecRefSat - _stecSat;
276 }
277 }
278
279 map<t_frequency::type, double> codeCoeff;
280 map<t_frequency::type, double> phaseCoeff;
281 map<t_frequency::type, double> ionoCoeff;
282 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
283
284 map<t_frequency::type, double>::const_iterator it;
285
286 // Code observations
287 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
288 t_frequency::type tFreq = it->first;
289 if (_obs[tFreq] == 0) {
290 if (valid) *valid = false;
291 return 0.0;
292 }
293 else {
294 retVal += it->second * _obs[tFreq]->_code;
295 }
296 }
297 // Phase observations
298 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
299 t_frequency::type tFreq = it->first;
300 if (_obs[tFreq] == 0) {
301 if (valid) *valid = false;
302 return 0.0;
303 }
304 else {
305 retVal += it->second * _obs[tFreq]->_phase * t_CST::lambda(tFreq, _channel);
306 }
307 }
308 return retVal;
309}
310
311//
312////////////////////////////////////////////////////////////////////////////
313double t_pppSatObs::lambda(t_lc LC) const {
314
315 double f1 = t_CST::freq(LC._frq1, _channel);
316 double f2 = t_CST::freq(LC._frq2, _channel);
317
318 if (LC._type == t_lc::phase) {
319 return t_CST::c / f1;
320 }
321 else if (LC._type == t_lc::phaseIF) {
322 return t_CST::c / (f1 + f2);
323 }
324 else if (LC._type == t_lc::MW) {
325 return t_CST::c / (f1 - f2);
326 }
327 else if (LC._type == t_lc::CL) {
328 return t_CST::c / f1 / 2.0;
329 }
330
331 return 0.0;
332}
333
334//
335////////////////////////////////////////////////////////////////////////////
336double t_pppSatObs::sigma(t_lc LC) const {
337
338 double retVal = 0.0;
339 map<t_frequency::type, double> codeCoeff;
340 map<t_frequency::type, double> phaseCoeff;
341 map<t_frequency::type, double> ionoCoeff;
342 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
343
344 if (LC._type == t_lc::GIM) {
345 retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
346 }
347
348 map<t_frequency::type, double>::const_iterator it;
349 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
350 retVal += it->second * it->second * OPT->_sigmaC1 * OPT->_sigmaC1;
351 }
352
353 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
354 retVal += it->second * it->second * OPT->_sigmaL1 * OPT->_sigmaL1;
355 }
356
357 retVal = sqrt(retVal);
358
359 // De-Weight R
360 // -----------
361 if (_prn.system() == 'R'&& LC.includesCode()) {
362 retVal *= 5.0;
363 }
364
365 // Elevation-Dependent Weighting
366 // -----------------------------
367 double cEle = 1.0;
368 if ( (OPT->_eleWgtCode && LC.includesCode()) ||
369 (OPT->_eleWgtPhase && LC.includesPhase()) ) {
370 double eleD = eleSat()*180.0/M_PI;
371 double hlp = fabs(90.0 - eleD);
372 cEle = (1.0 + hlp*hlp*hlp*0.000004);
373 }
374
375 return cEle * retVal;
376}
377
378//
379////////////////////////////////////////////////////////////////////////////
380double t_pppSatObs::maxRes(t_lc LC) const {
381 double retVal = 0.0;
382
383 map<t_frequency::type, double> codeCoeff;
384 map<t_frequency::type, double> phaseCoeff;
385 map<t_frequency::type, double> ionoCoeff;
386 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
387
388 map<t_frequency::type, double>::const_iterator it;
389 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
390 retVal += it->second * it->second * OPT->_maxResC1 * OPT->_maxResC1;
391 }
392 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
393 retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1;
394 }
395
396 retVal = sqrt(retVal);
397
398 return retVal;
399}
400
401
402//
403////////////////////////////////////////////////////////////////////////////
404t_irc t_pppSatObs::cmpModel(const t_pppStation* station) {
405
406 // Reset all model values
407 // ----------------------
408 _model.reset();
409
410 // Topocentric Satellite Position
411 // ------------------------------
412 ColumnVector rSat = _xcSat.Rows(1,3);
413 ColumnVector rRec = station->xyzApr();
414 ColumnVector rhoV = rSat - rRec;
415 _model._rho = rhoV.NormFrobenius();
416
417 ColumnVector vSat = _vvSat;
418
419 ColumnVector neu(3);
420 xyz2neu(station->ellApr().data(), rhoV.data(), neu.data());
421
422 _model._eleSat = acos(sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho);
423 if (neu[2] < 0.0) {
424 _model._eleSat *= -1.0;
425 }
426 _model._azSat = atan2(neu[1], neu[0]);
427
428 // Sun unit vector
429 ColumnVector xSun = t_astro::Sun(_time.mjddec());
430 xSun /= xSun.norm_Frobenius();
431
432 // Satellite unit vectors sz, sy, sx
433 ColumnVector sz = -rSat / rSat.norm_Frobenius();
434 ColumnVector sy = crossproduct(sz, xSun);
435 ColumnVector sx = crossproduct(sy, sz);
436
437 sx /= sx.norm_Frobenius();
438 sy /= sy.norm_Frobenius();
439
440 // LOS unit vector satellite --> receiver
441 ColumnVector rho = rRec - rSat;
442 rho /= rho.norm_Frobenius();
443
444 // LOS vector in satellite frame
445 ColumnVector u(3);
446 u(1) = dotproduct(sx, rho);
447 u(2) = dotproduct(sy, rho);
448 u(3) = dotproduct(sz, rho);
449
450 // Azimuth and elevation in satellite antenna frame
451 _model._elTx = atan2(u(3),sqrt(pow(u(2),2)+pow(u(1),2)));
452 _model._azTx = atan2(u(2),u(1));
453
454
455 // Satellite Clocks
456 // ----------------
457 _model._satClkM = _xcSat[3] * t_CST::c; // satellite system specific
458
459 // Receiver Clocks
460 // ---------------
461 _model._recClkM = station->dClk() * t_CST::c;
462
463 // Sagnac Effect (correction due to Earth rotation)
464 // ------------------------------------------------
465 ColumnVector Omega(3);
466 Omega[0] = 0.0;
467 Omega[1] = 0.0;
468 Omega[2] = t_CST::omega / t_CST::c;
469 _model._sagnac = DotProduct(Omega, crossproduct(rSat, rRec));
470
471 // Antenna Eccentricity
472 // --------------------
473 _model._antEcc = -DotProduct(station->xyzEcc(), rhoV) / _model._rho;
474
475 // Antenna Phase Center Offsets and Variations
476 // -------------------------------------------
477 if (PPP_CLIENT->antex()) {
478 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
479 t_frequency::type frqType = static_cast<t_frequency::type>(ii);
480 string frqStr = t_frequency::toString(frqType);
481 if (frqStr[0] != _prn.system()) {continue;}
482 bool found;
483 QString prn(_prn.toString().c_str());
484 _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
485 _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
486 if (OPT->_isAPC && found) {
487 // the PCOs as given in the satellite antenna correction for all frequencies
488 // have to be reduced by the PCO of the respective reference frequency
489 if (_prn.system() == 'G') {
490 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
491 }
492 else if (_prn.system() == 'R') {
493 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
494 }
495 else if (_prn.system() == 'E') {
496 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
497 }
498 else if (_prn.system() == 'C') {
499 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
500 }
501 }
502 }
503 }
504
505 // Tropospheric Delay
506 // ------------------
507 _model._tropo = t_tropo::delay_saast(rRec, _model._eleSat);
508
509 // Code Biases
510 // -----------
511 const t_satCodeBias* satCodeBias = PPP_CLIENT->obsPool()->satCodeBias(_prn);
512 if (satCodeBias) {
513 for (unsigned ii = 0; ii < satCodeBias->_bias.size(); ii++) {
514 const t_frqCodeBias& bias = satCodeBias->_bias[ii];
515 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
516 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
517 if (frqStr[0] != _prn.system()) {
518 continue;
519 }
520 const t_frqObs* obs = _obs[iFreq];
521 if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
522 _model._codeBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
523 }
524 }
525 }
526 }
527
528 // Phase Biases
529 // -----------
530 double yaw = 0.0;
531 bool useYaw = false;
532 if (OPT->arSystem(_prn.system())) {
533 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
534 if (satPhaseBias) {
535 if (OPT->_ar._useYaw) {
536 double dt = station->epochTime() - satPhaseBias->_time;
537 if (satPhaseBias->_updateInt) {
538 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]);
539 }
540 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt;
541 useYaw = true;
542 }
543 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
544 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
545 if (bias._fixIndicator) { // if AR, biases without fixIndicator not used
546 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
547 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
548 if (frqStr[0] != _prn.system()) {
549 continue;
550 }
551 t_frqObs* obs = _obs[iFreq];
552 if (obs && obs->_rnxType2ch[0] == bias._rnxType2ch[0]) { // allow different tracking mode
553 _model._phaseBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
554 obs->_biasJumpCounter = bias._jumpCounter;
555 }
556 }
557 }
558 }
559 }
560 }
561
562 // Phase Wind-Up
563 // -------------
564 _model._windUp = station->windUp(_time, _prn, rSat, useYaw, yaw, vSat) ;
565
566 // Relativistic effect due to earth gravity
567 // ----------------------------------------
568 double a = rSat.NormFrobenius() + rRec.NormFrobenius();
569 double b = (rSat - rRec).NormFrobenius();
570 double gm = 3.986004418e14; // m3/s2
571 _model._rel = 2 * gm / t_CST::c / t_CST::c * log((a + b) / (a - b));
572
573 // Tidal Correction
574 // ----------------
575 _model._tideEarth = -DotProduct(station->tideDsplEarth(), rhoV) / _model._rho;
576 _model._tideOcean = -DotProduct(station->tideDsplOcean(), rhoV) / _model._rho;
577
578 // Ionospheric Delay
579 // -----------------
580 const t_vTec* vTec = PPP_CLIENT->obsPool()->vTec();
581 bool vTecUsage = true;
582 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
583 t_lc LC = OPT->LCs(_prn.system())[ii];
584 if (LC._type == t_lc::codeIF || LC._type == t_lc::phaseIF) {
585 vTecUsage = false;
586 }
587 }
588
589 if (vTecUsage && vTec) {
590 double stec = station->stec(vTec, _signalPropagationTime, rSat);
591 double f1GPS = t_CST::freq(t_frequency::G1, 0);
592 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
593 if (OPT->_pseudoObsIono) {
594 // For scaling the slant ionospheric delays the trick is to be consistent with units!
595 // The conversion of TECU into meters requires the frequency of the signal.
596 // Hence, GPS L1 frequency is used for all systems. The same is true for mu_i in lcCoeff().
597 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(f1GPS, 2) * stec;
598 }
599 else { // PPP-RTK
600 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
601 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;
602 }
603 }
604 }
605
606 // Set Model Set Flag
607 // ------------------
608 _model._set = true;
609
610 if (OPT->_logMode == t_pppOptions::all) {
611 printModel();
612 }
613
614 return success;
615}
616
617//
618////////////////////////////////////////////////////////////////////////////
619void t_pppSatObs::printModel() const {
620
621 LOG.setf(ios::fixed);
622 LOG << "\nMODEL for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "")
623
624 << "\n======================= " << endl
625 << "PPP "
626 << ((OPT->_pseudoObsIono) ? " with pseudo-observations for STEC" : "") << endl
627 << "RHO : " << setw(12) << setprecision(3) << _model._rho << endl
628 << "ELE : " << setw(12) << setprecision(3) << _model._eleSat * RHO_DEG << endl
629 << "AZI : " << setw(12) << setprecision(3) << _model._azSat * RHO_DEG << endl
630 << "SATCLK : " << setw(12) << setprecision(3) << _model._satClkM << endl
631 << "RECCLK : " << setw(12) << setprecision(3) << _model._recClkM << endl
632 << "SAGNAC : " << setw(12) << setprecision(3) << _model._sagnac << endl
633 << "ANTECC : " << setw(12) << setprecision(3) << _model._antEcc << endl
634 << "TROPO : " << setw(12) << setprecision(3) << _model._tropo << endl
635 << "WINDUP : " << setw(12) << setprecision(3) << _model._windUp << endl
636 << "REL : " << setw(12) << setprecision(3) << _model._rel << endl
637 << "EARTH TIDES : " << setw(12) << setprecision(3) << _model._tideEarth << endl
638 << "OCEAN TIDES : " << setw(12) << setprecision(3) << _model._tideOcean << endl
639 << endl
640 << "FREQUENCY DEPENDENT CORRECTIONS:" << endl
641 << "-------------------------------" << endl;
642 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
643 if (_obs[iFreq]) {
644 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
645 if (_prn.system() == frqStr[0]) {
646 LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl
647 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
648 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
649 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl;
650 }
651 }
652 }
653}
654
655//
656////////////////////////////////////////////////////////////////////////////
657void t_pppSatObs::printObsMinusComputed() const {
658 LOG.setf(ios::fixed);
659 LOG << "\nOBS-COMP for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "") << endl
660 << "========================== " << endl;
661 char sys = _prn.system();
662 for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) {
663 t_lc LC = OPT->LCs(sys)[ii];
664 LOG << "OBS-CMP " << setw(4) << LC.toString() << ": " << _prn.toString() << " "
665 << setw(12) << setprecision(3) << obsValue(LC) << " "
666 << setw(12) << setprecision(3) << cmpValue(LC) << " "
667 << setw(12) << setprecision(3) << obsValue(LC) - cmpValue(LC) << endl;
668 }
669}
670
671//
672////////////////////////////////////////////////////////////////////////////
673double t_pppSatObs::cmpValueForBanc(t_lc LC) const {
674 return cmpValue(LC) - _model._rho - _model._sagnac - _model._recClkM;
675}
676
677//
678////////////////////////////////////////////////////////////////////////////
679double t_pppSatObs::cmpValue(t_lc LC) const {
680 double cmpValue;
681
682 if (!isValid(LC)) {
683 cmpValue = 0.0;
684 }
685 else if (LC._type == t_lc::GIM) {
686 cmpValue = 0.0;
687 }
688 else {
689 // Non-Dispersive Part
690 // -------------------
691 double nonDisp = _model._rho
692 + _model._recClkM - _model._satClkM
693 + _model._sagnac + _model._antEcc + _model._tropo
694 + _model._tideEarth + _model._tideOcean + _model._rel;
695
696 // Add Dispersive Part
697 // -------------------
698 double dispPart = 0.0;
699 map<t_frequency::type, double> codeCoeff;
700 map<t_frequency::type, double> phaseCoeff;
701 map<t_frequency::type, double> ionoCoeff;
702 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
703 map<t_frequency::type, double>::const_iterator it;
704 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
705 t_frequency::type tFreq = it->first;
706 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
707 }
708 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
709 t_frequency::type tFreq = it->first;
710 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
711 _model._windUp * t_CST::lambda(tFreq, _channel));
712 }
713 cmpValue = nonDisp + dispPart;
714 }
715
716 return cmpValue;
717}
718
719//
720////////////////////////////////////////////////////////////////////////////
721void t_pppSatObs::setRes(t_lc LC, double res) {
722 _res[LC] = res;
723}
724
725//
726////////////////////////////////////////////////////////////////////////////
727double t_pppSatObs::getRes(t_lc LC) const {
728 map<t_lc, double>::const_iterator it = _res.find(LC);
729 if (it != _res.end()) {
730 return it->second;
731 }
732 else {
733 return 0.0;
734 }
735}
736
737//
738////////////////////////////////////////////////////////////////////////////
739bool t_pppSatObs::setPseudoObsIono(t_frequency::type freq, double stecRefSat) {
740 _stecSat = _model._ionoCodeDelay[freq];
741 _stecRefSat = stecRefSat;
742 return (_stecSat != 0.0 && _stecRefSat != 0.0);
743}
744
745//
746////////////////////////////////////////////////////////////////////////////
747bool t_pppSatObs::hasBiases() const {
748 bool ar = OPT->arSystem(_prn.system());
749 set<t_frequency::type> frqs;
750 for (const auto& lc : OPT->LCs(_prn.system())) {
751 if (lc._frq1 != t_frequency::dummy) frqs.insert(lc._frq1);
752 if (lc._frq2 != t_frequency::dummy) frqs.insert(lc._frq2);
753 }
754 for (int iFreq : frqs) {
755 if (_obs[iFreq] != 0) {
756 if (_model._codeBias[iFreq] == 0 || (ar && _model._phaseBias[iFreq] == 0)) {
757 return false;
758 }
759 }
760 }
761 return true;
762}
Note: See TracBrowser for help on using the repository browser.