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