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
RevLine 
[5743]1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
[5828]5 * Class: t_pppEphPool
[5743]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>
[5810]18#include "pppEphPool.h"
19#include "pppInclude.h"
[5789]20#include "pppClient.h"
[5743]21
[5814]22using namespace BNC_PPP;
[5743]23using namespace std;
24
25//
26/////////////////////////////////////////////////////////////////////////////
[5810]27void t_pppEphPool::putEphemeris(t_eph* eph) {
[5749]28 if (eph && eph->ok()) {
[5743]29 _satEphPool[eph->prn().toInt()].putEphemeris(_maxQueueSize, eph);
30 }
31 else {
32 delete eph;
33 }
34}
35
36//
37/////////////////////////////////////////////////////////////////////////////
[5810]38void t_pppEphPool::putOrbCorrection(t_orbCorr* corr) {
[5743]39 if (corr) {
40 _satEphPool[corr->prn().toInt()].putOrbCorrection(corr);
41 }
42}
43
44//
45/////////////////////////////////////////////////////////////////////////////
[5810]46void t_pppEphPool::putClkCorrection(t_clkCorr* corr) {
[5743]47 if (corr) {
48 _satEphPool[corr->prn().toInt()].putClkCorrection(corr);
49 }
50}
51
52//
53/////////////////////////////////////////////////////////////////////////////
[5810]54t_irc t_pppEphPool::getCrd(const t_prn& prn, const bncTime& tt,
[5743]55 ColumnVector& xc, ColumnVector& vv) const {
56 return _satEphPool[prn.toInt()].getCrd(tt, xc, vv);
57}
58
59//
60/////////////////////////////////////////////////////////////////////////////
[5810]61int t_pppEphPool::getChannel(const t_prn& prn) const {
[5743]62 return _satEphPool[prn.toInt()].getChannel();
63}
64
65//
66/////////////////////////////////////////////////////////////////////////////
[5810]67void t_pppEphPool::t_satEphPool::putEphemeris(unsigned maxQueueSize, t_eph* eph) {
[5743]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/////////////////////////////////////////////////////////////////////////////
[5810]82void t_pppEphPool::t_satEphPool::putOrbCorrection(t_orbCorr* corr) {
[5743]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/////////////////////////////////////////////////////////////////////////////
[5810]95void t_pppEphPool::t_satEphPool::putClkCorrection(t_clkCorr* corr) {
[5743]96 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
97 t_eph* eph = _ephs[ii];
[5749]98 if (eph->IOD() == corr->IOD()) {
[5743]99 eph->setClkCorr(corr);
100 }
101 }
102 delete corr;
103}
104
105//
106/////////////////////////////////////////////////////////////////////////////
[5810]107t_irc t_pppEphPool::t_satEphPool::getCrd(const bncTime& tt, ColumnVector& xc,
[5743]108 ColumnVector& vv) const {
109 for (unsigned ii = 0; ii < _ephs.size(); ii++) {
110 t_eph* eph = _ephs[ii];
[5914]111 t_irc irc = eph->getCrd(tt, xc, vv, OPT->useOrbClkCorr());
[5749]112 if (irc == success) {
[5776]113 if (eph->prn().system() == 'R') {
[5749]114 double age = tt - eph->TOC();
[5743]115 if (fabs(age) > 3600.0) {
116 continue;
117 }
118 }
119 return irc;
120 }
121 }
[5749]122 return failure;
[5743]123}
124
125//
126/////////////////////////////////////////////////////////////////////////////
[5810]127int t_pppEphPool::t_satEphPool::getChannel() const {
[5743]128 if (_ephs.size() > 0) {
[5749]129 return _ephs[0]->slotNum();
[5743]130 }
131 return 0;
132}
Note: See TracBrowser for help on using the repository browser.