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