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

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