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

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