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

Last change on this file since 10793 was 10791, checked in by mervart, 3 weeks ago

BNC Multifrequency and PPPAR Client (initial version)

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 4.0 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 <iomanip>
19#include "pppEphPool.h"
20#include "pppInclude.h"
21#include "pppClient.h"
22
23using namespace BNC_PPP;
24using namespace std;
25
26//
27/////////////////////////////////////////////////////////////////////////////
28void t_pppEphPool::putEphemeris(t_eph* eph) {
29 if (eph && (eph->checkState() != t_eph::bad ||
30 eph->checkState() != t_eph::unhealthy ||
31 eph->checkState() != t_eph::outdated)) {
32 _satEphPool[eph->prn().toInt()].putEphemeris(_maxQueueSize, eph);
33 }
34 else {
35 delete eph;
36 }
37}
38
39//
40/////////////////////////////////////////////////////////////////////////////
41void t_pppEphPool::putOrbCorrection(t_orbCorr* corr) {
42 if (corr) {
43 _satEphPool[corr->_prn.toInt()].putOrbCorrection(corr);
44 if (OPT->_logMode > t_pppOptions::normal) {
45 LOG << "orbCorr " << string(corr->_time) << ' ' << corr->_prn.toString() << endl;
46 }
47 }
48}
49
50//
51/////////////////////////////////////////////////////////////////////////////
52void t_pppEphPool::putClkCorrection(t_clkCorr* corr) {
53 if (corr) {
54 _satEphPool[corr->_prn.toInt()].putClkCorrection(corr);
55 if (OPT->_logMode > t_pppOptions::normal) {
56 LOG.setf(ios::fixed);
57 LOG << "clkCorr " << string(corr->_time) << ' ' << corr->_prn.toString() << ' '
58 << setw(7) << setprecision(3) << corr->_dClk * t_CST::c << endl;
59 }
60 }
61}
62
63//
64/////////////////////////////////////////////////////////////////////////////
65t_irc t_pppEphPool::getCrd(const t_prn& prn, const bncTime& tt,
66 ColumnVector& xc, ColumnVector& vv) const {
67 return _satEphPool[prn.toInt()].getCrd(tt, xc, vv);
68}
69
70//
71/////////////////////////////////////////////////////////////////////////////
72int t_pppEphPool::getChannel(const t_prn& prn) const {
73 return _satEphPool[prn.toInt()].getChannel();
74}
75
76//
77/////////////////////////////////////////////////////////////////////////////
78void t_pppEphPool::t_satEphPool::putEphemeris(unsigned maxQueueSize, t_eph* eph) {
79 if (_ephs.empty() || eph->isNewerThan(_ephs.front())) {
80 _ephs.push_front(eph);
81 if (maxQueueSize > 0 && _ephs.size() > maxQueueSize) {
82 delete _ephs.back();
83 _ephs.pop_back();
84 }
85 }
86 else {
87 delete eph;
88 }
89}
90
91//
92/////////////////////////////////////////////////////////////////////////////
93void t_pppEphPool::t_satEphPool::putOrbCorrection(t_orbCorr* corr) {
94 if (_ephs.empty()) {
95 return;
96 }
97
98 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
99 t_eph* eph = _ephs[ii];
100 if (eph->IOD() == corr->_iod) {
101 eph->setOrbCorr(corr);
102 }
103 }
104 delete corr;
105}
106
107//
108/////////////////////////////////////////////////////////////////////////////
109void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
110 if (_ephs.empty()) {
111 return;
112 }
113
114 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
115 t_eph* eph = _ephs[ii];
116 if (eph->IOD() == corr->_iod) {
117 eph->setClkCorr(corr);
118 }
119 }
120 delete corr;
121}
122
123//
124/////////////////////////////////////////////////////////////////////////////
125t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
126 ColumnVector& vv) const {
127 if (_ephs.empty()) {
128 return failure;
129 }
130
131 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
132 const t_eph* eph = _ephs[ii];
133 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
134 if (irc == success) {
135 if (outDatedBcep(eph, tt)) {
136 continue;
137 }
138 return irc;
139 }
140 }
141 return failure;
142}
143
144//
145/////////////////////////////////////////////////////////////////////////////
146int t_pppEphPool::t_satEphPool::getChannel() const {
147 if (!_ephs.empty()) {
148 return _ephs[0]->slotNum();
149 }
150 return 0;
151}
Note: See TracBrowser for help on using the repository browser.