source: ntrip/branches/BNC_2.12/src/PPP/pppEphPool.cpp@ 10298

Last change on this file since 10298 was 8443, checked in by stuerze, 6 years ago

minor changes

  • 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
Line 
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 *
13 * Changes:
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) {
28 if (eph && (eph->checkState() != t_eph::bad ||
29 eph->checkState() != t_eph::unhealthy)) {
30 _satEphPool[eph->prn().toInt()].putEphemeris(_maxQueueSize, eph);
31 }
32 else {
33 delete eph;
34 }
35}
36
37//
38/////////////////////////////////////////////////////////////////////////////
39void t_pppEphPool::putOrbCorrection(t_orbCorr* corr) {
40 if (corr) {
41 _satEphPool[corr->_prn.toInt()].putOrbCorrection(corr);
42 }
43}
44
45//
46/////////////////////////////////////////////////////////////////////////////
47void t_pppEphPool::putClkCorrection(t_clkCorr* corr) {
48 if (corr) {
49 _satEphPool[corr->_prn.toInt()].putClkCorrection(corr);
50 }
51}
52
53//
54/////////////////////////////////////////////////////////////////////////////
55t_irc t_pppEphPool::getCrd(const t_prn& prn, const bncTime& tt,
56 ColumnVector& xc, ColumnVector& vv) const {
57 return _satEphPool[prn.toInt()].getCrd(tt, xc, vv);
58}
59
60//
61/////////////////////////////////////////////////////////////////////////////
62int t_pppEphPool::getChannel(const t_prn& prn) const {
63 return _satEphPool[prn.toInt()].getChannel();
64}
65
66//
67/////////////////////////////////////////////////////////////////////////////
68void t_pppEphPool::t_satEphPool::putEphemeris(unsigned maxQueueSize, t_eph* eph) {
69 if (_ephs.empty() || eph->isNewerThan(_ephs.front())) {
70 _ephs.push_front(eph);
71 if (maxQueueSize > 0 && _ephs.size() > maxQueueSize) {
72 delete _ephs.back();
73 _ephs.pop_back();
74 }
75 }
76 else {
77 delete eph;
78 }
79}
80
81//
82/////////////////////////////////////////////////////////////////////////////
83void t_pppEphPool::t_satEphPool::putOrbCorrection(t_orbCorr* corr) {
84 if (_ephs.empty()) {
85 return;
86 }
87
88 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
89 t_eph* eph = _ephs[ii];
90 if (eph->IOD() == corr->_iod) {
91 eph->setOrbCorr(corr);
92 }
93 }
94 delete corr;
95}
96
97//
98/////////////////////////////////////////////////////////////////////////////
99void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
100 if (_ephs.empty()) {
101 return;
102 }
103
104 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
105 t_eph* eph = _ephs[ii];
106 if (eph->IOD() == corr->_iod) {
107 eph->setClkCorr(corr);
108 }
109 }
110 delete corr;
111}
112
113//
114/////////////////////////////////////////////////////////////////////////////
115t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
116 ColumnVector& vv) const {
117 if (_ephs.empty()) {
118 return failure;
119 }
120
121 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
122 t_eph* eph = _ephs[ii];
123 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
124 if (irc == success) {
125 if (eph->prn().system() == 'R') {
126 double age = tt - eph->TOC();
127 if (fabs(age) > 3600.0) {
128 continue;
129 }
130 }
131 return irc;
132 }
133 }
134 return failure;
135}
136
137//
138/////////////////////////////////////////////////////////////////////////////
139int t_pppEphPool::t_satEphPool::getChannel() const {
140 if (!_ephs.empty()) {
141 return _ephs[0]->slotNum();
142 }
143 return 0;
144}
Note: See TracBrowser for help on using the repository browser.