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

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