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

Last change on this file since 10573 was 10573, checked in by stuerze, 8 days ago

minor changes regarding PPP

  • 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 <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
144 // Compute Satellite Coordinates at Time of Transmission
145 // -----------------------------------------------------
146 _xcSat.ReSize(6); _xcSat = 0.0;
147 _vvSat.ReSize(3); _vvSat = 0.0;
148 bool totOK = false;
149 ColumnVector satPosOld(6); satPosOld = 0.0;
150 t_lc::type tLC = t_lc::dummy;
151 if (isValid(t_lc::cIF)) {
152 tLC = t_lc::cIF;
153 }
154 if (tLC == t_lc::dummy && isValid(t_lc::c1)) {
155 tLC = t_lc::c1;
156 }
157 if (tLC == t_lc::dummy && isValid(t_lc::c2)) {
158 tLC = t_lc::c2;
159 }
160 if (tLC == t_lc::dummy) {
161 _valid = false;
162 return;
163 }
164 double prange = obsValue(tLC);
165 for (int ii = 1; ii <= 10; ii++) {
166 bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
167 if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
168 _valid = false;
169 return;
170 }
171 ColumnVector dx = _xcSat - satPosOld;
172 dx[3] *= t_CST::c;
173 if (dx.NormFrobenius() < 1.e-4) {
174 totOK = true;
175 break;
176 }
177 satPosOld = _xcSat;
178 }
179 if (totOK) {
180 _signalPropagationTime = prange / t_CST::c - _xcSat[3];
181 _model._satClkM = _xcSat[3] * t_CST::c;
182 }
183 else {
184 _valid = false;
185 }
186}
187
188//
189////////////////////////////////////////////////////////////////////////////
190void t_pppSatObs::lcCoeff(t_lc::type tLC,
191 map<t_frequency::type, double>& codeCoeff,
192 map<t_frequency::type, double>& phaseCoeff,
193 map<t_frequency::type, double>& ionoCoeff) const {
194
195 codeCoeff.clear();
196 phaseCoeff.clear();
197 ionoCoeff.clear();
198
199 double f1 = t_CST::freq(_fType1, _channel);
200 double f2 = t_CST::freq(_fType2, _channel);
201 double f1GPS = t_CST::freq(t_frequency::G1, 0);
202
203 switch (tLC) {
204 case t_lc::l1:
205 phaseCoeff[_fType1] = 1.0;
206 ionoCoeff [_fType1] = -1.0 * pow(f1GPS, 2) / pow(f1, 2);
207 return;
208 case t_lc::l2:
209 phaseCoeff[_fType2] = 1.0;
210 ionoCoeff [_fType2] = -1.0 * pow(f1GPS, 2) / pow(f2, 2);
211 return;
212 case t_lc::lIF:
213 phaseCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
214 phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
215 return;
216 case t_lc::MW:
217 phaseCoeff[_fType1] = f1 / (f1 - f2);
218 phaseCoeff[_fType2] = -f2 / (f1 - f2);
219 codeCoeff[_fType1] = -f1 / (f1 + f2);
220 codeCoeff[_fType2] = -f2 / (f1 + f2);
221 return;
222 case t_lc::CL:
223 phaseCoeff[_fType1] = 0.5;
224 codeCoeff [_fType1] = 0.5;
225 return;
226 case t_lc::c1:
227 codeCoeff[_fType1] = 1.0;
228 ionoCoeff[_fType1] = pow(f1GPS, 2) / pow(f1, 2);
229 return;
230 case t_lc::c2:
231 codeCoeff[_fType2] = 1.0;
232 ionoCoeff[_fType2] = pow(f1GPS, 2) / pow(f2, 2);
233 return;
234 case t_lc::cIF:
235 codeCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
236 codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
237 return;
238 case t_lc::GIM:
239 case t_lc::dummy:
240 case t_lc::maxLc:
241 return;
242 }
243}
244
245//
246////////////////////////////////////////////////////////////////////////////
247bool t_pppSatObs::isValid(t_lc::type tLC) const {
248 bool valid = true;
249 obsValue(tLC, &valid);
250
251 return valid;
252}
253//
254////////////////////////////////////////////////////////////////////////////
255double t_pppSatObs::obsValue(t_lc::type tLC, bool* valid) const {
256
257 double retVal = 0.0;
258 if (valid) *valid = true;
259
260 // Pseudo observations
261 if (tLC == t_lc::GIM) {
262 if (_stecSat == 0.0) {
263 if (valid) *valid = false;
264 return 0.0;
265 }
266 else {
267 return _stecSat;
268 }
269 }
270
271 map<t_frequency::type, double> codeCoeff;
272 map<t_frequency::type, double> phaseCoeff;
273 map<t_frequency::type, double> ionoCoeff;
274 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
275
276 map<t_frequency::type, double>::const_iterator it;
277
278 // Code observations
279 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
280 t_frequency::type tFreq = it->first;
281 if (_obs[tFreq] == 0) {
282 if (valid) *valid = false;
283 return 0.0;
284 }
285 else {
286 retVal += it->second * _obs[tFreq]->_code;
287 }
288 }
289 // Phase observations
290 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
291 t_frequency::type tFreq = it->first;
292 if (_obs[tFreq] == 0) {
293 if (valid) *valid = false;
294 return 0.0;
295 }
296 else {
297 retVal += it->second * _obs[tFreq]->_phase * t_CST::lambda(tFreq, _channel);
298 }
299 }
300 return retVal;
301}
302
303//
304////////////////////////////////////////////////////////////////////////////
305double t_pppSatObs::lambda(t_lc::type tLC) const {
306
307 double f1 = t_CST::freq(_fType1, _channel);
308 double f2 = t_CST::freq(_fType2, _channel);
309
310 if (tLC == t_lc::l1) {
311 return t_CST::c / f1;
312 }
313 else if (tLC == t_lc::l2) {
314 return t_CST::c / f2;
315 }
316 else if (tLC == t_lc::lIF) {
317 return t_CST::c / (f1 + f2);
318 }
319 else if (tLC == t_lc::MW) {
320 return t_CST::c / (f1 - f2);
321 }
322 else if (tLC == t_lc::CL) {
323 return t_CST::c / f1 / 2.0;
324 }
325
326 return 0.0;
327}
328
329//
330////////////////////////////////////////////////////////////////////////////
331double t_pppSatObs::sigma(t_lc::type tLC) const {
332
333 double retVal = 0.0;
334 map<t_frequency::type, double> codeCoeff;
335 map<t_frequency::type, double> phaseCoeff;
336 map<t_frequency::type, double> ionoCoeff;
337 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
338
339 if (tLC == t_lc::GIM) {
340 retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
341 }
342
343 map<t_frequency::type, double>::const_iterator it;
344 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
345 retVal += it->second * it->second * OPT->_sigmaC1 * OPT->_sigmaC1;
346 }
347
348 for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
349 retVal += it->second * it->second * OPT->_sigmaL1 * OPT->_sigmaL1;
350 }
351
352 retVal = sqrt(retVal);
353
354 // De-Weight R
355 // -----------
356 if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {
357 retVal *= 5.0;
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 // De-Weight R
397 // -----------
398 if (_prn.system() == 'R'&& t_lc::includesCode(tLC)) {
399 retVal *= 5.0;
400 }
401
402 return retVal;
403}
404
405
406//
407////////////////////////////////////////////////////////////////////////////
408t_irc t_pppSatObs::cmpModel(const t_pppStation* station) {
409
410 // Reset all model values
411 // ----------------------
412 _model.reset();
413
414 // Topocentric Satellite Position
415 // ------------------------------
416 ColumnVector rSat = _xcSat.Rows(1,3);
417 ColumnVector rRec = station->xyzApr();
418 ColumnVector rhoV = rSat - rRec;
419 _model._rho = rhoV.NormFrobenius();
420
421 ColumnVector vSat = _vvSat;
422
423 ColumnVector neu(3);
424 xyz2neu(station->ellApr().data(), rhoV.data(), neu.data());
425
426 _model._eleSat = acos(sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho);
427 if (neu[2] < 0.0) {
428 _model._eleSat *= -1.0;
429 }
430 _model._azSat = atan2(neu[1], neu[0]);
431
432 // Sun unit vector
433 ColumnVector xSun = t_astro::Sun(_time.mjddec());
434 xSun /= xSun.norm_Frobenius();
435
436 // Satellite unit vectors sz, sy, sx
437 ColumnVector sz = -rSat / rSat.norm_Frobenius();
438 ColumnVector sy = crossproduct(sz, xSun);
439 ColumnVector sx = crossproduct(sy, sz);
440
441 sx /= sx.norm_Frobenius();
442 sy /= sy.norm_Frobenius();
443
444 // LOS unit vector satellite --> receiver
445 ColumnVector rho = rRec - rSat;
446 rho /= rho.norm_Frobenius();
447
448 // LOS vector in satellite frame
449 ColumnVector u(3);
450 u(1) = dotproduct(sx, rho);
451 u(2) = dotproduct(sy, rho);
452 u(3) = dotproduct(sz, rho);
453
454 // Azimuth and elevation in satellite antenna frame
455 _model._elTx = atan2(u(3),sqrt(pow(u(2),2)+pow(u(1),2)));
456 _model._azTx = atan2(u(2),u(1));
457
458
459 // Satellite Clocks
460 // ----------------
461 _model._satClkM = _xcSat[3] * t_CST::c;
462
463 // Receiver Clocks
464 // ---------------
465 _model._recClkM = station->dClk() * t_CST::c;
466
467 // Sagnac Effect (correction due to Earth rotation)
468 // ------------------------------------------------
469 ColumnVector Omega(3);
470 Omega[0] = 0.0;
471 Omega[1] = 0.0;
472 Omega[2] = t_CST::omega / t_CST::c;
473 _model._sagnac = DotProduct(Omega, crossproduct(rSat, rRec));
474
475 // Antenna Eccentricity
476 // --------------------
477 _model._antEcc = -DotProduct(station->xyzEcc(), rhoV) / _model._rho;
478
479 // Antenna Phase Center Offsets and Variations
480 // -------------------------------------------
481 if (PPP_CLIENT->antex()) {
482 for (unsigned ii = 0; ii < t_frequency::max; ii++) {
483 t_frequency::type frqType = static_cast<t_frequency::type>(ii);
484 string frqStr = t_frequency::toString(frqType);
485 if (frqStr[0] != _prn.system()) {continue;}
486 bool found;
487 QString prn(_prn.toString().c_str());
488 _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType, _model._eleSat, _model._azSat, found);
489 _model._antPCO[ii] += PPP_CLIENT->antex()->satCorr(prn, frqType, _model._elTx, _model._azTx, found);
490 if (OPT->_isAPC && found) {
491 // the PCOs as given in the satellite antenna correction for all frequencies
492 // have to be reduced by the PCO of the respective reference frequency
493 if (_prn.system() == 'G') {
494 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::G1, _model._elTx, _model._azTx, found);
495 }
496 else if (_prn.system() == 'R') {
497 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::R1, _model._elTx, _model._azTx, found);
498 }
499 else if (_prn.system() == 'E') {
500 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::E1, _model._elTx, _model._azTx, found);
501 }
502 else if (_prn.system() == 'C') {
503 _model._antPCO[ii] -= PPP_CLIENT->antex()->satCorr(prn, t_frequency::C2, _model._elTx, _model._azTx, found);
504 }
505 }
506 }
507 }
508
509 // Tropospheric Delay
510 // ------------------
511 _model._tropo = t_tropo::delay_saast(rRec, _model._eleSat);
512
513 // Code Biases
514 // -----------
515 const t_satCodeBias* satCodeBias = PPP_CLIENT->obsPool()->satCodeBias(_prn);
516 if (satCodeBias) {
517 for (unsigned ii = 0; ii < satCodeBias->_bias.size(); ii++) {
518 const t_frqCodeBias& bias = satCodeBias->_bias[ii];
519 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
520 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
521 if (frqStr[0] != _prn.system()) {
522 continue;
523 }
524 const t_frqObs* obs = _obs[iFreq];
525 if (obs &&
526 obs->_rnxType2ch == bias._rnxType2ch) {
527 _model._codeBias[iFreq] = bias._value;
528 }
529 }
530 }
531 }
532
533 // Phase Biases
534 // -----------
535 const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
536 double yaw = 0.0;
537 bool ssr = false;
538 if (satPhaseBias) {
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 ssr = true;
545 for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
546 const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
547 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
548 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
549 if (frqStr[0] != _prn.system()) {
550 continue;
551 }
552 const t_frqObs* obs = _obs[iFreq];
553 if (obs &&
554 obs->_rnxType2ch == bias._rnxType2ch) {
555 _model._phaseBias[iFreq] = bias._value;
556 }
557 }
558 }
559 }
560
561 // Phase Wind-Up
562 // -------------
563 _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ;
564
565 // Relativistic effect due to earth gravity
566 // ----------------------------------------
567 double a = rSat.NormFrobenius() + rRec.NormFrobenius();
568 double b = (rSat - rRec).NormFrobenius();
569 double gm = 3.986004418e14; // m3/s2
570 _model._rel = 2 * gm / t_CST::c / t_CST::c * log((a + b) / (a - b));
571
572 // Tidal Correction
573 // ----------------
574 _model._tideEarth = -DotProduct(station->tideDsplEarth(), rhoV) / _model._rho;
575 _model._tideOcean = -DotProduct(station->tideDsplOcean(), rhoV) / _model._rho;
576
577 // Ionospheric Delay
578 // -----------------
579 const t_vTec* vTec = PPP_CLIENT->obsPool()->vTec();
580 bool vTecUsage = true;
581 for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
582 t_lc::type tLC = OPT->LCs(_prn.system())[ii];
583 if (tLC == t_lc::cIF || tLC == t_lc::lIF) {
584 vTecUsage = false;
585 }
586 }
587
588 if (vTecUsage && vTec) {
589 double stec = station->stec(vTec, _signalPropagationTime, rSat);
590 double f1GPS = t_CST::freq(t_frequency::G1, 0);
591 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
592 if (OPT->_pseudoObsIono) {
593 // For scaling the slant ionospheric delays the trick is to be consistent with units!
594 // The conversion of TECU into meters requires the frequency of the signal.
595 // Hence, GPS L1 frequency is used for all systems. The same is true for mu_i in lcCoeff().
596 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(f1GPS, 2) * stec;
597 }
598 else { // PPP-RTK
599 t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
600 _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;
601 }
602 }
603 }
604
605 // Set Model Set Flag
606 // ------------------
607 _model._set = true;
608
609 //printModel();
610
611 return success;
612}
613
614//
615////////////////////////////////////////////////////////////////////////////
616void t_pppSatObs::printModel() const {
617
618 LOG.setf(ios::fixed);
619 LOG << "\nMODEL for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "")
620
621 << "\n======================= " << endl
622 << "PPP "
623 << ((OPT->_pseudoObsIono) ? " with pseudo-observations for STEC" : "") << endl
624 << "RHO : " << setw(12) << setprecision(3) << _model._rho << endl
625 << "ELE : " << setw(12) << setprecision(3) << _model._eleSat * RHO_DEG << endl
626 << "AZI : " << setw(12) << setprecision(3) << _model._azSat * RHO_DEG << endl
627 << "SATCLK : " << setw(12) << setprecision(3) << _model._satClkM << endl
628 << "RECCLK : " << setw(12) << setprecision(3) << _model._recClkM << endl
629 << "SAGNAC : " << setw(12) << setprecision(3) << _model._sagnac << endl
630 << "ANTECC : " << setw(12) << setprecision(3) << _model._antEcc << endl
631 << "TROPO : " << setw(12) << setprecision(3) << _model._tropo << endl
632 << "WINDUP : " << setw(12) << setprecision(3) << _model._windUp << endl
633 << "REL : " << setw(12) << setprecision(3) << _model._rel << endl
634 << "EARTH TIDES : " << setw(12) << setprecision(3) << _model._tideEarth << endl
635 << "OCEAN TIDES : " << setw(12) << setprecision(3) << _model._tideOcean << endl
636 << endl
637 << "FREQUENCY DEPENDENT CORRECTIONS:" << endl
638 << "-------------------------------" << endl;
639 for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
640 if (_obs[iFreq]) {
641 string frqStr = t_frequency::toString(t_frequency::type(iFreq));
642 if (_prn.system() == frqStr[0]) {
643 LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl
644 << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
645 << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
646 << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl;
647 }
648 }
649 }
650}
651
652//
653////////////////////////////////////////////////////////////////////////////
654void t_pppSatObs::printObsMinusComputed() const {
655 LOG.setf(ios::fixed);
656 LOG << "\nOBS-COMP for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "") << endl
657 << "========================== " << endl;
658 char sys = _prn.system();
659 for (unsigned ii = 0; ii < OPT->LCs(sys).size(); ii++) {
660 t_lc::type tLC = OPT->LCs(sys)[ii];
661 LOG << "OBS-CMP " << setw(4) << t_lc::toString(tLC) << ": " << _prn.toString() << " "
662 << setw(12) << setprecision(3) << obsValue(tLC) << " "
663 << setw(12) << setprecision(3) << cmpValue(tLC) << " "
664 << setw(12) << setprecision(3) << obsValue(tLC) - cmpValue(tLC) << endl;
665 }
666}
667
668//
669////////////////////////////////////////////////////////////////////////////
670double t_pppSatObs::cmpValueForBanc(t_lc::type tLC) const {
671 return cmpValue(tLC) - _model._rho - _model._sagnac - _model._recClkM;
672}
673
674//
675////////////////////////////////////////////////////////////////////////////
676double t_pppSatObs::cmpValue(t_lc::type tLC) const {
677 double cmpValue;
678
679 if (!isValid(tLC)) {
680 cmpValue = 0.0;
681 }
682 else if (tLC == t_lc::GIM) {
683 cmpValue = _stecSat;
684 }
685 else {
686 // Non-Dispersive Part
687 // -------------------
688 double nonDisp = _model._rho
689 + _model._recClkM - _model._satClkM
690 + _model._sagnac + _model._antEcc + _model._tropo
691 + _model._tideEarth + _model._tideOcean + _model._rel;
692
693 // Add Dispersive Part
694 // -------------------
695 double dispPart = 0.0;
696 map<t_frequency::type, double> codeCoeff;
697 map<t_frequency::type, double> phaseCoeff;
698 map<t_frequency::type, double> ionoCoeff;
699 lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
700 map<t_frequency::type, double>::const_iterator it;
701 for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
702 t_frequency::type tFreq = it->first;
703 dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq]);
704 if (OPT->PPP_RTK) {
705 dispPart += it->second * (_model._ionoCodeDelay[tFreq]);
706 }
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 if (OPT->PPP_RTK) {
713 dispPart += it->second * (- _model._ionoCodeDelay[tFreq]);
714 }
715 }
716 cmpValue = nonDisp + dispPart;
717 }
718
719 return cmpValue;
720}
721
722//
723////////////////////////////////////////////////////////////////////////////
724void t_pppSatObs::setRes(t_lc::type tLC, double res) {
725 _res[tLC] = res;
726}
727
728//
729////////////////////////////////////////////////////////////////////////////
730double t_pppSatObs::getRes(t_lc::type tLC) const {
731 map<t_lc::type, double>::const_iterator it = _res.find(tLC);
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) {
743 bool pseudoObsIono = false;
744 _stecSat = _model._ionoCodeDelay[freq];
745 if (_stecSat) {
746 pseudoObsIono = true;
747 }
748 return pseudoObsIono;
749}
Note: See TracBrowser for help on using the repository browser.