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

Last change on this file since 10993 was 10953, checked in by stuerze, 3 months 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
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>
[10791]18#include <iomanip>
[7237]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) {
[8215]29 if (eph && (eph->checkState() != t_eph::bad ||
[9674]30 eph->checkState() != t_eph::unhealthy ||
31 eph->checkState() != t_eph::outdated)) {
[7237]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);
[10791]44 if (OPT->_logMode > t_pppOptions::normal) {
45 LOG << "orbCorr " << string(corr->_time) << ' ' << corr->_prn.toString() << endl;
46 }
[7237]47 }
48}
49
50//
51/////////////////////////////////////////////////////////////////////////////
52void t_pppEphPool::putClkCorrection(t_clkCorr* corr) {
53 if (corr) {
54 _satEphPool[corr->_prn.toInt()].putClkCorrection(corr);
[10791]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 }
[7237]60 }
61}
62
63//
64/////////////////////////////////////////////////////////////////////////////
[7278]65t_irc t_pppEphPool::getCrd(const t_prn& prn, const bncTime& tt,
[7237]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) {
[8401]94 if (_ephs.empty()) {
95 return;
96 }
97
[7237]98 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
99 t_eph* eph = _ephs[ii];
100 if (eph->IOD() == corr->_iod) {
[7278]101 eph->setOrbCorr(corr);
[7237]102 }
[10953]103 else {
104 LOG << "putOrbCorrection " << corr->_prn.toString() << " corrIOD = " << corr->_iod << " ephIODs = ";
105 for (auto* e : _ephs) LOG << e->IOD() << " ";
106 LOG << endl;
107 }
[7237]108 }
109 delete corr;
110}
111
112//
113/////////////////////////////////////////////////////////////////////////////
114void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
[8401]115 if (_ephs.empty()) {
116 return;
117 }
118
[7237]119 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
120 t_eph* eph = _ephs[ii];
121 if (eph->IOD() == corr->_iod) {
[7278]122 eph->setClkCorr(corr);
[7237]123 }
[10953]124 else {
125 LOG << "putClockCorrection " << corr->_prn.toString() << " corrIOD = " << corr->_iod << " ephIODs = ";
126 for (auto* e : _ephs) LOG << e->IOD() << " ";
127 LOG << endl;
128 }
[7237]129 }
130 delete corr;
131}
132
133//
134/////////////////////////////////////////////////////////////////////////////
135t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
136 ColumnVector& vv) const {
[8401]137 if (_ephs.empty()) {
138 return failure;
139 }
140
[7237]141 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
[10330]142 const t_eph* eph = _ephs[ii];
[7237]143 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
144 if (irc == success) {
[10330]145 if (outDatedBcep(eph, tt)) {
[7237]146 continue;
147 }
148 return irc;
149 }
150 }
151 return failure;
152}
153
154//
155/////////////////////////////////////////////////////////////////////////////
156int t_pppEphPool::t_satEphPool::getChannel() const {
[8401]157 if (!_ephs.empty()) {
[7237]158 return _ephs[0]->slotNum();
159 }
160 return 0;
161}
Note: See TracBrowser for help on using the repository browser.