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

Last change on this file since 9560 was 9560, checked in by stuerze, 2 years ago

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