source: ntrip/trunk/BNC/src/PPP/pppEphPool.cpp@ 10105

Last change on this file since 10105 was 9674, checked in by stuerze, 3 years ago

minor changes regarding PPP

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 3.7 KB
RevLine 
[7237]1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: t_pppEphPool
6 *
7 * Purpose: Buffer with satellite ephemerides
8 *
9 * Author: L. Mervart
10 *
11 * Created: 29-Jul-2014
12 *
[7278]13 * Changes:
[7237]14 *
15 * -----------------------------------------------------------------------*/
16
17#include <iostream>
18#include "pppEphPool.h"
19#include "pppInclude.h"
20#include "pppClient.h"
21
22using namespace BNC_PPP;
23using namespace std;
24
25//
26/////////////////////////////////////////////////////////////////////////////
27void t_pppEphPool::putEphemeris(t_eph* eph) {
[8215]28 if (eph && (eph->checkState() != t_eph::bad ||
[9674]29 eph->checkState() != t_eph::unhealthy ||
30 eph->checkState() != t_eph::outdated)) {
[7237]31 _satEphPool[eph->prn().toInt()].putEphemeris(_maxQueueSize, eph);
32 }
33 else {
34 delete eph;
35 }
36}
37
38//
39/////////////////////////////////////////////////////////////////////////////
40void t_pppEphPool::putOrbCorrection(t_orbCorr* corr) {
41 if (corr) {
42 _satEphPool[corr->_prn.toInt()].putOrbCorrection(corr);
43 }
44}
45
46//
47/////////////////////////////////////////////////////////////////////////////
48void t_pppEphPool::putClkCorrection(t_clkCorr* corr) {
49 if (corr) {
50 _satEphPool[corr->_prn.toInt()].putClkCorrection(corr);
51 }
52}
53
54//
55/////////////////////////////////////////////////////////////////////////////
[7278]56t_irc t_pppEphPool::getCrd(const t_prn& prn, const bncTime& tt,
[7237]57 ColumnVector& xc, ColumnVector& vv) const {
58 return _satEphPool[prn.toInt()].getCrd(tt, xc, vv);
59}
60
61//
62/////////////////////////////////////////////////////////////////////////////
63int t_pppEphPool::getChannel(const t_prn& prn) const {
64 return _satEphPool[prn.toInt()].getChannel();
65}
66
67//
68/////////////////////////////////////////////////////////////////////////////
69void t_pppEphPool::t_satEphPool::putEphemeris(unsigned maxQueueSize, t_eph* eph) {
70 if (_ephs.empty() || eph->isNewerThan(_ephs.front())) {
71 _ephs.push_front(eph);
72 if (maxQueueSize > 0 && _ephs.size() > maxQueueSize) {
73 delete _ephs.back();
74 _ephs.pop_back();
75 }
76 }
77 else {
78 delete eph;
79 }
80}
81
82//
83/////////////////////////////////////////////////////////////////////////////
84void t_pppEphPool::t_satEphPool::putOrbCorrection(t_orbCorr* corr) {
[8401]85 if (_ephs.empty()) {
86 return;
87 }
88
[7237]89 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
90 t_eph* eph = _ephs[ii];
91 if (eph->IOD() == corr->_iod) {
[7278]92 eph->setOrbCorr(corr);
[7237]93 }
94 }
95 delete corr;
96}
97
98//
99/////////////////////////////////////////////////////////////////////////////
100void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
[8401]101 if (_ephs.empty()) {
102 return;
103 }
104
[7237]105 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
106 t_eph* eph = _ephs[ii];
107 if (eph->IOD() == corr->_iod) {
[7278]108 eph->setClkCorr(corr);
[7237]109 }
110 }
111 delete corr;
112}
113
114//
115/////////////////////////////////////////////////////////////////////////////
116t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
117 ColumnVector& vv) const {
[8401]118 if (_ephs.empty()) {
119 return failure;
120 }
121
[7237]122 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
123 t_eph* eph = _ephs[ii];
124 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
125 if (irc == success) {
126 if (eph->prn().system() == 'R') {
127 double age = tt - eph->TOC();
128 if (fabs(age) > 3600.0) {
129 continue;
130 }
131 }
132 return irc;
133 }
134 }
135 return failure;
136}
137
138//
139/////////////////////////////////////////////////////////////////////////////
140int t_pppEphPool::t_satEphPool::getChannel() const {
[8401]141 if (!_ephs.empty()) {
[7237]142 return _ephs[0]->slotNum();
143 }
144 return 0;
145}
Note: See TracBrowser for help on using the repository browser.