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

Last change on this file since 10955 was 10953, checked in by stuerze, 6 weeks ago

debug output added

  • 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.4 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 else {
104 LOG << "putOrbCorrection " << corr->_prn.toString() << " corrIOD = " << corr->_iod << " ephIODs = ";
105 for (auto* e : _ephs) LOG << e->IOD() << " ";
106 LOG << endl;
107 }
108 }
109 delete corr;
110}
111
112//
113/////////////////////////////////////////////////////////////////////////////
114void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
115 if (_ephs.empty()) {
116 return;
117 }
118
119 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
120 t_eph* eph = _ephs[ii];
121 if (eph->IOD() == corr->_iod) {
122 eph->setClkCorr(corr);
123 }
124 else {
125 LOG << "putClockCorrection " << corr->_prn.toString() << " corrIOD = " << corr->_iod << " ephIODs = ";
126 for (auto* e : _ephs) LOG << e->IOD() << " ";
127 LOG << endl;
128 }
129 }
130 delete corr;
131}
132
133//
134/////////////////////////////////////////////////////////////////////////////
135t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
136 ColumnVector& vv) const {
137 if (_ephs.empty()) {
138 return failure;
139 }
140
141 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
142 const t_eph* eph = _ephs[ii];
143 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
144 if (irc == success) {
145 if (outDatedBcep(eph, tt)) {
146 continue;
147 }
148 return irc;
149 }
150 }
151 return failure;
152}
153
154//
155/////////////////////////////////////////////////////////////////////////////
156int t_pppEphPool::t_satEphPool::getChannel() const {
157 if (!_ephs.empty()) {
158 return _ephs[0]->slotNum();
159 }
160 return 0;
161}
Note: See TracBrowser for help on using the repository browser.