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

Last change on this file since 10938 was 10938, checked in by stuerze, 11 days ago

bugfix regarding ionospheric constraints

  • 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.9 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 if (LC._type == t_lc::GIM) {
396 retVal = OPT->_maxResGIM * OPT->_maxResGIM + OPT->_maxResGIM * OPT->_maxResGIM;
397 }
398
399 retVal = sqrt(retVal);
400
401 return retVal;
402}
403
404
405//
406////////////////////////////////////////////////////////////////////////////
407t_irc t_pppSatObs::cmpModel(const t_pppStation* station) {
408
409 // Reset all model values
410 // ----------------------
411 _model.reset();
412
413 // Topocentric Satellite Position
414 // ------------------------------
415 ColumnVector rSat = _xcSat.Rows(1,3);
416 ColumnVector rRec = station->xyzApr();
417 ColumnVector rhoV = rSat - rRec;
418 _model._rho = rhoV.NormFrobenius();
419
420 ColumnVector vSat = _vvSat;
421
422 ColumnVector neu(3);
423 xyz2neu(station->ellApr().data(), rhoV.data(), neu.data());
424
425 _model._eleSat = acos(sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho);
426 if (neu[2] < 0.0) {
427 _model._eleSat *= -1.0;
428 }
429 _model._azSat = atan2(neu[1], neu[0]);
430
431 // Sun unit vector
432 ColumnVector xSun = t_astro::Sun(_time.mjddec());
433 xSun /= xSun.norm_Frobenius();
434
435 // Satellite unit vectors sz, sy, sx
436 ColumnVector sz = -rSat / rSat.norm_Frobenius();
437 ColumnVector sy = crossproduct(sz, xSun);
438 ColumnVector sx = crossproduct(sy, sz);
439
440 sx /= sx.norm_Frobenius();
441 sy /= sy.norm_Frobenius();
442
443 // LOS unit vector satellite --> receiver
444 ColumnVector rho = rRec - rSat;
445 rho /= rho.norm_Frobenius();
446
447 // LOS vector in satellite frame
448 ColumnVector u(3);
449 u(1) = dotproduct(sx, rho);
450 u(2) = dotproduct(sy, rho);
451 u(3) = dotproduct(sz, rho);
452
453 // Azimuth and elevation in satellite antenna frame
454 _model._elTx = atan2(u(3),sqrt(pow(u(2),2)+pow(u(1),2)));
455 _model._azTx = atan2(u(2),u(1));
456
457
458 // Satellite Clocks
459 // ----------------
460 _model._satClkM = _xcSat[3] * t_CST::c; // satellite system specific
461
462 // Receiver Clocks
463 // ---------------
464 _model._recClkM = station->dClk() * t_CST::c;
465
466 // Sagnac Effect (correction due to Earth rotation)
467 // ------------------------------------------------
468 ColumnVector Omega(3);
469 Omega[0] = 0.0;
470 Omega[1] = 0.0;
471 Omega[2] = t_CST::omega / t_CST::c;
472 _model._sagnac = DotProduct(Omega, crossproduct(rSat, rRec));
473
474 // Antenna Eccentricity
475 // --------------------
476 _model._antEcc = -DotProduct(station->xyzEcc(), rhoV) / _model._rho;
477
478 // Antenna Phase Center Offsets and Variations
479 // -------------------------------------------
480 if (PPP_CLIENT->antex()) {
481 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
482 t_frequency::type frqType = static_cast<t_frequency::type>(ii);
483 string frqStr = t_frequency::toString(frqType);
484 if (frqStr[0] != _prn.system()) {continue;}
485 bool found;
486 QString prn(_prn.toString().c_str());
487 _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
488 _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
489 if (OPT->_isAPC && found) {
490 // the PCOs as given in the satellite antenna correction for all frequencies
491 // have to be reduced by the PCO of the respective reference frequency
492 if (_prn.system() == 'G') {
493 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
494 }
495 else if (_prn.system() == 'R') {
496 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
497 }
498 else if (_prn.system() == 'E') {
499 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
500 }
501 else if (_prn.system() == 'C') {
502 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
503 }
504 }
505 }
506 }
507
508 // Tropospheric Delay
509 // ------------------
510 _model._tropo = t_tropo::delay_saast(rRec, _model._eleSat);
511
512 // Code Biases
513 // -----------
514 const t_satCodeBias* satCodeBias = PPP_CLIENT->obsPool()->satCodeBias(_prn);
515 if (satCodeBias) {
516 for (unsigned ii = 0; ii < satCodeBias->_bias.size(); ii++) {
517 const t_frqCodeBias& bias = satCodeBias->_bias[ii];
518 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
519 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
520 if (frqStr[0] != _prn.system()) {
521 continue;
522 }
523 const t_frqObs* obs = _obs[iFreq];
524 if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
525 _model._codeBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
526 }
527 }
528 }
529 }
530
531 // Phase Biases
532 // -----------
533 double yaw = 0.0;
534 bool useYaw = false;
535 if (OPT->arSystem(_prn.system())) {
536 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
537 if (satPhaseBias) {
538 if (OPT->_ar._useYaw) {
539 double dt = station->epochTime() - satPhaseBias->_time;
540 if (satPhaseBias->_updateInt) {
541 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]);
542 }
543 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt;
544 useYaw = true;
545 }
546 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
547 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
548 if (bias._fixIndicator) { // if AR, biases without fixIndicator not used
549 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
550 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
551 if (frqStr[0] != _prn.system()) {
552 continue;
553 }
554 t_frqObs* obs = _obs[iFreq];
555 if (obs && obs->_rnxType2ch[0] == bias._rnxType2ch[0]) { // allow different tracking mode
556 _model._phaseBias[iFreq] = (bias._value != 0.0 ? bias._value : ZEROVALUE);
557 obs->_biasJumpCounter = bias._jumpCounter;
558 }
559 }
560 }
561 }
562 }
563 }
564
565 // Phase Wind-Up
566 // -------------
567 _model._windUp = station->windUp(_time, _prn, rSat, useYaw, yaw, vSat) ;
568
569 // Relativistic effect due to earth gravity
570 // ----------------------------------------
571 double a = rSat.NormFrobenius() + rRec.NormFrobenius();
572 double b = (rSat - rRec).NormFrobenius();
573 double gm = 3.986004418e14; // m3/s2
574 _model._rel = 2 * gm / t_CST::c / t_CST::c * log((a + b) / (a - b));
575
576 // Tidal Correction
577 // ----------------
578 _model._tideEarth = -DotProduct(station->tideDsplEarth(), rhoV) / _model._rho;
579 _model._tideOcean = -DotProduct(station->tideDsplOcean(), rhoV) / _model._rho;
580
581 // Ionospheric Delay
582 // -----------------
583 const t_vTec* vTec = PPP_CLIENT->obsPool()->vTec();
584 bool vTecUsage = true;
585 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
586 t_lc LC = OPT->LCs(_prn.system())[ii];
587 if (LC._type == t_lc::codeIF || LC._type == t_lc::phaseIF) {
588 vTecUsage = false;
589 }
590 }
591
592 if (vTecUsage && vTec) {
593 double stec = station->stec(vTec, _signalPropagationTime, rSat);
594 double f1GPS = t_CST::freq(t_frequency::G1, 0);
595 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
596 if (OPT->_pseudoObsIono) {
597 // For scaling the slant ionospheric delays the trick is to be consistent with units!
598 // The conversion of TECU into meters requires the frequency of the signal.
599 // Hence, GPS L1 frequency is used for all systems. The same is true for mu_i in lcCoeff().
600 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(f1GPS, 2) * stec;
601 }
602 else { // PPP-RTK
603 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
604 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;
605 }
606 }
607 }
608
609 // Set Model Set Flag
610 // ------------------
611 _model._set = true;
612
613 if (OPT->_logMode == t_pppOptions::all) {
614 printModel();
615 }
616
617 return success;
618}
619
620//
621////////////////////////////////////////////////////////////////////////////
622void t_pppSatObs::printModel() const {
623
624 LOG.setf(ios::fixed);
625 LOG << "\nMODEL for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "")
626
627 << "\n======================= " << endl
628 << "PPP "
629 << ((OPT->_pseudoObsIono) ? " with pseudo-observations for STEC" : "") << endl
630 << "RHO : " << setw(12) << setprecision(3) << _model._rho << endl
631 << "ELE : " << setw(12) << setprecision(3) << _model._eleSat * RHO_DEG << endl
632 << "AZI : " << setw(12) << setprecision(3) << _model._azSat * RHO_DEG << endl
633 << "SATCLK : " << setw(12) << setprecision(3) << _model._satClkM << endl
634 << "RECCLK : " << setw(12) << setprecision(3) << _model._recClkM << endl
635 << "SAGNAC : " << setw(12) << setprecision(3) << _model._sagnac << endl
636 << "ANTECC : " << setw(12) << setprecision(3) << _model._antEcc << endl
637 << "TROPO : " << setw(12) << setprecision(3) << _model._tropo << endl
638 << "WINDUP : " << setw(12) << setprecision(3) << _model._windUp << endl
639 << "REL : " << setw(12) << setprecision(3) << _model._rel << endl
640 << "EARTH TIDES : " << setw(12) << setprecision(3) << _model._tideEarth << endl
641 << "OCEAN TIDES : " << setw(12) << setprecision(3) << _model._tideOcean << endl
642 << endl
643 << "FREQUENCY DEPENDENT CORRECTIONS:" << endl
644 << "-------------------------------" << endl;
645 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
646 if (_obs[iFreq]) {
647 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
648 if (_prn.system() == frqStr[0]) {
649 LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl
650 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
651 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]->trkChar() << ") " << endl
652 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl;
653 }
654 }
655 }
656}
657
658//
659////////////////////////////////////////////////////////////////////////////
660void t_pppSatObs::printObsMinusComputed() const {
661 LOG.setf(ios::fixed);
662 LOG << "\nOBS-COMP for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "") << endl
663 << "========================== " << endl;
664 char sys = _prn.system();
665 for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) {
666 t_lc LC = OPT->LCs(sys)[ii];
667 LOG << "OBS-CMP " << setw(4) << LC.toString() << ": " << _prn.toString() << " "
668 << setw(12) << setprecision(3) << obsValue(LC) << " "
669 << setw(12) << setprecision(3) << cmpValue(LC) << " "
670 << setw(12) << setprecision(3) << obsValue(LC) - cmpValue(LC) << endl;
671 }
672}
673
674//
675////////////////////////////////////////////////////////////////////////////
676double t_pppSatObs::cmpValueForBanc(t_lc LC) const {
677 return cmpValue(LC) - _model._rho - _model._sagnac - _model._recClkM;
678}
679
680//
681////////////////////////////////////////////////////////////////////////////
682double t_pppSatObs::cmpValue(t_lc LC) const {
683 double cmpValue;
684
685 if (!isValid(LC)) {
686 cmpValue = 0.0;
687 }
688 else if (LC._type == t_lc::GIM) {
689 cmpValue = 0.0;
690 }
691 else {
692 // Non-Dispersive Part
693 // -------------------
694 double nonDisp = _model._rho
695 + _model._recClkM - _model._satClkM
696 + _model._sagnac + _model._antEcc + _model._tropo
697 + _model._tideEarth + _model._tideOcean + _model._rel;
698
699 // Add Dispersive Part
700 // -------------------
701 double dispPart = 0.0;
702 map<t_frequency::type, double> codeCoeff;
703 map<t_frequency::type, double> phaseCoeff;
704 map<t_frequency::type, double> ionoCoeff;
705 lcCoeff(LC, codeCoeff, phaseCoeff, ionoCoeff);
706 map<t_frequency::type, double>::const_iterator it;
707 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
708 t_frequency::type tFreq = it->first;
709 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
710 }
711 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
712 t_frequency::type tFreq = it->first;
713 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
714 _model._windUp * t_CST::lambda(tFreq, _channel));
715 }
716 cmpValue = nonDisp + dispPart;
717 }
718
719 return cmpValue;
720}
721
722//
723////////////////////////////////////////////////////////////////////////////
724void t_pppSatObs::setRes(t_lc LC, double res) {
725 _res[LC] = res;
726}
727
728//
729////////////////////////////////////////////////////////////////////////////
730double t_pppSatObs::getRes(t_lc LC) const {
731 map<t_lc, double>::const_iterator it = _res.find(LC);
732 if (it != _res.end()) {
733 return it->second;
734 }
735 else {
736 return 0.0;
737 }
738}
739
740//
741////////////////////////////////////////////////////////////////////////////
742bool t_pppSatObs::setPseudoObsIono(t_frequency::type freq, double stecRefSat) {
743 _stecSat = _model._ionoCodeDelay[freq];
744 _stecRefSat = stecRefSat;
745 return (_stecSat != 0.0 && _stecRefSat != 0.0);
746}
747
748//
749////////////////////////////////////////////////////////////////////////////
750bool t_pppSatObs::hasBiases() const {
751 bool ar = OPT->arSystem(_prn.system());
752 set<t_frequency::type> frqs;
753 for (const auto& lc : OPT->LCs(_prn.system())) {
754 if (lc._frq1 != t_frequency::dummy) frqs.insert(lc._frq1);
755 if (lc._frq2 != t_frequency::dummy) frqs.insert(lc._frq2);
756 }
757 for (int iFreq : frqs) {
758 if (_obs[iFreq] != 0) {
759 if (_model._codeBias[iFreq] == 0 || (ar && _model._phaseBias[iFreq] == 0)) {
760 return false;
761 }
762 }
763 }
764 return true;
765}
Note: See TracBrowser for help on using the repository browser.