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