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

Last change on this file since 6504 was 6504, checked in by mervart, 9 years ago
File size: 8.2 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 for (int ii = 0; ii < numCorr; ii++) {
53 t_clkCorr corr;
54
55 string line;
56 getline(in, line);
57 istringstream in(line.c_str());
58
59 in >> corr._prn >> corr._iod >> corr._dClk >> corr._dotDClk >> corr._dotDotDClk;
60
61 corrList.push_back(corr);
62 }
63}
64
65// Constructor
66////////////////////////////////////////////////////////////////////////////
67t_orbCorr::t_orbCorr() {
68 _iod = 0;
69 _system = 'R';
70 _xr.ReSize(3); _xr = 0.0;
71 _dotXr.ReSize(3); _dotXr = 0.0;
72}
73
74//
75////////////////////////////////////////////////////////////////////////////
76void t_orbCorr::writeEpoch(std::ostream* out, const QList<t_orbCorr>& corrList) {
77 if (!out || corrList.size() == 0) {
78 return;
79 }
80 out->setf(ios::fixed);
81 bncTime epoTime;
82 QListIterator<t_orbCorr> it(corrList);
83 while (it.hasNext()) {
84 const t_orbCorr& corr = it.next();
85 if (!epoTime.valid()) {
86 epoTime = corr._time;
87 *out << "> ORBIT " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
88 << corrList.size() << ' ' << corr._staID << endl;
89 }
90 *out << corr._prn.toString() << ' ' << setw(3) << corr._iod << ' '
91 << setw(10) << setprecision(4) << corr._xr[0] << ' '
92 << setw(10) << setprecision(4) << corr._xr[1] << ' '
93 << setw(10) << setprecision(4) << corr._xr[2] << " "
94 << setw(10) << setprecision(4) << corr._dotXr[0] << ' '
95 << setw(10) << setprecision(4) << corr._dotXr[1] << ' '
96 << setw(10) << setprecision(4) << corr._dotXr[2] << endl;
97 }
98 out->flush();
99}
100
101//
102////////////////////////////////////////////////////////////////////////////
103void t_orbCorr::readEpoch(const string& epoLine, std::istream& in, QList<t_orbCorr>& corrList) {
104 bncTime epoTime;
105 int numCorr;
106 string staID;
107 if (t_corrSSR::readEpoLine(epoLine, epoTime, numCorr, staID) != t_corrSSR::orbCorr) {
108 return;
109 }
110 for (int ii = 0; ii < numCorr; ii++) {
111 t_orbCorr corr;
112
113 string line;
114 getline(in, line);
115 istringstream in(line.c_str());
116
117 in >> corr._prn >> corr._iod
118 >> corr._xr[0] >> corr._xr[1] >> corr._xr[2]
119 >> corr._dotXr[0] >> corr._dotXr[1] >> corr._dotXr[2];
120
121 corrList.push_back(corr);
122 }
123}
124
125//
126////////////////////////////////////////////////////////////////////////////
127void t_satCodeBias::writeEpoch(std::ostream* out, const QList<t_satCodeBias>& biasList) {
128 if (!out || biasList.size() == 0) {
129 return;
130 }
131 out->setf(ios::fixed);
132 bncTime epoTime;
133 QListIterator<t_satCodeBias> it(biasList);
134 while (it.hasNext()) {
135 const t_satCodeBias& satCodeBias = it.next();
136 if (!epoTime.valid()) {
137 epoTime = satCodeBias._time;
138 *out << "> CODE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
139 << biasList.size() << ' ' << satCodeBias._staID << endl;
140 }
141 *out << satCodeBias._prn.toString();
142 for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
143 const t_frqCodeBias& frqCodeBias = satCodeBias._bias[ii];
144 *out << " " << frqCodeBias._rnxType2ch << ' '
145 << setw(10) << setprecision(4) << frqCodeBias._value;
146 }
147 *out << endl;
148 }
149 out->flush();
150}
151
152//
153////////////////////////////////////////////////////////////////////////////
154void t_satCodeBias::readEpoch(const string& epoLine, std::istream& in, QList<t_satCodeBias>& biasList) {
155}
156
157//
158////////////////////////////////////////////////////////////////////////////
159void t_satPhaseBias::writeEpoch(std::ostream* out, const QList<t_satPhaseBias>& biasList) {
160 if (!out || biasList.size() == 0) {
161 return;
162 }
163 out->setf(ios::fixed);
164 bncTime epoTime;
165 QListIterator<t_satPhaseBias> it(biasList);
166 while (it.hasNext()) {
167 const t_satPhaseBias& satPhaseBias = it.next();
168 if (!epoTime.valid()) {
169 epoTime = satPhaseBias._time;
170 *out << "> PHASE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
171 << biasList.size() << ' ' << satPhaseBias._staID << endl;
172 }
173 *out << satPhaseBias._prn.toString() << ' '
174 << setw(12) << setprecision(8) << satPhaseBias._yawDeg << ' '
175 << setw(12) << setprecision(8) << satPhaseBias._yawDegRate << " ";
176 for (unsigned ii = 0; ii < satPhaseBias._bias.size(); ii++) {
177 const t_frqPhaseBias& frqPhaseBias = satPhaseBias._bias[ii];
178 *out << " " << frqPhaseBias._rnxType2ch << ' '
179 << setw(10) << setprecision(4) << frqPhaseBias._value << ' '
180 << setw(3) << frqPhaseBias._fixIndicator << ' '
181 << setw(3) << frqPhaseBias._fixWideLaneIndicator << ' '
182 << setw(3) << frqPhaseBias._jumpCounter;
183 }
184 *out << endl;
185 }
186 out->flush();
187}
188
189//
190////////////////////////////////////////////////////////////////////////////
191void t_satPhaseBias::readEpoch(const string& epoLine, std::istream& in, QList<t_satPhaseBias>& biasList) {
192}
193
194//
195////////////////////////////////////////////////////////////////////////////
196void t_vTec::write(std::ostream* out, const t_vTec& vTec) {
197 if (!out || vTec._layers.size() == 0) {
198 return;
199 }
200 out->setf(ios::fixed);
201 bncTime epoTime = vTec._time;
202 *out << "> VTEC " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
203 << vTec._layers.size() << ' ' << vTec._staID << endl;
204 for (unsigned ii = 0; ii < vTec._layers.size(); ii++) {
205 const t_vTecLayer& layer = vTec._layers[ii];
206 *out << setw(2) << ii+1 << ' '
207 << setw(2) << layer._C.Nrows() << ' '
208 << setw(2) << layer._C.Ncols() << ' '
209 << setw(10) << setprecision(1) << layer._height << endl
210 << setw(10) << setprecision(4) << layer._C
211 << setw(10) << setprecision(4) << layer._S;
212 }
213 out->flush();
214}
215
216//
217////////////////////////////////////////////////////////////////////////////
218void t_vTec::read(const string& epoLine, std::istream& in, t_vTec& vTec) {
219}
220
221//
222////////////////////////////////////////////////////////////////////////////
223t_corrSSR::e_type t_corrSSR::readEpoLine(const string& line, bncTime& epoTime,
224 int& numEntries, string& staID) {
225
226 istringstream inLine(line.c_str());
227
228 char epoChar;
229 string typeString;
230 int year, month, day, hour, min;
231 double sec;
232
233 inLine >> epoChar >> typeString
234 >> year >> month >> day >> hour >> min >> sec >> numEntries >> staID;
235
236 if (epoChar == '>') {
237 epoTime.set(year, month, day, hour, min, sec);
238 if (typeString == "CLOCK") {
239 return clkCorr;
240 }
241 else if (typeString == "ORBIT") {
242 return orbCorr;
243 }
244 else if (typeString == "CODE_BIAS") {
245 return codeBias;
246 }
247 else if (typeString == "PHASE_BIAS") {
248 return phaseBias;
249 }
250 else if (typeString == "VTEC") {
251 return vTec;
252 }
253 }
254
255 return unknown;
256}
Note: See TracBrowser for help on using the repository browser.