[7237] | 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 | *
|
---|
[7288] | 13 | * Changes:
|
---|
[7237] | 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | #include <iostream>
|
---|
| 19 | #include <cmath>
|
---|
| 20 | #include <newmatio.h>
|
---|
| 21 |
|
---|
| 22 | #include "pppSatObs.h"
|
---|
| 23 | #include "bncconst.h"
|
---|
| 24 | #include "pppEphPool.h"
|
---|
| 25 | #include "pppStation.h"
|
---|
| 26 | #include "bncutils.h"
|
---|
| 27 | #include "bncantex.h"
|
---|
| 28 | #include "pppObsPool.h"
|
---|
| 29 | #include "pppClient.h"
|
---|
| 30 |
|
---|
| 31 | using namespace BNC_PPP;
|
---|
| 32 | using namespace std;
|
---|
| 33 |
|
---|
| 34 | // Constructor
|
---|
| 35 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 36 | t_pppSatObs::t_pppSatObs(const t_satObs& pppSatObs) {
|
---|
| 37 | _prn = pppSatObs._prn;
|
---|
| 38 | _time = pppSatObs._time;
|
---|
| 39 | _outlier = false;
|
---|
| 40 | _valid = true;
|
---|
| 41 | for (unsigned ii = 0; ii < t_frequency::max; ii++) {
|
---|
| 42 | _obs[ii] = 0;
|
---|
| 43 | }
|
---|
| 44 | prepareObs(pppSatObs);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | // Destructor
|
---|
| 48 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 49 | t_pppSatObs::~t_pppSatObs() {
|
---|
| 50 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 51 | delete _obs[iFreq];
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[7288] | 55 | //
|
---|
[7237] | 56 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 57 | void t_pppSatObs::prepareObs(const t_satObs& pppSatObs) {
|
---|
| 58 |
|
---|
| 59 | _model.reset();
|
---|
| 60 |
|
---|
| 61 | // Select pseudoranges and phase observations
|
---|
| 62 | // ------------------------------------------
|
---|
[7253] | 63 | const string preferredAttrib = "CWPXI_";
|
---|
[8619] | 64 | //const string preferredAttrib = "G:12&PWCSLXYN G:5&IQX R:12&PC R:3&IQX E:16&BCX E:578&IQX J:1&SLXCZ J:26&SLX J:5&IQX C:IQX I:ABCX S:1&C S:5&IQX";
|
---|
[7237] | 65 |
|
---|
| 66 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 67 | string frqNum = t_frequency::toString(t_frequency::type(iFreq)).substr(1);
|
---|
| 68 | for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) {
|
---|
| 69 | string obsType = (preferredAttrib[iPref] == '_') ? frqNum : frqNum + preferredAttrib[iPref];
|
---|
| 70 | if (_obs[iFreq] == 0) {
|
---|
| 71 | for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
|
---|
| 72 | const t_frqObs* obs = pppSatObs._obs[ii];
|
---|
[8026] | 73 | if (obs->_rnxType2ch == obsType &&
|
---|
| 74 | obs->_codeValid && obs->_code &&
|
---|
| 75 | obs->_phaseValid && obs->_phase) {
|
---|
[7237] | 76 | _obs[iFreq] = new t_frqObs(*obs);
|
---|
| 77 | }
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | // Used frequency types
|
---|
| 84 | // --------------------
|
---|
| 85 | _fType1 = t_lc::toFreq(_prn.system(),t_lc::l1);
|
---|
| 86 | _fType2 = t_lc::toFreq(_prn.system(),t_lc::l2);
|
---|
| 87 |
|
---|
| 88 | // Check whether all required frequencies available
|
---|
| 89 | // ------------------------------------------------
|
---|
| 90 | for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
|
---|
| 91 | t_lc::type tLC = OPT->LCs(_prn.system())[ii];
|
---|
| 92 | if (!isValid(tLC)) {
|
---|
| 93 | _valid = false;
|
---|
| 94 | return;
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | // Find Glonass Channel Number
|
---|
| 99 | // ---------------------------
|
---|
| 100 | if (_prn.system() == 'R') {
|
---|
| 101 | _channel = PPP_CLIENT->ephPool()->getChannel(_prn);
|
---|
| 102 | }
|
---|
| 103 | else {
|
---|
| 104 | _channel = 0;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | // Compute Satellite Coordinates at Time of Transmission
|
---|
| 108 | // -----------------------------------------------------
|
---|
[8619] | 109 | _xcSat.ReSize(6); _xcSat = 0.0;
|
---|
[8495] | 110 | _vvSat.ReSize(3); _vvSat = 0.0;
|
---|
[7237] | 111 | bool totOK = false;
|
---|
[8619] | 112 | ColumnVector satPosOld(6); satPosOld = 0.0;
|
---|
[7237] | 113 | t_lc::type tLC = isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
|
---|
| 114 | double prange = obsValue(tLC);
|
---|
| 115 | for (int ii = 1; ii <= 10; ii++) {
|
---|
| 116 | bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
|
---|
| 117 | if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
|
---|
| 118 | _valid = false;
|
---|
| 119 | return;
|
---|
| 120 | }
|
---|
| 121 | ColumnVector dx = _xcSat - satPosOld;
|
---|
| 122 | dx[3] *= t_CST::c;
|
---|
| 123 | if (dx.norm_Frobenius() < 1.e-4) {
|
---|
| 124 | totOK = true;
|
---|
| 125 | break;
|
---|
| 126 | }
|
---|
[7288] | 127 | satPosOld = _xcSat;
|
---|
[7237] | 128 | }
|
---|
| 129 | if (totOK) {
|
---|
[7250] | 130 | _signalPropagationTime = prange / t_CST::c - _xcSat[3];
|
---|
[7288] | 131 | _model._satClkM = _xcSat[3] * t_CST::c;
|
---|
[7237] | 132 | }
|
---|
| 133 | else {
|
---|
| 134 | _valid = false;
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 |
|
---|
[7288] | 138 | //
|
---|
[7237] | 139 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7288] | 140 | void t_pppSatObs::lcCoeff(t_lc::type tLC,
|
---|
[7237] | 141 | map<t_frequency::type, double>& codeCoeff,
|
---|
| 142 | map<t_frequency::type, double>& phaseCoeff) const {
|
---|
| 143 |
|
---|
| 144 | codeCoeff.clear();
|
---|
| 145 | phaseCoeff.clear();
|
---|
| 146 |
|
---|
| 147 | double f1 = t_CST::freq(_fType1, _channel);
|
---|
| 148 | double f2 = t_CST::freq(_fType2, _channel);
|
---|
| 149 |
|
---|
| 150 | switch (tLC) {
|
---|
| 151 | case t_lc::l1:
|
---|
[7288] | 152 | phaseCoeff[_fType1] = 1.0;
|
---|
[7237] | 153 | return;
|
---|
[7288] | 154 | case t_lc::l2:
|
---|
| 155 | phaseCoeff[_fType2] = 1.0;
|
---|
[7237] | 156 | return;
|
---|
[7288] | 157 | case t_lc::lIF:
|
---|
[7237] | 158 | phaseCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
|
---|
| 159 | phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
|
---|
| 160 | return;
|
---|
[7288] | 161 | case t_lc::MW:
|
---|
[7237] | 162 | phaseCoeff[_fType1] = f1 / (f1 - f2);
|
---|
| 163 | phaseCoeff[_fType2] = -f2 / (f1 - f2);
|
---|
| 164 | codeCoeff[_fType1] = -f1 / (f1 + f2);
|
---|
| 165 | codeCoeff[_fType2] = -f2 / (f1 + f2);
|
---|
| 166 | return;
|
---|
[7288] | 167 | case t_lc::CL:
|
---|
[7237] | 168 | phaseCoeff[_fType1] = 0.5;
|
---|
| 169 | codeCoeff[_fType1] = 0.5;
|
---|
| 170 | return;
|
---|
[7288] | 171 | case t_lc::c1:
|
---|
| 172 | codeCoeff[_fType1] = 1.0;
|
---|
[7237] | 173 | return;
|
---|
[7288] | 174 | case t_lc::c2:
|
---|
| 175 | codeCoeff[_fType2] = 1.0;
|
---|
[7237] | 176 | return;
|
---|
[7288] | 177 | case t_lc::cIF:
|
---|
[7237] | 178 | codeCoeff[_fType1] = f1 * f1 / (f1 * f1 - f2 * f2);
|
---|
| 179 | codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
|
---|
| 180 | return;
|
---|
[7288] | 181 | case t_lc::dummy:
|
---|
| 182 | case t_lc::maxLc:
|
---|
[7237] | 183 | return;
|
---|
| 184 | }
|
---|
| 185 | }
|
---|
| 186 |
|
---|
[7288] | 187 | //
|
---|
[7237] | 188 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 189 | bool t_pppSatObs::isValid(t_lc::type tLC) const {
|
---|
| 190 | bool valid = true;
|
---|
| 191 | obsValue(tLC, &valid);
|
---|
| 192 | return valid;
|
---|
| 193 | }
|
---|
[7288] | 194 | //
|
---|
[7237] | 195 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 196 | double t_pppSatObs::obsValue(t_lc::type tLC, bool* valid) const {
|
---|
| 197 |
|
---|
| 198 | map<t_frequency::type, double> codeCoeff;
|
---|
| 199 | map<t_frequency::type, double> phaseCoeff;
|
---|
| 200 | lcCoeff(tLC, codeCoeff, phaseCoeff);
|
---|
| 201 |
|
---|
| 202 | double retVal = 0.0;
|
---|
| 203 | if (valid) *valid = true;
|
---|
| 204 |
|
---|
| 205 | map<t_frequency::type, double>::const_iterator it;
|
---|
| 206 | for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
|
---|
| 207 | t_frequency::type tFreq = it->first;
|
---|
| 208 | if (_obs[tFreq] == 0) {
|
---|
| 209 | if (valid) *valid = false;
|
---|
| 210 | return 0.0;
|
---|
| 211 | }
|
---|
| 212 | else {
|
---|
| 213 | retVal += it->second * _obs[tFreq]->_code;
|
---|
| 214 | }
|
---|
| 215 | }
|
---|
| 216 | for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
|
---|
| 217 | t_frequency::type tFreq = it->first;
|
---|
| 218 | if (_obs[tFreq] == 0) {
|
---|
| 219 | if (valid) *valid = false;
|
---|
| 220 | return 0.0;
|
---|
| 221 | }
|
---|
| 222 | else {
|
---|
| 223 | retVal += it->second * _obs[tFreq]->_phase * t_CST::lambda(tFreq, _channel);
|
---|
| 224 | }
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | return retVal;
|
---|
| 228 | }
|
---|
| 229 |
|
---|
[7288] | 230 | //
|
---|
[7237] | 231 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 232 | double t_pppSatObs::lambda(t_lc::type tLC) const {
|
---|
| 233 |
|
---|
| 234 | double f1 = t_CST::freq(_fType1, _channel);
|
---|
| 235 | double f2 = t_CST::freq(_fType2, _channel);
|
---|
| 236 |
|
---|
| 237 | if (tLC == t_lc::l1) {
|
---|
| 238 | return t_CST::c / f1;
|
---|
| 239 | }
|
---|
| 240 | else if (tLC == t_lc::l2) {
|
---|
| 241 | return t_CST::c / f2;
|
---|
| 242 | }
|
---|
| 243 | else if (tLC == t_lc::lIF) {
|
---|
| 244 | return t_CST::c / (f1 + f2);
|
---|
| 245 | }
|
---|
| 246 | else if (tLC == t_lc::MW) {
|
---|
| 247 | return t_CST::c / (f1 - f2);
|
---|
| 248 | }
|
---|
| 249 | else if (tLC == t_lc::CL) {
|
---|
| 250 | return t_CST::c / f1 / 2.0;
|
---|
| 251 | }
|
---|
| 252 |
|
---|
| 253 | return 0.0;
|
---|
| 254 | }
|
---|
| 255 |
|
---|
[7288] | 256 | //
|
---|
[7237] | 257 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 258 | double t_pppSatObs::sigma(t_lc::type tLC) const {
|
---|
| 259 |
|
---|
| 260 | map<t_frequency::type, double> codeCoeff;
|
---|
| 261 | map<t_frequency::type, double> phaseCoeff;
|
---|
| 262 | lcCoeff(tLC, codeCoeff, phaseCoeff);
|
---|
| 263 |
|
---|
| 264 | double retVal = 0.0;
|
---|
| 265 |
|
---|
| 266 | map<t_frequency::type, double>::const_iterator it;
|
---|
| 267 | for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
|
---|
| 268 | retVal += it->second * it->second * OPT->_sigmaC1 * OPT->_sigmaC1;
|
---|
| 269 | }
|
---|
| 270 | for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
|
---|
| 271 | retVal += it->second * it->second * OPT->_sigmaL1 * OPT->_sigmaL1;
|
---|
| 272 | }
|
---|
| 273 |
|
---|
[7288] | 274 | retVal = sqrt(retVal);
|
---|
| 275 |
|
---|
[7237] | 276 | // De-Weight GLONASS
|
---|
| 277 | // -----------------
|
---|
| 278 | if (_prn.system() == 'R') {
|
---|
| 279 | retVal *= 5.0;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | // Elevation-Dependent Weighting
|
---|
| 283 | // -----------------------------
|
---|
| 284 | double cEle = 1.0;
|
---|
| 285 | if ( (OPT->_eleWgtCode && t_lc::includesCode(tLC)) ||
|
---|
| 286 | (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {
|
---|
| 287 | double eleD = eleSat()*180.0/M_PI;
|
---|
| 288 | double hlp = fabs(90.0 - eleD);
|
---|
| 289 | cEle = (1.0 + hlp*hlp*hlp*0.000004);
|
---|
| 290 | }
|
---|
| 291 |
|
---|
| 292 | return cEle * retVal;
|
---|
| 293 | }
|
---|
| 294 |
|
---|
[7288] | 295 | //
|
---|
[7237] | 296 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 297 | double t_pppSatObs::maxRes(t_lc::type tLC) const {
|
---|
| 298 |
|
---|
| 299 | map<t_frequency::type, double> codeCoeff;
|
---|
| 300 | map<t_frequency::type, double> phaseCoeff;
|
---|
| 301 | lcCoeff(tLC, codeCoeff, phaseCoeff);
|
---|
| 302 |
|
---|
| 303 | double retVal = 0.0;
|
---|
| 304 |
|
---|
| 305 | map<t_frequency::type, double>::const_iterator it;
|
---|
| 306 | for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
|
---|
| 307 | retVal += it->second * it->second * OPT->_maxResC1 * OPT->_maxResC1;
|
---|
| 308 | }
|
---|
| 309 | for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
|
---|
| 310 | retVal += it->second * it->second * OPT->_maxResL1 * OPT->_maxResL1;
|
---|
| 311 | }
|
---|
| 312 |
|
---|
| 313 | return sqrt(retVal);
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 |
|
---|
[7288] | 317 | //
|
---|
[7237] | 318 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 319 | t_irc t_pppSatObs::cmpModel(const t_pppStation* station) {
|
---|
| 320 |
|
---|
| 321 | // Reset all model values
|
---|
| 322 | // ----------------------
|
---|
| 323 | _model.reset();
|
---|
| 324 |
|
---|
| 325 | // Topocentric Satellite Position
|
---|
| 326 | // ------------------------------
|
---|
| 327 | ColumnVector rSat = _xcSat.Rows(1,3);
|
---|
[7288] | 328 | ColumnVector rhoV = rSat - station->xyzApr();
|
---|
[7237] | 329 | _model._rho = rhoV.norm_Frobenius();
|
---|
| 330 |
|
---|
[8619] | 331 | ColumnVector vSat = _vvSat;
|
---|
| 332 |
|
---|
[7237] | 333 | ColumnVector neu(3);
|
---|
| 334 | xyz2neu(station->ellApr().data(), rhoV.data(), neu.data());
|
---|
| 335 |
|
---|
| 336 | _model._eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / _model._rho );
|
---|
| 337 | if (neu[2] < 0) {
|
---|
| 338 | _model._eleSat *= -1.0;
|
---|
| 339 | }
|
---|
| 340 | _model._azSat = atan2(neu[1], neu[0]);
|
---|
| 341 |
|
---|
| 342 | // Satellite Clocks
|
---|
| 343 | // ----------------
|
---|
| 344 | _model._satClkM = _xcSat[3] * t_CST::c;
|
---|
| 345 |
|
---|
| 346 | // Receiver Clocks
|
---|
| 347 | // ---------------
|
---|
| 348 | _model._recClkM = station->dClk() * t_CST::c;
|
---|
| 349 |
|
---|
| 350 | // Sagnac Effect (correction due to Earth rotation)
|
---|
| 351 | // ------------------------------------------------
|
---|
| 352 | ColumnVector Omega(3);
|
---|
| 353 | Omega[0] = 0.0;
|
---|
| 354 | Omega[1] = 0.0;
|
---|
| 355 | Omega[2] = t_CST::omega / t_CST::c;
|
---|
| 356 | _model._sagnac = DotProduct(Omega, crossproduct(rSat, station->xyzApr()));
|
---|
| 357 |
|
---|
| 358 | // Antenna Eccentricity
|
---|
| 359 | // --------------------
|
---|
| 360 | _model._antEcc = -DotProduct(station->xyzEcc(), rhoV) / _model._rho;
|
---|
| 361 |
|
---|
| 362 | // Antenna Phase Center Offsets and Variations
|
---|
| 363 | // -------------------------------------------
|
---|
| 364 | if (PPP_CLIENT->antex()) {
|
---|
| 365 | for (unsigned ii = 0; ii < t_frequency::max; ii++) {
|
---|
| 366 | t_frequency::type frqType = static_cast<t_frequency::type>(ii);
|
---|
| 367 | bool found;
|
---|
[7288] | 368 | _model._antPCO[ii] = PPP_CLIENT->antex()->rcvCorr(station->antName(), frqType,
|
---|
[7237] | 369 | _model._eleSat, _model._azSat, found);
|
---|
| 370 | }
|
---|
| 371 | }
|
---|
| 372 |
|
---|
| 373 | // Tropospheric Delay
|
---|
| 374 | // ------------------
|
---|
| 375 | _model._tropo = t_tropo::delay_saast(station->xyzApr(), _model._eleSat);
|
---|
| 376 |
|
---|
| 377 | // Code Biases
|
---|
| 378 | // -----------
|
---|
| 379 | const t_satCodeBias* satCodeBias = PPP_CLIENT->obsPool()->satCodeBias(_prn);
|
---|
[7288] | 380 | if (satCodeBias) {
|
---|
[7237] | 381 | for (unsigned ii = 0; ii < satCodeBias->_bias.size(); ii++) {
|
---|
| 382 | const t_frqCodeBias& bias = satCodeBias->_bias[ii];
|
---|
| 383 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 384 | const t_frqObs* obs = _obs[iFreq];
|
---|
| 385 | if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
|
---|
| 386 | _model._codeBias[iFreq] = bias._value;
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 | }
|
---|
| 391 |
|
---|
[7288] | 392 | // Phase Biases
|
---|
| 393 | // -----------
|
---|
[8619] | 394 | // TODO: consideration of fix indicators and jump counter
|
---|
[7288] | 395 | const t_satPhaseBias* satPhaseBias = PPP_CLIENT->obsPool()->satPhaseBias(_prn);
|
---|
[8619] | 396 | double yaw = 0.0;
|
---|
| 397 | bool ssr = false;
|
---|
[7288] | 398 | if (satPhaseBias) {
|
---|
[8619] | 399 | yaw = satPhaseBias->_yaw;
|
---|
| 400 | ssr = true;
|
---|
[7288] | 401 | for (unsigned ii = 0; ii < satPhaseBias->_bias.size(); ii++) {
|
---|
| 402 | const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
|
---|
| 403 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 404 | const t_frqObs* obs = _obs[iFreq];
|
---|
| 405 | if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
|
---|
| 406 | _model._phaseBias[iFreq] = bias._value;
|
---|
| 407 | }
|
---|
| 408 | }
|
---|
| 409 | }
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[8619] | 412 | // Phase Wind-Up
|
---|
| 413 | // -------------
|
---|
| 414 | _model._windUp = station->windUp(_time, _prn, rSat, ssr, yaw, vSat) ;
|
---|
| 415 |
|
---|
| 416 |
|
---|
[7237] | 417 | // Tidal Correction
|
---|
| 418 | // ----------------
|
---|
| 419 | _model._tide = -DotProduct(station->tideDspl(), rhoV) / _model._rho;
|
---|
| 420 |
|
---|
| 421 | // Ionospheric Delay
|
---|
| 422 | // -----------------
|
---|
[7250] | 423 | const t_vTec* vTec = PPP_CLIENT->obsPool()->vTec();
|
---|
[7253] | 424 | bool vTecUsage = true;
|
---|
| 425 | for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
|
---|
| 426 | t_lc::type tLC = OPT->LCs(_prn.system())[ii];
|
---|
| 427 | if (tLC == t_lc::cIF || tLC == t_lc::lIF) {
|
---|
| 428 | vTecUsage = false;
|
---|
[7237] | 429 | }
|
---|
| 430 | }
|
---|
[7258] | 431 | if (vTecUsage && vTec) {
|
---|
| 432 | double stec = station->stec(vTec, _signalPropagationTime, rSat);
|
---|
| 433 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 434 | t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
|
---|
| 435 | _model._ionoCodeDelay[iFreq] = 40.3E16 / pow(t_CST::freq(frqType, _channel), 2) * stec;
|
---|
[7253] | 436 | }
|
---|
| 437 | }
|
---|
[7237] | 438 |
|
---|
[8619] | 439 | // Relativistic effect due to earth gravity
|
---|
| 440 | // ----------------------------------------
|
---|
| 441 | // TODO
|
---|
| 442 |
|
---|
[7237] | 443 | // Ocean Loading
|
---|
| 444 | // -------------
|
---|
| 445 | // TODO
|
---|
| 446 |
|
---|
| 447 | // Set Model Set Flag
|
---|
| 448 | // ------------------
|
---|
| 449 | _model._set = true;
|
---|
| 450 |
|
---|
[7252] | 451 | //printModel();
|
---|
| 452 |
|
---|
[7237] | 453 | return success;
|
---|
| 454 | }
|
---|
| 455 |
|
---|
[7288] | 456 | //
|
---|
[7237] | 457 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 458 | void t_pppSatObs::printModel() const {
|
---|
[7253] | 459 |
|
---|
[7237] | 460 | LOG.setf(ios::fixed);
|
---|
| 461 | LOG << "MODEL for Satellite " << _prn.toString() << endl
|
---|
| 462 | << "RHO: " << setw(12) << setprecision(3) << _model._rho << endl
|
---|
| 463 | << "ELE: " << setw(12) << setprecision(3) << _model._eleSat * 180.0 / M_PI << endl
|
---|
| 464 | << "AZI: " << setw(12) << setprecision(3) << _model._azSat * 180.0 / M_PI << endl
|
---|
| 465 | << "SATCLK: " << setw(12) << setprecision(3) << _model._satClkM << endl
|
---|
| 466 | << "RECCLK: " << setw(12) << setprecision(3) << _model._recClkM << endl
|
---|
| 467 | << "SAGNAC: " << setw(12) << setprecision(3) << _model._sagnac << endl
|
---|
| 468 | << "ANTECC: " << setw(12) << setprecision(3) << _model._antEcc << endl
|
---|
| 469 | << "TROPO: " << setw(12) << setprecision(3) << _model._tropo << endl
|
---|
| 470 | << "WINDUP: " << setw(12) << setprecision(3) << _model._windUp << endl
|
---|
| 471 | << "TIDES: " << setw(12) << setprecision(3) << _model._tide << endl;
|
---|
| 472 | for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
|
---|
| 473 | if (_obs[iFreq]) {
|
---|
[7288] | 474 | string frqStr = t_frequency::toString(t_frequency::type(iFreq));
|
---|
| 475 | if (_prn.system() == frqStr[0]) {
|
---|
| 476 | LOG << "PCO : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq] << endl
|
---|
| 477 | << "BIAS CODE : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq] << endl
|
---|
| 478 | << "BIAS PHASE : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq] << endl
|
---|
| 479 | << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq] << endl;
|
---|
| 480 | }
|
---|
[7237] | 481 | }
|
---|
| 482 | }
|
---|
[7253] | 483 | for (unsigned ii = 0; ii < OPT->LCs(_prn.system()).size(); ii++) {
|
---|
| 484 | t_lc::type tLC = OPT->LCs(_prn.system())[ii];
|
---|
| 485 | LOG << "OBS-CMP " << t_lc::toString(tLC) << ": " << _prn.toString() << " "
|
---|
| 486 | << setw(12) << setprecision(3) << obsValue(tLC) << " "
|
---|
| 487 | << setw(12) << setprecision(3) << cmpValue(tLC) << " "
|
---|
| 488 | << setw(12) << setprecision(3) << obsValue(tLC) - cmpValue(tLC) << endl;
|
---|
[7237] | 489 |
|
---|
[7253] | 490 | }
|
---|
[7288] | 491 | LOG << "OBS-CMP MW: " << _prn.toString() << " "
|
---|
[7237] | 492 | << setw(12) << setprecision(3) << obsValue(t_lc::MW) << " "
|
---|
| 493 | << setw(12) << setprecision(3) << cmpValue(t_lc::MW) << " "
|
---|
| 494 | << setw(12) << setprecision(3) << obsValue(t_lc::MW) - cmpValue(t_lc::MW) << endl;
|
---|
| 495 | }
|
---|
| 496 |
|
---|
[7288] | 497 | //
|
---|
[7237] | 498 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 499 | double t_pppSatObs::cmpValueForBanc(t_lc::type tLC) const {
|
---|
| 500 | return cmpValue(tLC) - _model._rho - _model._sagnac - _model._recClkM;
|
---|
| 501 | }
|
---|
| 502 |
|
---|
[7288] | 503 | //
|
---|
[7237] | 504 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 505 | double t_pppSatObs::cmpValue(t_lc::type tLC) const {
|
---|
| 506 |
|
---|
| 507 | if (!isValid(tLC)) {
|
---|
| 508 | return 0.0;
|
---|
| 509 | }
|
---|
| 510 |
|
---|
| 511 | // Non-Dispersive Part
|
---|
| 512 | // -------------------
|
---|
[7288] | 513 | double nonDisp = _model._rho + _model._recClkM - _model._satClkM
|
---|
| 514 | + _model._sagnac + _model._antEcc + _model._tropo
|
---|
[7237] | 515 | + _model._tide;
|
---|
| 516 |
|
---|
| 517 | // Add Dispersive Part
|
---|
| 518 | // -------------------
|
---|
| 519 | map<t_frequency::type, double> codeCoeff;
|
---|
| 520 | map<t_frequency::type, double> phaseCoeff;
|
---|
| 521 | lcCoeff(tLC, codeCoeff, phaseCoeff);
|
---|
| 522 |
|
---|
| 523 | double dispPart = 0.0;
|
---|
| 524 |
|
---|
| 525 | map<t_frequency::type, double>::const_iterator it;
|
---|
| 526 | for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
|
---|
| 527 | t_frequency::type tFreq = it->first;
|
---|
[7262] | 528 | dispPart += it->second * (_model._antPCO[tFreq] - _model._codeBias[tFreq] +
|
---|
[7252] | 529 | _model._ionoCodeDelay[tFreq]);
|
---|
[7237] | 530 | }
|
---|
| 531 | for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
|
---|
| 532 | t_frequency::type tFreq = it->first;
|
---|
[7262] | 533 | dispPart += it->second * (_model._antPCO[tFreq] - _model._phaseBias[tFreq] +
|
---|
[7252] | 534 | _model._windUp * t_CST::lambda(tFreq, _channel) -
|
---|
| 535 | _model._ionoCodeDelay[tFreq]);
|
---|
[7237] | 536 | }
|
---|
| 537 |
|
---|
| 538 | return nonDisp + dispPart;
|
---|
| 539 | }
|
---|
| 540 |
|
---|
[7288] | 541 | //
|
---|
[7237] | 542 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 543 | void t_pppSatObs::setRes(t_lc::type tLC, double res) {
|
---|
| 544 | _res[tLC] = res;
|
---|
| 545 | }
|
---|
| 546 |
|
---|
[7288] | 547 | //
|
---|
[7237] | 548 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 549 | double t_pppSatObs::getRes(t_lc::type tLC) const {
|
---|
| 550 | map<t_lc::type, double>::const_iterator it = _res.find(tLC);
|
---|
| 551 | if (it != _res.end()) {
|
---|
| 552 | return it->second;
|
---|
| 553 | }
|
---|
| 554 | else {
|
---|
| 555 | return 0.0;
|
---|
| 556 | }
|
---|
| 557 | }
|
---|