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

Last change on this file since 9821 was 9821, checked in by stuerze, 3 months ago

minor changes

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