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