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

Last change on this file since 10589 was 10582, checked in by stuerze, 4 days ago
  • 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.0 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
35
36// Constructor
37////////////////////////////////////////////////////////////////////////////
38t_pppSatObs::t_pppSatObs(const t_satObs& pppSatObs) {
39 _prn = pppSatObs._prn;
40 _time = pppSatObs._time;
41 _outlier = false;
42 _valid = true;
43 _reference = false;
44 _stecSat = 0.0;
45 _signalPriorities = QString::fromStdString(OPT->_signalPriorities);
46 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
47 _obs[ii] = 0;
48 }
49 prepareObs(pppSatObs);
50}
51
52// Destructor
53////////////////////////////////////////////////////////////////////////////
54t_pppSatObs::~t_pppSatObs() {
55 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
56 delete _obs[iFreq];
57 }
58}
59
60//
61////////////////////////////////////////////////////////////////////////////
62void t_pppSatObs::prepareObs(const t_satObs& pppSatObs) {
63
64 _model.reset();
65
66 std::vector<char> bb = OPT->frqBands(_prn.system());
67 char frqNum1 = '0';
68 if (bb.size() >= 1) {
69 frqNum1 = bb[0];
70 }
71 char frqNum2 = '0';
72 if (bb.size() == 2) {
73 frqNum2 = bb[1];
74 }
75
76 // Select pseudo-ranges and phase observations
77 // -------------------------------------------
78 QStringList priorList = _signalPriorities.split(" ", Qt::SkipEmptyParts);
79 string preferredAttrib;
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 (frqSys != _prn.system()) {
85 continue;
86 }
87 if (frqNum != frqNum1 &&
88 frqNum != frqNum2 ) {
89 continue;
90 }
91 QStringList hlp;
92 for (int ii = 0; ii < priorList.size(); ii++) {
93 if (priorList[ii].indexOf(":") != -1) {
94 hlp = priorList[ii].split(":", Qt::SkipEmptyParts);
95 if (hlp.size() == 2 && hlp[0].length() == 1 && hlp[0][0] == frqSys) {
96 hlp = hlp[1].split("&", Qt::SkipEmptyParts);
97 }
98 if (hlp.size() == 2 && hlp[0].indexOf(frqNum) != -1) {
99 preferredAttrib = hlp[1].toStdString(); //cout << "preferredAttrib: " << preferredAttrib << endl;
100 }
101 }
102 for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) {
103 QString obsType = QString("%1").arg(frqNum) + preferredAttrib[iPref]; //cout << "obstype: " << obsType.toStdString().c_str() << endl;
104 if (_obs[iFreq] == 0) {
105 for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
106 const t_frqObs* obs = pppSatObs._obs[ii];
107 //cout << "observation2char: " << obs->_rnxType2ch << " vs. " << obsType.toStdString().c_str()<< endl;
108 if (obs->_rnxType2ch == obsType.toStdString() &&
109 obs->_codeValid && obs->_code &&
110 obs->_phaseValid && obs->_phase) {
111 _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch << " obs->_lockTime: " << obs->_lockTime << endl;
112 }
113 }
114 }
115 }
116 }
117 }
118
119 // Used frequency types
120 // --------------------
121 _fType1 = t_frqBand::toFreq(_prn.system(), frqNum1);
122 _fType2 = t_frqBand::toFreq(_prn.system(), frqNum2);
123
124 // Check whether all required frequencies available
125 // ------------------------------------------------
126 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
127 t_lc::type tLC = OPT->LCs(_prn.system())[ii];
128 if (tLC == t_lc::GIM) {continue;}
129 if (!isValid(tLC)) {
130 _valid = false;
131 return;
132 }
133 }
134
135 // Find GLONASS Channel Number
136 // ---------------------------
137 if (_prn.system() == 'R') {
138 _channel = PPP_CLIENT->ephPool()->getChannel(_prn);
139 }
140 else {
141 _channel = 0;
142 }
143 if (_prn.system() == 'E') {
144 // force I/NAV usage
145 _prn.setFlags(1);
146 }
147
148
149
150 // Compute Satellite Coordinates at Time of Transmission
151 // -----------------------------------------------------
152 _xcSat.ReSize(6); _xcSat = 0.0;
153 _vvSat.ReSize(3); _vvSat = 0.0;
154 bool totOK = false;
155 ColumnVector satPosOld(6); satPosOld = 0.0;
156 t_lc::type tLC = t_lc::dummy;
157 if (isValid(t_lc::cIF)) {
158 tLC = t_lc::cIF;
159 }
160 if (tLC == t_lc::dummy && isValid(t_lc::c1)) {
161 tLC = t_lc::c1;
162 }
163 if (tLC == t_lc::dummy && isValid(t_lc::c2)) {
164 tLC = t_lc::c2;
165 }
166 if (tLC == t_lc::dummy) {
167 _valid = false;
168 return;
169 }
170 double prange = obsValue(tLC);
171 for (int ii = 1; ii <= 10; ii++) {
172 bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
173 if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
174 _valid = false;
175 return;
176 }
177 ColumnVector dx = _xcSat - satPosOld;
178 dx[3] *= t_CST::c;
179 if (dx.NormFrobenius() < 1.e-4) {
180 totOK = true;
181 break;
182 }
183 satPosOld = _xcSat;
184 }
185 if (totOK) {
186 _signalPropagationTime = prange / t_CST::c - _xcSat[3];
187 _model._satClkM = _xcSat[3] * t_CST::c;
188 }
189 else {
190 _valid = false;
191 }
192}
193
194//
195////////////////////////////////////////////////////////////////////////////
196void t_pppSatObs::lcCoeff(t_lc::type tLC,
197 map<t_frequency::type, double>& codeCoeff,
198 map<t_frequency::type, double>& phaseCoeff,
199 map<t_frequency::type, double>& ionoCoeff) const {
200
201 codeCoeff.clear();
202 phaseCoeff.clear();
203 ionoCoeff.clear();
204
205 double f1 = t_CST::freq(_fType1, _channel);
206 double f2 = t_CST::freq(_fType2, _channel);
207 double f1GPS = t_CST::freq(t_frequency::G1, 0);
208
209 switch (tLC) {
210 case t_lc::l1:
211 phaseCoeff[_fType1] = 1.0;
212 ionoCoeff [_fType1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);
213 return;
214 case t_lc::l2:
215 phaseCoeff[_fType2] = 1.0;
216 ionoCoeff [_fType2] = -1.0 * pow(f1GPS, 2) / pow(f2, 2);
217 return;
218 case t_lc::lIF:
219 phaseCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
220 phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
221 return;
222 case t_lc::MW:
223 phaseCoeff[_fType1] = f1 / (f1 - f2);
224 phaseCoeff[_fType2] = -f2 / (f1 - f2);
225 codeCoeff[_fType1] = -f1 / (f1 + f2);
226 codeCoeff[_fType2] = -f2 / (f1 + f2);
227 return;
228 case t_lc::CL:
229 phaseCoeff[_fType1] = 0.5;
230 codeCoeff [_fType1] = 0.5;
231 return;
232 case t_lc::c1:
233 codeCoeff[_fType1] = 1.0;
234 ionoCoeff[_fType1] = pow(f1GPS, 2) / pow(f1, 2);
235 return;
236 case t_lc::c2:
237 codeCoeff[_fType2] = 1.0;
238 ionoCoeff[_fType2] = pow(f1GPS, 2) / pow(f2, 2);
239 return;
240 case t_lc::cIF:
241 codeCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
242 codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
243 return;
244 case t_lc::GIM:
245 case t_lc::dummy:
246 case t_lc::maxLc:
247 return;
248 }
249}
250
251//
252////////////////////////////////////////////////////////////////////////////
253bool t_pppSatObs::isValid(t_lc::type tLC) const {
254 bool valid = true;
255 obsValue(tLC, &valid);
256
257 return valid;
258}
259//
260////////////////////////////////////////////////////////////////////////////
261double t_pppSatObs::obsValue(t_lc::type tLC, bool* valid) const {
262
263 double retVal = 0.0;
264 if (valid) *valid = true;
265
266 // Pseudo observations
267 if (tLC == t_lc::GIM) {
268 if (_stecSat == 0.0) {
269 if (valid) *valid = false;
270 return 0.0;
271 }
272 else {
273 return _stecSat;
274 }
275 }
276
277 map<t_frequency::type, double> codeCoeff;
278 map<t_frequency::type, double> phaseCoeff;
279 map<t_frequency::type, double> ionoCoeff;
280 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
281
282 map<t_frequency::type, double>::const_iterator it;
283
284 // Code observations
285 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
286 t_frequency::type tFreq = it->first;
287 if (_obs[tFreq] == 0) {
288 if (valid) *valid = false;
289 return 0.0;
290 }
291 else {
292 retVal += it->second * _obs[tFreq]->_code;
293 }
294 }
295 // Phase observations
296 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
297 t_frequency::type tFreq = it->first;
298 if (_obs[tFreq] == 0) {
299 if (valid) *valid = false;
300 return 0.0;
301 }
302 else {
303 retVal += it->second * _obs[tFreq]->_phase * t_CST::lambda(tFreq, _channel);
304 }
305 }
306 return retVal;
307}
308
309//
310////////////////////////////////////////////////////////////////////////////
311double t_pppSatObs::lambda(t_lc::type tLC) const {
312
313 double f1 = t_CST::freq(_fType1, _channel);
314 double f2 = t_CST::freq(_fType2, _channel);
315
316 if (tLC == t_lc::l1) {
317 return t_CST::c / f1;
318 }
319 else if (tLC == t_lc::l2) {
320 return t_CST::c / f2;
321 }
322 else if (tLC == t_lc::lIF) {
323 return t_CST::c / (f1 + f2);
324 }
325 else if (tLC == t_lc::MW) {
326 return t_CST::c / (f1 - f2);
327 }
328 else if (tLC == t_lc::CL) {
329 return t_CST::c / f1 / 2.0;
330 }
331
332 return 0.0;
333}
334
335//
336////////////////////////////////////////////////////////////////////////////
337double t_pppSatObs::sigma(t_lc::type tLC) const {
338
339 double retVal = 0.0;
340 map<t_frequency::type, double> codeCoeff;
341 map<t_frequency::type, double> phaseCoeff;
342 map<t_frequency::type, double> ionoCoeff;
343 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
344
345 if (tLC == t_lc::GIM) {
346 retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
347 }
348
349 map<t_frequency::type, double>::const_iterator it;
350 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
351 retVal += it->second * it->second * OPT->_sigmaC1 * OPT->_sigmaC1;
352 }
353
354 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
355 retVal += it->second * it->second * OPT->_sigmaL1 * OPT->_sigmaL1;
356 }
357
358 retVal = sqrt(retVal);
359
360 // De-Weight R
361 // -----------
362 if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {
363 retVal *= 5.0;
364 }
365
366 // Elevation-Dependent Weighting
367 // -----------------------------
368 double cEle = 1.0;
369 if ( (OPT->_eleWgtCode && t_lc::includesCode(tLC)) ||
370 (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {
371 double eleD = eleSat()*180.0/M_PI;
372 double hlp = fabs(90.0 - eleD);
373 cEle = (1.0 + hlp*hlp*hlp*0.000004);
374 }
375
376 return cEle * retVal;
377}
378
379//
380////////////////////////////////////////////////////////////////////////////
381double t_pppSatObs::maxRes(t_lc::type tLC) const {
382 double retVal = 0.0;
383
384 map<t_frequency::type, double> codeCoeff;
385 map<t_frequency::type, double> phaseCoeff;
386 map<t_frequency::type, double> ionoCoeff;
387 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
388
389 map<t_frequency::type, double>::const_iterator it;
390 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
391 retVal += it->second * it->second * OPT->_maxResC1 * OPT->_maxResC1;
392 }
393 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
394 retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1;
395 }
396 if (tLC == t_lc::GIM) {
397 retVal = OPT->_maxResGIM * OPT->_maxResGIM + OPT->_maxResGIM * OPT->_maxResGIM;
398 }
399
400 retVal = sqrt(retVal);
401
402 // De-Weight R
403 // -----------
404 if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {
405 retVal *= 5.0;
406 }
407
408 return retVal;
409}
410
411
412//
413////////////////////////////////////////////////////////////////////////////
414t_irc t_pppSatObs::cmpModel(const t_pppStation* station) {
415
416 // Reset all model values
417 // ----------------------
418 _model.reset();
419
420 // Topocentric Satellite Position
421 // ------------------------------
422 ColumnVector rSat = _xcSat.Rows(1,3);
423 ColumnVector rRec = station->xyzApr();
424 ColumnVector rhoV = rSat - rRec;
425 _model._rho = rhoV.NormFrobenius();
426
427 ColumnVector vSat = _vvSat;
428
429 ColumnVector neu(3);
430 xyz2neu(station->ellApr().data(), rhoV.data(), neu.data());
431
432 _model._eleSat = acos(sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho);
433 if (neu[2] < 0.0) {
434 _model._eleSat *= -1.0;
435 }
436 _model._azSat = atan2(neu[1], neu[0]);
437
438 // Sun unit vector
439 ColumnVector xSun = t_astro::Sun(_time.mjddec());
440 xSun /= xSun.norm_Frobenius();
441
442 // Satellite unit vectors sz, sy, sx
443 ColumnVector sz = -rSat / rSat.norm_Frobenius();
444 ColumnVector sy = crossproduct(sz, xSun);
445 ColumnVector sx = crossproduct(sy, sz);
446
447 sx /= sx.norm_Frobenius();
448 sy /= sy.norm_Frobenius();
449
450 // LOS unit vector satellite --> receiver
451 ColumnVector rho = rRec - rSat;
452 rho /= rho.norm_Frobenius();
453
454 // LOS vector in satellite frame
455 ColumnVector u(3);
456 u(1) = dotproduct(sx, rho);
457 u(2) = dotproduct(sy, rho);
458 u(3) = dotproduct(sz, rho);
459
460 // Azimuth and elevation in satellite antenna frame
461 _model._elTx = atan2(u(3),sqrt(pow(u(2),2)+pow(u(1),2)));
462 _model._azTx = atan2(u(2),u(1));
463
464
465 // Satellite Clocks
466 // ----------------
467 _model._satClkM = _xcSat[3] * t_CST::c;
468
469 // Receiver Clocks
470 // ---------------
471 _model._recClkM = station->dClk() * t_CST::c;
472
473 // Sagnac Effect (correction due to Earth rotation)
474 // ------------------------------------------------
475 ColumnVector Omega(3);
476 Omega[0] = 0.0;
477 Omega[1] = 0.0;
478 Omega[2] = t_CST::omega / t_CST::c;
479 _model._sagnac = DotProduct(Omega, crossproduct(rSat, rRec));
480
481 // Antenna Eccentricity
482 // --------------------
483 _model._antEcc = -DotProduct(station->xyzEcc(), rhoV) / _model._rho;
484
485 // Antenna Phase Center Offsets and Variations
486 // -------------------------------------------
487 if (PPP_CLIENT->antex()) {
488 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
489 t_frequency::type frqType = static_cast<t_frequency::type>(ii);
490 string frqStr = t_frequency::toString(frqType);
491 if (frqStr[0] != _prn.system()) {continue;}
492 bool found;
493 QString prn(_prn.toString().c_str());
494 _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
495 _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
496 if (OPT->_isAPC && found) {
497 // the PCOs as given in the satellite antenna correction for all frequencies
498 // have to be reduced by the PCO of the respective reference frequency
499 if (_prn.system() == 'G') {
500 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
501 }
502 else if (_prn.system() == 'R') {
503 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
504 }
505 else if (_prn.system() == 'E') {
506 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
507 }
508 else if (_prn.system() == 'C') {
509 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
510 }
511 }
512 }
513 }
514
515 // Tropospheric Delay
516 // ------------------
517 _model._tropo = t_tropo::delay_saast(rRec, _model._eleSat);
518
519 // Code Biases
520 // -----------
521 const t_satCodeBias* satCodeBias = PPP_CLIENT->obsPool()->satCodeBias(_prn);
522 if (satCodeBias) {
523 for (unsigned ii = 0; ii < satCodeBias->_bias.size(); ii++) {
524 const t_frqCodeBias& bias = satCodeBias->_bias[ii];
525 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
526 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
527 if (frqStr[0] != _prn.system()) {
528 continue;
529 }
530 const t_frqObs* obs = _obs[iFreq];
531 if (obs &&
532 obs->_rnxType2ch == bias._rnxType2ch) {
533 _model._codeBias[iFreq] = bias._value;
534 }
535 }
536 }
537 }
538
539 // Phase Biases
540 // -----------
541 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
542 double yaw = 0.0;
543 bool ssr = false;
544 if (satPhaseBias) {
545 double dt = station->epochTime() - satPhaseBias->_time;
546 if (satPhaseBias->_updateInt) {
547 dt -= (0.5 * ssrUpdateInt[satPhaseBias->_updateInt]);
548 }
549 yaw = satPhaseBias->_yaw + satPhaseBias->_yawRate * dt;
550 ssr = true;
551 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
552 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
553 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
554 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
555 if (frqStr[0] != _prn.system()) {
556 continue;
557 }
558 const t_frqObs* obs = _obs[iFreq];
559 if (obs &&
560 obs->_rnxType2ch == bias._rnxType2ch) {
561 _model._phaseBias[iFreq] = bias._value;
562 }
563 }
564 }
565 }
566
567 // Phase Wind-Up
568 // -------------
569 _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ;
570
571 // Relativistic effect due to earth gravity
572 // ----------------------------------------
573 double a = rSat.NormFrobenius() + rRec.NormFrobenius();
574 double b = (rSat - rRec).NormFrobenius();
575 double gm = 3.986004418e14; // m3/s2
576 _model._rel = 2 * gm / t_CST::c / t_CST::c * log((a + b) / (a - b));
577
578 // Tidal Correction
579 // ----------------
580 _model._tideEarth = -DotProduct(station->tideDsplEarth(), rhoV) / _model._rho;
581 _model._tideOcean = -DotProduct(station->tideDsplOcean(), rhoV) / _model._rho;
582
583 // Ionospheric Delay
584 // -----------------
585 const t_vTec* vTec = PPP_CLIENT->obsPool()->vTec();
586 bool vTecUsage = true;
587 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
588 t_lc::type tLC = OPT->LCs(_prn.system())[ii];
589 if (tLC == t_lc::cIF || tLC == t_lc::lIF) {
590 vTecUsage = false;
591 }
592 }
593
594 if (vTecUsage && vTec) {
595 double stec = station->stec(vTec, _signalPropagationTime, rSat);
596 double f1GPS = t_CST::freq(t_frequency::G1, 0);
597 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
598 if (OPT->_pseudoObsIono) {
599 // For scaling the slant ionospheric delays the trick is to be consistent with units!
600 // The conversion of TECU into meters requires the frequency of the signal.
601 // Hence, GPS L1 frequency is used for all systems. The same is true for mu_i in lcCoeff().
602 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(f1GPS, 2) * stec;
603 }
604 else { // PPP-RTK
605 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
606 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;
607 }
608 }
609 }
610
611 // Set Model Set Flag
612 // ------------------
613 _model._set = true;
614
615 //printModel();
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]->_rnxType2ch[1] << ") " << endl
651 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << 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::type tLC = OPT->LCs(sys)[ii];
667 LOG << "OBS-CMP " << setw(4) << t_lc::toString(tLC) << ": " << _prn.toString() << " "
668 << setw(12) << setprecision(3) << obsValue(tLC) << " "
669 << setw(12) << setprecision(3) << cmpValue(tLC) << " "
670 << setw(12) << setprecision(3) << obsValue(tLC) - cmpValue(tLC) << endl;
671 }
672}
673
674//
675////////////////////////////////////////////////////////////////////////////
676double t_pppSatObs::cmpValueForBanc(t_lc::type tLC) const {
677 return cmpValue(tLC) - _model._rho - _model._sagnac - _model._recClkM;
678}
679
680//
681////////////////////////////////////////////////////////////////////////////
682double t_pppSatObs::cmpValue(t_lc::type tLC) const {
683 double cmpValue;
684
685 if (!isValid(tLC)) {
686 cmpValue = 0.0;
687 }
688 else if (tLC == t_lc::GIM) {
689 cmpValue = _stecSat;
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(tLC, 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 if (OPT->PPP_RTK) {
711 dispPart += it->second * (_model._ionoCodeDelay[tFreq]);
712 }
713 }
714 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
715 t_frequency::type tFreq = it->first;
716 dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
717 _model._windUp * t_CST::lambda(tFreq, _channel));
718 if (OPT->PPP_RTK) {
719 dispPart += it->second * (- _model._ionoCodeDelay[tFreq]);
720 }
721 }
722 cmpValue = nonDisp + dispPart;
723 }
724
725 return cmpValue;
726}
727
728//
729////////////////////////////////////////////////////////////////////////////
730void t_pppSatObs::setRes(t_lc::type tLC, double res) {
731 _res[tLC] = res;
732}
733
734//
735////////////////////////////////////////////////////////////////////////////
736double t_pppSatObs::getRes(t_lc::type tLC) const {
737 map<t_lc::type, double>::const_iterator it = _res.find(tLC);
738 if (it != _res.end()) {
739 return it->second;
740 }
741 else {
742 return 0.0;
743 }
744}
745
746//
747////////////////////////////////////////////////////////////////////////////
748bool t_pppSatObs::setPseudoObsIono(t_frequency::type freq) {
749 bool pseudoObsIono = false;
750 _stecSat = _model._ionoCodeDelay[freq];
751 if (_stecSat) {
752 pseudoObsIono = true;
753 }
754 return pseudoObsIono;
755}
Note: See TracBrowser for help on using the repository browser.