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

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