source: ntrip/trunk/BNC/src/satObs.cpp@ 6502

Last change on this file since 6502 was 6502, checked in by mervart, 9 years ago
File size: 7.5 KB
Line 
1#include <iostream>
2#include <iomanip>
3#include <sstream>
4#include <newmatio.h>
5
6#include "satObs.h"
7
8using namespace std;
9
10// Constructor
11////////////////////////////////////////////////////////////////////////////
12t_clkCorr::t_clkCorr() {
13 _iod = 0;
14 _dClk = 0.0;
15 _dotDClk = 0.0;
16 _dotDotDClk = 0.0;
17}
18
19//
20////////////////////////////////////////////////////////////////////////////
21void t_clkCorr::writeEpoch(std::ostream* out, const QList<t_clkCorr>& corrList) {
22 if (!out || corrList.size() == 0) {
23 return;
24 }
25 out->setf(ios::fixed);
26 bncTime epoTime;
27 QListIterator<t_clkCorr> it(corrList);
28 while (it.hasNext()) {
29 const t_clkCorr& corr = it.next();
30 if (!epoTime.valid()) {
31 epoTime = corr._time;
32 *out << "> CLOCK " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
33 << corrList.size() << ' ' << corr._staID << endl;
34 }
35 *out << corr._prn.toString() << ' ' << setw(3) << corr._iod << ' '
36 << setw(10) << setprecision(4) << corr._dClk * t_CST::c << ' '
37 << setw(10) << setprecision(4) << corr._dotDClk * t_CST::c << ' '
38 << setw(10) << setprecision(4) << corr._dotDotDClk * t_CST::c << endl;
39 }
40 out->flush();
41}
42
43//
44////////////////////////////////////////////////////////////////////////////
45void t_clkCorr::readEpoch(const string& epoLine, std::istream& in, QList<t_clkCorr>& corrList) {
46 bncTime epoTime;
47 int numCorr;
48 string staID;
49 if (t_corrSSR::readEpoLine(epoLine, epoTime, numCorr, staID) != t_corrSSR::clkCorr) {
50 return;
51 }
52}
53
54// Constructor
55////////////////////////////////////////////////////////////////////////////
56t_orbCorr::t_orbCorr() {
57 _iod = 0;
58 _system = 'R';
59 _xr.ReSize(3); _xr = 0.0;
60 _dotXr.ReSize(3); _dotXr = 0.0;
61}
62
63//
64////////////////////////////////////////////////////////////////////////////
65void t_orbCorr::writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList) {
66 if (!out || corrList.size() == 0) {
67 return;
68 }
69 out->setf(ios::fixed);
70 bncTime epoTime;
71 QListIterator<t_orbCorr> it(corrList);
72 while (it.hasNext()) {
73 const t_orbCorr& corr = it.next();
74 if (!epoTime.valid()) {
75 epoTime = corr._time;
76 *out << "> ORBIT " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
77 << corrList.size() << ' ' << corr._staID << endl;
78 }
79 *out << corr._prn.toString() << ' ' << setw(3) << corr._iod << ' '
80 << setw(10) << setprecision(4) << corr._xr[0] << ' '
81 << setw(10) << setprecision(4) << corr._xr[1] << ' '
82 << setw(10) << setprecision(4) << corr._xr[2] << " "
83 << setw(10) << setprecision(4) << corr._dotXr[0] << ' '
84 << setw(10) << setprecision(4) << corr._dotXr[1] << ' '
85 << setw(10) << setprecision(4) << corr._dotXr[2] << endl;
86 }
87 out->flush();
88}
89
90//
91////////////////////////////////////////////////////////////////////////////
92void t_orbCorr::readEpoch(const string& epoLine, std::istream& in, QList<t_orbCorr>& corrList) {
93}
94
95//
96////////////////////////////////////////////////////////////////////////////
97void t_satCodeBias::writeEpoch(std::ostream* out, const QList<t_satCodeBias>& biasList) {
98 if (!out || biasList.size() == 0) {
99 return;
100 }
101 out->setf(ios::fixed);
102 bncTime epoTime;
103 QListIterator<t_satCodeBias> it(biasList);
104 while (it.hasNext()) {
105 const t_satCodeBias& satCodeBias = it.next();
106 if (!epoTime.valid()) {
107 epoTime = satCodeBias._time;
108 *out << "> CODE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
109 << biasList.size() << ' ' << satCodeBias._staID << endl;
110 }
111 *out << satCodeBias._prn.toString();
112 for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
113 const t_frqCodeBias& frqCodeBias = satCodeBias._bias[ii];
114 *out << " " << frqCodeBias._rnxType2ch << ' '
115 << setw(10) << setprecision(4) << frqCodeBias._value;
116 }
117 *out << endl;
118 }
119 out->flush();
120}
121
122//
123////////////////////////////////////////////////////////////////////////////
124void t_satCodeBias::readEpoch(const string& epoLine, std::istream& in, QList<t_satCodeBias>& biasList) {
125}
126
127//
128////////////////////////////////////////////////////////////////////////////
129void t_satPhaseBias::writeEpoch(std::ostream* out, const QList<t_satPhaseBias>& biasList) {
130 if (!out || biasList.size() == 0) {
131 return;
132 }
133 out->setf(ios::fixed);
134 bncTime epoTime;
135 QListIterator<t_satPhaseBias> it(biasList);
136 while (it.hasNext()) {
137 const t_satPhaseBias& satPhaseBias = it.next();
138 if (!epoTime.valid()) {
139 epoTime = satPhaseBias._time;
140 *out << "> PHASE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
141 << biasList.size() << ' ' << satPhaseBias._staID << endl;
142 }
143 *out << satPhaseBias._prn.toString() << ' '
144 << setw(12) << setprecision(8) << satPhaseBias._yawDeg << ' '
145 << setw(12) << setprecision(8) << satPhaseBias._yawDegRate << " ";
146 for (unsigned ii = 0; ii < satPhaseBias._bias.size(); ii++) {
147 const t_frqPhaseBias& frqPhaseBias = satPhaseBias._bias[ii];
148 *out << " " << frqPhaseBias._rnxType2ch << ' '
149 << setw(10) << setprecision(4) << frqPhaseBias._value << ' '
150 << setw(3) << frqPhaseBias._fixIndicator << ' '
151 << setw(3) << frqPhaseBias._fixWideLaneIndicator << ' '
152 << setw(3) << frqPhaseBias._jumpCounter;
153 }
154 *out << endl;
155 }
156 out->flush();
157}
158
159//
160////////////////////////////////////////////////////////////////////////////
161void t_satPhaseBias::readEpoch(const string& epoLine, std::istream& in, QList<t_satPhaseBias>& biasList) {
162}
163
164//
165////////////////////////////////////////////////////////////////////////////
166void t_vTec::write(std::ostream* out, const t_vTec& vTec) {
167 if (!out || vTec._layers.size() == 0) {
168 return;
169 }
170 out->setf(ios::fixed);
171 bncTime epoTime = vTec._time;
172 *out << "> VTEC " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
173 << vTec._layers.size() << ' ' << vTec._staID << endl;
174 for (unsigned ii = 0; ii < vTec._layers.size(); ii++) {
175 const t_vTecLayer& layer = vTec._layers[ii];
176 *out << setw(2) << ii+1 << ' '
177 << setw(2) << layer._C.Nrows() << ' '
178 << setw(2) << layer._C.Ncols() << ' '
179 << setw(10) << setprecision(1) << layer._height << endl
180 << setw(10) << setprecision(4) << layer._C
181 << setw(10) << setprecision(4) << layer._S;
182 }
183 out->flush();
184}
185
186//
187////////////////////////////////////////////////////////////////////////////
188void t_vTec::read(const string& epoLine, std::istream& in, t_vTec& vTec) {
189}
190
191//
192////////////////////////////////////////////////////////////////////////////
193t_corrSSR::e_type t_corrSSR::readEpoLine(const string& line, bncTime& epoTime,
194 int& numEntries, string& staID) {
195
196 istringstream inLine(line.c_str());
197
198 char epoChar;
199 string typeString;
200 int year, month, day, hour, min;
201 double sec;
202
203 inLine >> epoChar >> typeString
204 >> year >> month >> day >> hour >> min >> sec >> numEntries >> staID;
205
206 if (epoChar == '>') {
207 epoTime.set(year, month, day, hour, min, sec);
208 if (typeString == "CLOCK") {
209 return clkCorr;
210 }
211 else if (typeString == "ORBIT") {
212 return orbCorr;
213 }
214 else if (typeString == "CODE_BIAS") {
215 return codeBias;
216 }
217 else if (typeString == "PHASE_BIAS") {
218 return phaseBias;
219 }
220 else if (typeString == "VTEC") {
221 return vTec;
222 }
223 }
224
225 return unknown;
226}
Note: See TracBrowser for help on using the repository browser.