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

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