[7237] | 1 | /* -------------------------------------------------------------------------
|
---|
| 2 | * BKG NTRIP Client
|
---|
| 3 | * -------------------------------------------------------------------------
|
---|
| 4 | *
|
---|
| 5 | * Class: t_pppParlist
|
---|
| 6 | *
|
---|
| 7 | * Purpose: List of estimated parameters
|
---|
| 8 | *
|
---|
| 9 | * Author: L. Mervart
|
---|
| 10 | *
|
---|
| 11 | * Created: 29-Jul-2014
|
---|
| 12 | *
|
---|
| 13 | * Changes:
|
---|
| 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
| 17 | #include <cmath>
|
---|
| 18 | #include <iostream>
|
---|
| 19 | #include <sstream>
|
---|
| 20 | #include <iomanip>
|
---|
| 21 | #include <algorithm>
|
---|
| 22 | #include <newmatio.h>
|
---|
| 23 |
|
---|
| 24 | #include "pppParlist.h"
|
---|
| 25 | #include "pppSatObs.h"
|
---|
| 26 | #include "pppStation.h"
|
---|
| 27 | #include "bncutils.h"
|
---|
| 28 | #include "bncconst.h"
|
---|
| 29 | #include "pppClient.h"
|
---|
| 30 |
|
---|
| 31 | using namespace BNC_PPP;
|
---|
| 32 | using namespace std;
|
---|
| 33 |
|
---|
| 34 | // Constructor
|
---|
| 35 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 36 | t_pppParam::t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC,
|
---|
[9504] | 37 | const vector<t_pppSatObs*>* obsVector) {
|
---|
[7237] | 38 |
|
---|
| 39 | _type = type;
|
---|
| 40 | _prn = prn;
|
---|
| 41 | _tLC = tLC;
|
---|
| 42 | _x0 = 0.0;
|
---|
| 43 | _indexOld = -1;
|
---|
| 44 | _indexNew = -1;
|
---|
| 45 | _noise = 0.0;
|
---|
| 46 | _ambInfo = 0;
|
---|
| 47 |
|
---|
| 48 | switch (_type) {
|
---|
| 49 | case crdX:
|
---|
| 50 | _epoSpec = false;
|
---|
| 51 | _sigma0 = OPT->_aprSigCrd[0];
|
---|
| 52 | _noise = OPT->_noiseCrd[0];
|
---|
| 53 | break;
|
---|
| 54 | case crdY:
|
---|
| 55 | _epoSpec = false;
|
---|
| 56 | _sigma0 = OPT->_aprSigCrd[1];
|
---|
| 57 | _noise = OPT->_noiseCrd[1];
|
---|
| 58 | break;
|
---|
| 59 | case crdZ:
|
---|
| 60 | _epoSpec = false;
|
---|
| 61 | _sigma0 = OPT->_aprSigCrd[2];
|
---|
| 62 | _noise = OPT->_noiseCrd[2];
|
---|
| 63 | break;
|
---|
[10256] | 64 | case rClk:
|
---|
[7237] | 65 | _epoSpec = true;
|
---|
[9303] | 66 | _sigma0 = OPT->_aprSigClk;
|
---|
[7237] | 67 | break;
|
---|
| 68 | case amb:
|
---|
| 69 | _epoSpec = false;
|
---|
| 70 | _sigma0 = OPT->_aprSigAmb;
|
---|
| 71 | _ambInfo = new t_ambInfo();
|
---|
| 72 | if (obsVector) {
|
---|
| 73 | for (unsigned ii = 0; ii < obsVector->size(); ii++) {
|
---|
| 74 | const t_pppSatObs* obs = obsVector->at(ii);
|
---|
| 75 | if (obs->prn() == _prn) {
|
---|
[10256] | 76 | double offGlo = 0;
|
---|
| 77 | if (_prn.system() == 'R' && tLC != t_lc::MW) {
|
---|
| 78 | offGlo = PPP_CLIENT->offGlo();
|
---|
| 79 | }
|
---|
| 80 | double offGal = 0;
|
---|
| 81 | if (_prn.system() == 'E' && tLC != t_lc::MW) {
|
---|
| 82 | offGal = PPP_CLIENT->offGal();
|
---|
| 83 | }
|
---|
| 84 | double offBds = 0;
|
---|
| 85 | if (_prn.system() == 'C' && tLC != t_lc::MW) {
|
---|
| 86 | offBds = PPP_CLIENT->offBds();
|
---|
| 87 | }
|
---|
| 88 | _x0 = floor((obs->obsValue(tLC) - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
|
---|
[7237] | 89 | break;
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 | break;
|
---|
[10256] | 94 | case offGlo:
|
---|
| 95 | _epoSpec = true;
|
---|
| 96 | _sigma0 = OPT->_aprSigClk;
|
---|
| 97 | _x0 = PPP_CLIENT->offGlo();
|
---|
| 98 | break;
|
---|
| 99 | case offGal:
|
---|
| 100 | _epoSpec = true;
|
---|
| 101 | _sigma0 = OPT->_aprSigClk;
|
---|
| 102 | _x0 = PPP_CLIENT->offGal();
|
---|
| 103 | break;
|
---|
| 104 | case offBds:
|
---|
| 105 | _epoSpec = true;
|
---|
| 106 | _sigma0 = OPT->_aprSigClk;
|
---|
| 107 | _x0 = PPP_CLIENT->offBds();
|
---|
| 108 | break;
|
---|
[7237] | 109 | case trp:
|
---|
| 110 | _epoSpec = false;
|
---|
| 111 | _sigma0 = OPT->_aprSigTrp;
|
---|
| 112 | _noise = OPT->_noiseTrp;
|
---|
| 113 | break;
|
---|
[8905] | 114 | case ion:
|
---|
[9439] | 115 | _epoSpec = false;
|
---|
[9386] | 116 | _sigma0 = OPT->_aprSigIon;
|
---|
[9439] | 117 | _noise = OPT->_noiseIon;
|
---|
[8905] | 118 | break;
|
---|
[9644] | 119 | case cBiasG1: case cBiasR1: case cBiasE1: case cBiasC1:
|
---|
| 120 | case cBiasG2: case cBiasR2: case cBiasE2: case cBiasC2:
|
---|
| 121 | _epoSpec = false;
|
---|
| 122 | _sigma0 = OPT->_aprSigCodeBias;
|
---|
| 123 | _noise = OPT->_noiseCodeBias;
|
---|
| 124 | break;
|
---|
| 125 | case pBiasG1: case pBiasR1: case pBiasE1: case pBiasC1:
|
---|
| 126 | case pBiasG2: case pBiasR2: case pBiasE2: case pBiasC2:
|
---|
| 127 | _epoSpec = false;
|
---|
| 128 | _sigma0 = OPT->_aprSigPhaseBias;
|
---|
| 129 | _noise = OPT->_noisePhaseBias;
|
---|
| 130 | break;
|
---|
[7237] | 131 | }
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | // Destructor
|
---|
| 135 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 136 | t_pppParam::~t_pppParam() {
|
---|
[9504] | 137 | if (_ambInfo) {
|
---|
| 138 | delete _ambInfo;
|
---|
| 139 | }
|
---|
[7237] | 140 | }
|
---|
| 141 | //
|
---|
| 142 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 143 | double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
|
---|
[10034] | 144 | const t_lc::type& tLC) const {
|
---|
[7237] | 145 |
|
---|
| 146 | // Special Case - Melbourne-Wuebbena
|
---|
| 147 | // ---------------------------------
|
---|
| 148 | if (tLC == t_lc::MW && _type != amb) {
|
---|
| 149 | return 0.0;
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
[8905] | 153 | ColumnVector rhoV = sta->xyzApr() - obs->xc().Rows(1,3);
|
---|
[7237] | 154 |
|
---|
[8905] | 155 | map<t_frequency::type, double> codeCoeff;
|
---|
| 156 | map<t_frequency::type, double> phaseCoeff;
|
---|
| 157 | map<t_frequency::type, double> ionoCoeff;
|
---|
| 158 | obs->lcCoeff(tLC, codeCoeff, phaseCoeff, ionoCoeff);
|
---|
| 159 |
|
---|
[7237] | 160 | switch (_type) {
|
---|
| 161 | case crdX:
|
---|
[9548] | 162 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
[8905] | 163 | return (sta->xyzApr()[0] - obs->xc()[0]) / rhoV.NormFrobenius();
|
---|
[7237] | 164 | case crdY:
|
---|
[9548] | 165 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
[8905] | 166 | return (sta->xyzApr()[1] - obs->xc()[1]) / rhoV.NormFrobenius();
|
---|
[7237] | 167 | case crdZ:
|
---|
[9548] | 168 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
[8905] | 169 | return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
|
---|
[10256] | 170 | case rClk:
|
---|
[9548] | 171 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
[10256] | 172 | return 1.0;
|
---|
| 173 | case offGlo:
|
---|
[9548] | 174 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
[7237] | 175 | return (obs->prn().system() == 'R') ? 1.0 : 0.0;
|
---|
[10256] | 176 | case offGal:
|
---|
[10003] | 177 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
| 178 | return (obs->prn().system() == 'E') ? 1.0 : 0.0;
|
---|
[10256] | 179 | case offBds:
|
---|
[10003] | 180 | if (tLC == t_lc::GIM) {return 0.0;}
|
---|
| 181 | return (obs->prn().system() == 'C') ? 1.0 : 0.0;
|
---|
[7237] | 182 | case amb:
|
---|
[10034] | 183 | if (tLC == t_lc::GIM) {
|
---|
| 184 | return 0.0;
|
---|
| 185 | }
|
---|
| 186 | else {
|
---|
[8905] | 187 | if (obs->prn() == _prn) {
|
---|
| 188 | if (tLC == _tLC) {
|
---|
| 189 | return (obs->lambda(tLC));
|
---|
| 190 | }
|
---|
| 191 | else if (tLC == t_lc::lIF && _tLC == t_lc::MW) {
|
---|
| 192 | return obs->lambda(t_lc::lIF) * obs->lambda(t_lc::MW) / obs->lambda(t_lc::l2);
|
---|
| 193 | }
|
---|
| 194 | else {
|
---|
| 195 | if (_tLC == t_lc::l1) {
|
---|
[10251] | 196 | return obs->lambda(t_lc::l1) * phaseCoeff[obs->fType1()];
|
---|
[8905] | 197 | }
|
---|
| 198 | else if (_tLC == t_lc::l2) {
|
---|
[10251] | 199 | return obs->lambda(t_lc::l2) * phaseCoeff[obs->fType2()];
|
---|
[8905] | 200 | }
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 | }
|
---|
| 204 | break;
|
---|
| 205 | case trp:
|
---|
[8961] | 206 | if (tLC == t_lc::GIM) {
|
---|
| 207 | return 0.0;
|
---|
| 208 | }
|
---|
| 209 | else {
|
---|
| 210 | return 1.0 / sin(obs->eleSat());
|
---|
| 211 | }
|
---|
[8905] | 212 | case ion:
|
---|
[7237] | 213 | if (obs->prn() == _prn) {
|
---|
[8905] | 214 | if (tLC == t_lc::c1) {
|
---|
[10251] | 215 | return ionoCoeff[obs->fType1()];
|
---|
[7237] | 216 | }
|
---|
[8905] | 217 | else if (tLC == t_lc::c2) {
|
---|
[10251] | 218 | return ionoCoeff[obs->fType2()];
|
---|
[7237] | 219 | }
|
---|
[8905] | 220 | else if (tLC == t_lc::l1) {
|
---|
[10251] | 221 | return ionoCoeff[obs->fType1()];
|
---|
[7237] | 222 | }
|
---|
[8905] | 223 | else if (tLC == t_lc::l2) {
|
---|
[10251] | 224 | return ionoCoeff[obs->fType2()];
|
---|
[8905] | 225 | }
|
---|
| 226 | else if (tLC == t_lc::GIM) {
|
---|
[10034] | 227 | return 1.0;
|
---|
[8905] | 228 | }
|
---|
[7237] | 229 | }
|
---|
[8905] | 230 | break;
|
---|
[9386] | 231 | case cBiasG1:
|
---|
| 232 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
[8905] | 233 | break;
|
---|
[9561] | 234 | case cBiasR1:
|
---|
| 235 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
| 236 | break;
|
---|
[9386] | 237 | case cBiasE1:
|
---|
| 238 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
[8905] | 239 | break;
|
---|
[9386] | 240 | case cBiasC1:
|
---|
| 241 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c1)) {return 1.0;} else {return 0.0;}
|
---|
| 242 | break;
|
---|
| 243 | case cBiasG2:
|
---|
| 244 | if ((obs->prn().system() == 'G') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
| 245 | break;
|
---|
[9561] | 246 | case cBiasR2:
|
---|
| 247 | if ((obs->prn().system() == 'R') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
| 248 | break;
|
---|
[9386] | 249 | case cBiasE2:
|
---|
| 250 | if ((obs->prn().system() == 'E') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
| 251 | break;
|
---|
| 252 | case cBiasC2:
|
---|
| 253 | if ((obs->prn().system() == 'C') && (tLC == t_lc::c2)) {return 1.0;} else {return 0.0;}
|
---|
| 254 | break;
|
---|
| 255 | case pBiasG1:
|
---|
| 256 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
| 257 | break;
|
---|
[9561] | 258 | case pBiasR1:
|
---|
| 259 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
| 260 | break;
|
---|
[9386] | 261 | case pBiasE1:
|
---|
| 262 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
| 263 | break;
|
---|
| 264 | case pBiasC1:
|
---|
| 265 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l1)) {return 1.0;} else {return 0.0;}
|
---|
| 266 | break;
|
---|
| 267 | case pBiasG2:
|
---|
| 268 | if ((obs->prn().system() == 'G') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
| 269 | break;
|
---|
[9561] | 270 | case pBiasR2:
|
---|
| 271 | if ((obs->prn().system() == 'R') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
| 272 | break;
|
---|
[9386] | 273 | case pBiasE2:
|
---|
| 274 | if ((obs->prn().system() == 'E') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
| 275 | break;
|
---|
| 276 | case pBiasC2:
|
---|
| 277 | if ((obs->prn().system() == 'C') && (tLC == t_lc::l2)) {return 1.0;} else {return 0.0;}
|
---|
| 278 | break;
|
---|
| 279 |
|
---|
[7237] | 280 | }
|
---|
| 281 | return 0.0;
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | //
|
---|
| 285 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 286 | string t_pppParam::toString() const {
|
---|
| 287 | stringstream ss;
|
---|
| 288 | switch (_type) {
|
---|
| 289 | case crdX:
|
---|
| 290 | ss << "CRD_X";
|
---|
| 291 | break;
|
---|
| 292 | case crdY:
|
---|
| 293 | ss << "CRD_Y";
|
---|
| 294 | break;
|
---|
| 295 | case crdZ:
|
---|
| 296 | ss << "CRD_Z";
|
---|
| 297 | break;
|
---|
[10256] | 298 | case rClk:
|
---|
| 299 | ss << "REC_CLK ";
|
---|
[7237] | 300 | break;
|
---|
[10256] | 301 | case offGlo:
|
---|
| 302 | ss << "OFF_GLO ";
|
---|
[7237] | 303 | break;
|
---|
[10256] | 304 | case offGal:
|
---|
| 305 | ss << "OFF_GAL ";
|
---|
[10003] | 306 | break;
|
---|
[10256] | 307 | case offBds:
|
---|
| 308 | ss << "OFF_BDS ";
|
---|
[10003] | 309 | break;
|
---|
[7237] | 310 | case trp:
|
---|
[9386] | 311 | ss << "TRP ";
|
---|
[7237] | 312 | break;
|
---|
[8905] | 313 | case amb:
|
---|
| 314 | ss << "AMB " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
| 315 | break;
|
---|
| 316 | case ion:
|
---|
| 317 | ss << "ION " << left << setw(3) << t_lc::toString(_tLC) << right << ' ' << _prn.toString();
|
---|
| 318 | break;
|
---|
[9386] | 319 | case cBiasG1: case pBiasG1:
|
---|
| 320 | case cBiasG2: case pBiasG2:
|
---|
| 321 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " G ";
|
---|
[8905] | 322 | break;
|
---|
[9561] | 323 | case cBiasR1: case pBiasR1:
|
---|
| 324 | case cBiasR2: case pBiasR2:
|
---|
| 325 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " R ";
|
---|
| 326 | break;
|
---|
[9386] | 327 | case cBiasE1: case pBiasE1:
|
---|
| 328 | case cBiasE2: case pBiasE2:
|
---|
| 329 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " E ";
|
---|
| 330 | break;
|
---|
| 331 | case cBiasC1: case pBiasC1:
|
---|
| 332 | case cBiasC2: case pBiasC2:
|
---|
| 333 | ss << "BIA " << left << setw(3) << t_lc::toString(_tLC) << right << " C ";
|
---|
| 334 | break;
|
---|
[7237] | 335 | }
|
---|
| 336 | return ss.str();
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | // Constructor
|
---|
| 340 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 341 | t_pppParlist::t_pppParlist() {
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | // Destructor
|
---|
| 345 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 346 | t_pppParlist::~t_pppParlist() {
|
---|
[9504] | 347 | _usedSystems.clear();
|
---|
| 348 |
|
---|
[10034] | 349 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
| 350 | delete _params[ii];
|
---|
[7237] | 351 | }
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 | //
|
---|
| 355 | ////////////////////////////////////////////////////////////////////////////
|
---|
[10034] | 356 | t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) {
|
---|
[9504] | 357 |
|
---|
[7237] | 358 | // Remove some Parameters
|
---|
| 359 | // ----------------------
|
---|
| 360 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
| 361 | while (it != _params.end()) {
|
---|
| 362 | t_pppParam* par = *it;
|
---|
| 363 |
|
---|
| 364 | bool remove = false;
|
---|
| 365 |
|
---|
| 366 | if (par->epoSpec()) {
|
---|
| 367 | remove = true;
|
---|
| 368 | }
|
---|
| 369 |
|
---|
[10034] | 370 | else if (par->type() == t_pppParam::amb ||
|
---|
| 371 | par->type() == t_pppParam::crdX ||
|
---|
[7988] | 372 | par->type() == t_pppParam::crdY ||
|
---|
| 373 | par->type() == t_pppParam::crdZ) {
|
---|
[10219] | 374 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
|
---|
[7237] | 375 | remove = true;
|
---|
| 376 | }
|
---|
| 377 | }
|
---|
[10219] | 378 | else if (par->type() == t_pppParam::ion) {
|
---|
| 379 | if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 5.0)) {
|
---|
| 380 | remove = true;
|
---|
| 381 | }
|
---|
| 382 | }
|
---|
[9419] | 383 |
|
---|
[7237] | 384 | if (remove) {
|
---|
[9508] | 385 | #ifdef BNC_DEBUG_PPP
|
---|
[10018] | 386 | // LOG << "remove0 " << par->toString() << std::endl;
|
---|
[9508] | 387 | #endif
|
---|
[7237] | 388 | delete par;
|
---|
| 389 | it = _params.erase(it);
|
---|
| 390 | }
|
---|
| 391 | else {
|
---|
| 392 | ++it;
|
---|
| 393 | }
|
---|
| 394 | }
|
---|
| 395 |
|
---|
[9532] | 396 | // check which systems have observations
|
---|
| 397 | // -------------------------------------
|
---|
| 398 | _usedSystems.clear();
|
---|
| 399 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
| 400 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
[9533] | 401 | char sys = satObs->prn().system();
|
---|
[9532] | 402 | if (!_usedSystems.contains(sys)) {
|
---|
| 403 | _usedSystems.append(sys);
|
---|
| 404 | }
|
---|
| 405 | }
|
---|
| 406 |
|
---|
[7237] | 407 | // Check whether parameters have observations
|
---|
| 408 | // ------------------------------------------
|
---|
| 409 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
| 410 | t_pppParam* par = _params[ii];
|
---|
| 411 | if (par->prn() == 0) {
|
---|
| 412 | par->setLastObsTime(epoTime);
|
---|
| 413 | if (par->firstObsTime().undef()) {
|
---|
| 414 | par->setFirstObsTime(epoTime);
|
---|
| 415 | }
|
---|
| 416 | }
|
---|
| 417 | else {
|
---|
| 418 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
| 419 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
| 420 | if (satObs->prn() == par->prn()) {
|
---|
| 421 | par->setLastObsTime(epoTime);
|
---|
| 422 | if (par->firstObsTime().undef()) {
|
---|
| 423 | par->setFirstObsTime(epoTime);
|
---|
| 424 | }
|
---|
| 425 | break;
|
---|
| 426 | }
|
---|
| 427 | }
|
---|
| 428 | }
|
---|
| 429 | }
|
---|
| 430 |
|
---|
[10251] | 431 | if (OPT->_ionoModelType == OPT->PPP_RTK || OPT->_pseudoObsIono) {
|
---|
[9419] | 432 | vector<t_pppParam*>::iterator it = _params.begin();
|
---|
| 433 | while (it != _params.end()) {
|
---|
| 434 | t_pppParam* par = *it;
|
---|
[9532] | 435 | // Check if systems have to be presented per biases
|
---|
[9535] | 436 | // ----------------------------------------------
|
---|
[10034] | 437 | if (( par->type() == t_pppParam::cBiasG1 ||
|
---|
[9532] | 438 | par->type() == t_pppParam::cBiasG2 ||
|
---|
| 439 | par->type() == t_pppParam::pBiasG1 ||
|
---|
| 440 | par->type() == t_pppParam::pBiasG2) && !usedSystems().contains('G')) {
|
---|
[9534] | 441 | #ifdef BNC_DEBUG_PPP
|
---|
[10031] | 442 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
[9534] | 443 | #endif
|
---|
[9548] | 444 | delete par;
|
---|
| 445 | it = _params.erase(it);
|
---|
[9532] | 446 | }
|
---|
[9561] | 447 | else if ((par->type() == t_pppParam::cBiasR1 ||
|
---|
| 448 | par->type() == t_pppParam::cBiasR2 ||
|
---|
| 449 | par->type() == t_pppParam::pBiasR1 ||
|
---|
| 450 | par->type() == t_pppParam::pBiasR2) && !usedSystems().contains('R')) {
|
---|
| 451 | #ifdef BNC_DEBUG_PPP
|
---|
[10031] | 452 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
[9561] | 453 | #endif
|
---|
| 454 | delete par;
|
---|
| 455 | it = _params.erase(it);
|
---|
| 456 | }
|
---|
[9532] | 457 | else if ((par->type() == t_pppParam::cBiasE1 ||
|
---|
| 458 | par->type() == t_pppParam::cBiasE2 ||
|
---|
| 459 | par->type() == t_pppParam::pBiasE1 ||
|
---|
| 460 | par->type() == t_pppParam::pBiasE2) && !usedSystems().contains('E')) {
|
---|
[9534] | 461 | #ifdef BNC_DEBUG_PPP
|
---|
[10031] | 462 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
[9534] | 463 | #endif
|
---|
[9548] | 464 | delete par;
|
---|
| 465 | it = _params.erase(it);
|
---|
[9532] | 466 | }
|
---|
| 467 | else if ((par->type() == t_pppParam::cBiasC1 ||
|
---|
| 468 | par->type() == t_pppParam::cBiasC2 ||
|
---|
| 469 | par->type() == t_pppParam::pBiasC1 ||
|
---|
[9548] | 470 | par->type() == t_pppParam::pBiasC2) && !usedSystems().contains('C')) {
|
---|
[9534] | 471 | #ifdef BNC_DEBUG_PPP
|
---|
[10031] | 472 | //LOG << "remove1 " << par->toString() << std::endl;
|
---|
[9534] | 473 | #endif
|
---|
[9548] | 474 | delete par;
|
---|
| 475 | it = _params.erase(it);
|
---|
[9532] | 476 | }
|
---|
[9419] | 477 | else {
|
---|
| 478 | ++it;
|
---|
| 479 | }
|
---|
| 480 | }
|
---|
| 481 | }
|
---|
| 482 |
|
---|
[7237] | 483 | // Required Set of Parameters
|
---|
| 484 | // --------------------------
|
---|
| 485 | vector<t_pppParam*> required;
|
---|
| 486 |
|
---|
| 487 | // Coordinates
|
---|
| 488 | // -----------
|
---|
| 489 | required.push_back(new t_pppParam(t_pppParam::crdX, t_prn(), t_lc::dummy));
|
---|
| 490 | required.push_back(new t_pppParam(t_pppParam::crdY, t_prn(), t_lc::dummy));
|
---|
| 491 | required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
|
---|
| 492 |
|
---|
[10232] | 493 | // Receiver Clocks
|
---|
| 494 | // ---------------
|
---|
[10256] | 495 | required.push_back(new t_pppParam(t_pppParam::rClk, t_prn(), t_lc::dummy));
|
---|
[10034] | 496 |
|
---|
[10256] | 497 | // GLONASS Clock Offset
|
---|
| 498 | // --------------------
|
---|
| 499 | if (OPT->useSystem('R')) {
|
---|
| 500 | required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
|
---|
| 501 | }
|
---|
[10034] | 502 |
|
---|
[10256] | 503 | // Galileo Clock Offset
|
---|
| 504 | // --------------------
|
---|
| 505 | if (OPT->useSystem('E')) {
|
---|
| 506 | required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
|
---|
| 507 | }
|
---|
[10034] | 508 |
|
---|
[10256] | 509 | // BDS Clock Offset
|
---|
| 510 | // ----------------
|
---|
| 511 | if (OPT->useSystem('C')) {
|
---|
| 512 | required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
|
---|
| 513 | }
|
---|
[10034] | 514 |
|
---|
| 515 | // Troposphere
|
---|
| 516 | // -----------
|
---|
| 517 | if (OPT->estTrp()) {
|
---|
| 518 | required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
|
---|
| 519 | }
|
---|
| 520 |
|
---|
| 521 | // Ionosphere
|
---|
| 522 | // ----------
|
---|
[10251] | 523 | if (OPT->_ionoModelType == OPT->est) {
|
---|
[10034] | 524 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
| 525 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
[10251] | 526 | char sys = satObs->prn().system();
|
---|
| 527 | std::vector<t_lc::type> LCs = OPT->LCs(sys);
|
---|
| 528 | if (std::find(LCs.begin(), LCs.end(), t_lc::cIF) == LCs.end() &&
|
---|
| 529 | std::find(LCs.begin(), LCs.end(), t_lc::lIF) == LCs.end()) {
|
---|
| 530 | required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
|
---|
| 531 | }
|
---|
[10034] | 532 | }
|
---|
| 533 | }
|
---|
| 534 | // Ambiguities
|
---|
| 535 | // -----------
|
---|
| 536 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
| 537 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
[10251] | 538 | char sys = satObs->prn().system();
|
---|
| 539 | const vector<t_lc::type>& ambLCs = OPT->ambLCs(sys);
|
---|
[10034] | 540 | for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
|
---|
| 541 | required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
|
---|
| 542 | }
|
---|
| 543 | }
|
---|
| 544 |
|
---|
[9386] | 545 | // Receiver Code Biases
|
---|
| 546 | // --------------------
|
---|
[10251] | 547 | if (OPT->_ionoModelType == OPT->PPP_RTK) {
|
---|
[9494] | 548 | std::vector<t_lc::type> lc;
|
---|
[9419] | 549 | if (_usedSystems.contains('G')) {
|
---|
[9494] | 550 | lc = OPT->LCs('G');
|
---|
| 551 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
| 552 | required.push_back(new t_pppParam(t_pppParam::cBiasG1, t_prn(), t_lc::c1));
|
---|
| 553 | }
|
---|
| 554 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 555 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
| 556 | }
|
---|
[9663] | 557 | }
|
---|
[9561] | 558 | if (_usedSystems.contains('R')) {
|
---|
| 559 | lc = OPT->LCs('R');
|
---|
| 560 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
| 561 | required.push_back(new t_pppParam(t_pppParam::cBiasR1, t_prn(), t_lc::c1));
|
---|
| 562 | }
|
---|
| 563 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 564 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
| 565 | }
|
---|
[9663] | 566 | }
|
---|
[9419] | 567 | if (_usedSystems.contains('E')) {
|
---|
[9494] | 568 | lc = OPT->LCs('E');
|
---|
| 569 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
| 570 | required.push_back(new t_pppParam(t_pppParam::cBiasE1, t_prn(), t_lc::c1));
|
---|
| 571 | }
|
---|
| 572 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 573 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
| 574 | }
|
---|
[9386] | 575 | }
|
---|
[9419] | 576 | if (_usedSystems.contains('C')) {
|
---|
[9494] | 577 | lc = OPT->LCs('C');
|
---|
| 578 | if (std::find(lc.begin(), lc.end(), t_lc::c1) != lc.end()) {
|
---|
| 579 | required.push_back(new t_pppParam(t_pppParam::cBiasC1, t_prn(), t_lc::c1));
|
---|
| 580 | }
|
---|
| 581 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 582 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
| 583 | }
|
---|
[9386] | 584 | }
|
---|
| 585 | }
|
---|
[10034] | 586 | if (OPT->_pseudoObsIono) {
|
---|
| 587 | std::vector<t_lc::type> lc;
|
---|
| 588 | if (_usedSystems.contains('G')) {
|
---|
| 589 | lc = OPT->LCs('G');
|
---|
| 590 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 591 | required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
|
---|
| 592 | }
|
---|
| 593 | }
|
---|
| 594 | if (_usedSystems.contains('R')) {
|
---|
| 595 | lc = OPT->LCs('R');
|
---|
| 596 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 597 | required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
|
---|
| 598 | }
|
---|
| 599 | }
|
---|
| 600 | if (_usedSystems.contains('E')) {
|
---|
| 601 | lc = OPT->LCs('E');
|
---|
| 602 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 603 | required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
|
---|
| 604 | }
|
---|
| 605 | }
|
---|
| 606 | if (_usedSystems.contains('C')) {
|
---|
| 607 | lc = OPT->LCs('C');
|
---|
| 608 | if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
|
---|
| 609 | required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
|
---|
| 610 | }
|
---|
| 611 | }
|
---|
| 612 | }
|
---|
[9386] | 613 |
|
---|
| 614 | // Receiver Phase Biases
|
---|
| 615 | // ---------------------
|
---|
[10251] | 616 | if (OPT->_ionoModelType == OPT->PPP_RTK) {
|
---|
[9494] | 617 | std::vector<t_lc::type> lc;
|
---|
[9419] | 618 | if (_usedSystems.contains('G')) {
|
---|
[9494] | 619 | lc = OPT->LCs('G');
|
---|
| 620 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
| 621 | required.push_back(new t_pppParam(t_pppParam::pBiasG1, t_prn(), t_lc::l1));
|
---|
| 622 | }
|
---|
| 623 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
| 624 | required.push_back(new t_pppParam(t_pppParam::pBiasG2, t_prn(), t_lc::l2));
|
---|
| 625 | }
|
---|
[9663] | 626 | }
|
---|
[9561] | 627 | if (_usedSystems.contains('R')) {
|
---|
| 628 | lc = OPT->LCs('R');
|
---|
| 629 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
| 630 | required.push_back(new t_pppParam(t_pppParam::pBiasR1, t_prn(), t_lc::l1));
|
---|
| 631 | }
|
---|
| 632 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
| 633 | required.push_back(new t_pppParam(t_pppParam::pBiasR2, t_prn(), t_lc::l2));
|
---|
| 634 | }
|
---|
[9663] | 635 | }
|
---|
[9419] | 636 | if (_usedSystems.contains('E')) {
|
---|
[9494] | 637 | lc = OPT->LCs('E');
|
---|
| 638 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
| 639 | required.push_back(new t_pppParam(t_pppParam::pBiasE1, t_prn(), t_lc::l1));
|
---|
| 640 | }
|
---|
| 641 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
| 642 | required.push_back(new t_pppParam(t_pppParam::pBiasE2, t_prn(), t_lc::l2));
|
---|
| 643 | }
|
---|
[9386] | 644 | }
|
---|
[9419] | 645 | if (_usedSystems.contains('C')) {
|
---|
[9494] | 646 | lc = OPT->LCs('C');
|
---|
| 647 | if (std::find(lc.begin(), lc.end(), t_lc::l1) != lc.end()) {
|
---|
| 648 | required.push_back(new t_pppParam(t_pppParam::pBiasC1, t_prn(), t_lc::l1));
|
---|
| 649 | }
|
---|
| 650 | if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
|
---|
| 651 | required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
|
---|
| 652 | }
|
---|
[9386] | 653 | }
|
---|
| 654 | }
|
---|
[9419] | 655 |
|
---|
[7237] | 656 | // Check if all required parameters are present
|
---|
| 657 | // --------------------------------------------
|
---|
| 658 | for (unsigned ii = 0; ii < required.size(); ii++) {
|
---|
| 659 | t_pppParam* parReq = required[ii];
|
---|
| 660 |
|
---|
| 661 | bool found = false;
|
---|
| 662 | for (unsigned jj = 0; jj < _params.size(); jj++) {
|
---|
| 663 | t_pppParam* parOld = _params[jj];
|
---|
| 664 | if (parOld->isEqual(parReq)) {
|
---|
| 665 | found = true;
|
---|
| 666 | break;
|
---|
| 667 | }
|
---|
| 668 | }
|
---|
| 669 | if (found) {
|
---|
| 670 | delete parReq;
|
---|
| 671 | }
|
---|
| 672 | else {
|
---|
[9508] | 673 | #ifdef BNC_DEBUG_PPP
|
---|
[10031] | 674 | //LOG << "push_back parReq " << parReq->toString() << std::endl;
|
---|
[9508] | 675 | #endif
|
---|
[7237] | 676 | _params.push_back(parReq);
|
---|
| 677 | }
|
---|
| 678 | }
|
---|
| 679 |
|
---|
| 680 | // Set Parameter Indices
|
---|
| 681 | // ---------------------
|
---|
| 682 | sort(_params.begin(), _params.end(), t_pppParam::sortFunction);
|
---|
| 683 |
|
---|
| 684 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
| 685 | t_pppParam* par = _params[ii];
|
---|
| 686 | par->setIndex(ii);
|
---|
| 687 | for (unsigned jj = 0; jj < obsVector.size(); jj++) {
|
---|
| 688 | const t_pppSatObs* satObs = obsVector[jj];
|
---|
| 689 | if (satObs->prn() == par->prn()) {
|
---|
| 690 | par->setAmbEleSat(satObs->eleSat());
|
---|
| 691 | par->stepAmbNumEpo();
|
---|
| 692 | }
|
---|
| 693 | }
|
---|
| 694 | }
|
---|
| 695 |
|
---|
| 696 | return success;
|
---|
| 697 | }
|
---|
| 698 |
|
---|
| 699 | //
|
---|
| 700 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 701 | void t_pppParlist::printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
|
---|
| 702 | const ColumnVector& xx) const {
|
---|
| 703 |
|
---|
| 704 | string epoTimeStr = string(epoTime);
|
---|
| 705 | const t_pppStation* sta = PPP_CLIENT->staRover();
|
---|
| 706 |
|
---|
| 707 | LOG << endl;
|
---|
| 708 |
|
---|
| 709 | t_pppParam* parX = 0;
|
---|
| 710 | t_pppParam* parY = 0;
|
---|
| 711 | t_pppParam* parZ = 0;
|
---|
[10034] | 712 | for (unsigned ii = 0; ii < _params.size(); ii++) {
|
---|
| 713 | t_pppParam* par = _params[ii];
|
---|
[7237] | 714 | if (par->type() == t_pppParam::crdX) {
|
---|
| 715 | parX = par;
|
---|
| 716 | }
|
---|
| 717 | else if (par->type() == t_pppParam::crdY) {
|
---|
| 718 | parY = par;
|
---|
| 719 | }
|
---|
| 720 | else if (par->type() == t_pppParam::crdZ) {
|
---|
| 721 | parZ = par;
|
---|
| 722 | }
|
---|
| 723 | else {
|
---|
| 724 | int ind = par->indexNew();
|
---|
| 725 | double apr = (par->type() == t_pppParam::trp) ?
|
---|
| 726 | t_tropo::delay_saast(sta->xyzApr(), M_PI/2.0) : par->x0();
|
---|
| 727 | LOG << epoTimeStr << ' ' << par->toString() << ' '
|
---|
| 728 | << setw(10) << setprecision(4) << apr << ' '
|
---|
| 729 | << showpos << setw(10) << setprecision(4) << xx[ind] << noshowpos << " +- "
|
---|
| 730 | << setw(8) << setprecision(4) << sqrt(QQ[ind][ind]);
|
---|
| 731 | if (par->type() == t_pppParam::amb) {
|
---|
| 732 | LOG << " el = " << setw(6) << setprecision(2) << par->ambEleSat() * 180.0 / M_PI
|
---|
| 733 | << " epo = " << setw(4) << par->ambNumEpo();
|
---|
| 734 | }
|
---|
| 735 | LOG << endl;
|
---|
| 736 | }
|
---|
| 737 | }
|
---|
| 738 |
|
---|
| 739 | if (parX && parY && parZ) {
|
---|
| 740 |
|
---|
| 741 | ColumnVector xyz(3);
|
---|
| 742 | xyz[0] = xx[parX->indexNew()];
|
---|
| 743 | xyz[1] = xx[parY->indexNew()];
|
---|
| 744 | xyz[2] = xx[parZ->indexNew()];
|
---|
| 745 |
|
---|
| 746 | ColumnVector neu(3);
|
---|
| 747 | xyz2neu(sta->ellApr().data(), xyz.data(), neu.data());
|
---|
| 748 |
|
---|
| 749 | SymmetricMatrix QQxyz = QQ.SymSubMatrix(1,3);
|
---|
| 750 |
|
---|
| 751 | SymmetricMatrix QQneu(3);
|
---|
| 752 | covariXYZ_NEU(QQxyz, sta->ellApr().data(), QQneu);
|
---|
| 753 |
|
---|
| 754 | LOG << epoTimeStr << ' ' << sta->name()
|
---|
| 755 | << " X = " << setprecision(4) << sta->xyzApr()[0] + xyz[0] << " +- "
|
---|
| 756 | << setprecision(4) << sqrt(QQxyz[0][0])
|
---|
| 757 |
|
---|
| 758 | << " Y = " << setprecision(4) << sta->xyzApr()[1] + xyz[1] << " +- "
|
---|
| 759 | << setprecision(4) << sqrt(QQxyz[1][1])
|
---|
| 760 |
|
---|
| 761 | << " Z = " << setprecision(4) << sta->xyzApr()[2] + xyz[2] << " +- "
|
---|
| 762 | << setprecision(4) << sqrt(QQxyz[2][2])
|
---|
| 763 |
|
---|
| 764 | << " dN = " << setprecision(4) << neu[0] << " +- "
|
---|
| 765 | << setprecision(4) << sqrt(QQneu[0][0])
|
---|
| 766 |
|
---|
| 767 | << " dE = " << setprecision(4) << neu[1] << " +- "
|
---|
| 768 | << setprecision(4) << sqrt(QQneu[1][1])
|
---|
| 769 |
|
---|
| 770 | << " dU = " << setprecision(4) << neu[2] << " +- "
|
---|
| 771 | << setprecision(4) << sqrt(QQneu[2][2])
|
---|
| 772 |
|
---|
| 773 | << endl;
|
---|
| 774 | }
|
---|
[9545] | 775 | return;
|
---|
[7237] | 776 | }
|
---|
| 777 |
|
---|
[9525] | 778 | //
|
---|
| 779 | ////////////////////////////////////////////////////////////////////////////
|
---|
[9527] | 780 | void t_pppParlist::printParams(const bncTime& epoTime) {
|
---|
[9526] | 781 |
|
---|
| 782 | for (unsigned iPar = 0; iPar < _params.size(); iPar++) {
|
---|
[9527] | 783 | LOG << _params[iPar]->toString()
|
---|
| 784 | << "\t lastObsTime().valid() \t" << _params[iPar]->lastObsTime().valid()
|
---|
| 785 | << "\t epoTime - par->lastObsTime() \t" << (epoTime - _params[iPar]->lastObsTime())
|
---|
| 786 | << endl;
|
---|
[9525] | 787 | }
|
---|
| 788 | }
|
---|
| 789 |
|
---|