1 | /* -------------------------------------------------------------------------
|
---|
2 | * BKG NTRIP Server
|
---|
3 | * -------------------------------------------------------------------------
|
---|
4 | *
|
---|
5 | * Class: bncRtnetUploadCaster
|
---|
6 | *
|
---|
7 | * Purpose: Connection to NTRIP Caster
|
---|
8 | *
|
---|
9 | * Author: L. Mervart
|
---|
10 | *
|
---|
11 | * Created: 29-Mar-2011
|
---|
12 | *
|
---|
13 | * Changes:
|
---|
14 | *
|
---|
15 | * -----------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 | #include <math.h>
|
---|
18 | #include "bncrtnetuploadcaster.h"
|
---|
19 | #include "bncsettings.h"
|
---|
20 | #include "bncephuser.h"
|
---|
21 | #include "bncclockrinex.h"
|
---|
22 | #include "bncbiassinex.h"
|
---|
23 | #include "bncsp3.h"
|
---|
24 | #include "gnss.h"
|
---|
25 | #include "bncutils.h"
|
---|
26 |
|
---|
27 | using namespace std;
|
---|
28 |
|
---|
29 | // Constructor
|
---|
30 | ////////////////////////////////////////////////////////////////////////////
|
---|
31 | bncRtnetUploadCaster::bncRtnetUploadCaster(const QString& mountpoint,
|
---|
32 | const QString& outHost, int outPort,
|
---|
33 | const QString& ntripVersion,
|
---|
34 | const QString& userName, const QString& password,
|
---|
35 | const QString& crdTrafo, const QString& ssrFormat, bool CoM, const QString& sp3FileName,
|
---|
36 | const QString& rnxFileName, const QString& bsxFileName, int PID, int SID, int IOD, int iRow) :
|
---|
37 | bncUploadCaster(mountpoint, outHost, outPort, ntripVersion, userName, password, iRow, 0) {
|
---|
38 |
|
---|
39 | if (!mountpoint.isEmpty()) {
|
---|
40 | _casterID += mountpoint;
|
---|
41 | }
|
---|
42 | if (!outHost.isEmpty()) {
|
---|
43 | _casterID += " " + outHost;
|
---|
44 | if (outPort) {
|
---|
45 | _casterID += ":" + QString("%1").arg(outPort, 10);
|
---|
46 | }
|
---|
47 | }
|
---|
48 | if (!crdTrafo.isEmpty()) {
|
---|
49 | _casterID += " " + crdTrafo;
|
---|
50 | }
|
---|
51 | if (!sp3FileName.isEmpty()) {
|
---|
52 | _casterID += " " + sp3FileName;
|
---|
53 | }
|
---|
54 | if (!rnxFileName.isEmpty()) {
|
---|
55 | _casterID += " " + rnxFileName;
|
---|
56 | }
|
---|
57 |
|
---|
58 | if (!bsxFileName.isEmpty()) {
|
---|
59 | _casterID += " " + bsxFileName;
|
---|
60 | }
|
---|
61 |
|
---|
62 | _crdTrafo = crdTrafo;
|
---|
63 |
|
---|
64 | _ssrFormat = ssrFormat;
|
---|
65 |
|
---|
66 | _ssrCorr = 0;
|
---|
67 | if (_ssrFormat == "IGS-SSR") {
|
---|
68 | _ssrCorr = new SsrCorrIgs();
|
---|
69 | }
|
---|
70 | else if (_ssrFormat == "RTCM-SSR") {
|
---|
71 | _ssrCorr = new SsrCorrRtcm();
|
---|
72 | }
|
---|
73 |
|
---|
74 | _CoM = CoM;
|
---|
75 | _PID = PID;
|
---|
76 | _SID = SID;
|
---|
77 | _IOD = IOD;
|
---|
78 | _phaseBiasInformationDecoded = false;
|
---|
79 |
|
---|
80 | // Member that receives the ephemeris
|
---|
81 | // ----------------------------------
|
---|
82 | _ephUser = new bncEphUser(true);
|
---|
83 |
|
---|
84 | bncSettings settings;
|
---|
85 | QString intr = settings.value("uploadIntr").toString();
|
---|
86 | QStringList hlp = settings.value("cmbStreams").toStringList();
|
---|
87 | _samplRtcmEphCorr = settings.value("uploadSamplRtcmEphCorr").toDouble();
|
---|
88 | if (hlp.size() > 1) { // combination stream upload
|
---|
89 | _samplRtcmClkCorr = settings.value("cmbSampl").toInt();
|
---|
90 | }
|
---|
91 | else { // single stream upload or sp3 file generation
|
---|
92 | _samplRtcmClkCorr = 5; // default
|
---|
93 | }
|
---|
94 | int samplClkRnx = settings.value("uploadSamplClkRnx").toInt();
|
---|
95 | int samplSp3 = settings.value("uploadSamplSp3").toString().split("sec").first().toInt();
|
---|
96 | int samplBiaSnx = settings.value("uploadSamplBiaSnx").toInt();
|
---|
97 |
|
---|
98 | if (_samplRtcmEphCorr == 0.0) {
|
---|
99 | _usedEph = 0;
|
---|
100 | }
|
---|
101 | else {
|
---|
102 | _usedEph = new QMap<QString, const t_eph*>;
|
---|
103 | }
|
---|
104 |
|
---|
105 | // RINEX writer
|
---|
106 | // ------------
|
---|
107 | if (!rnxFileName.isEmpty()) {
|
---|
108 | _rnx = new bncClockRinex(rnxFileName, intr, samplClkRnx);
|
---|
109 | }
|
---|
110 | else {
|
---|
111 | _rnx = 0;
|
---|
112 | }
|
---|
113 |
|
---|
114 | // SP3 writer
|
---|
115 | // ----------
|
---|
116 | if (!sp3FileName.isEmpty()) {
|
---|
117 | _sp3 = new bncSP3(sp3FileName, intr, samplSp3);
|
---|
118 | }
|
---|
119 | else {
|
---|
120 | _sp3 = 0;
|
---|
121 | }
|
---|
122 |
|
---|
123 | // SINEX writer
|
---|
124 | // ------------
|
---|
125 | if (!bsxFileName.isEmpty()) {
|
---|
126 | _bsx = new bncBiasSinex(bsxFileName, intr, samplBiaSnx);
|
---|
127 | }
|
---|
128 | else {
|
---|
129 | _bsx = 0;
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | // Set Transformation Parameters
|
---|
134 | // -----------------------------
|
---|
135 | // Transformation Parameters from ITRF2014 to ETRF2000
|
---|
136 | // EUREF Technical Note 1 Relationship and Transformation between the ITRF and ETRF
|
---|
137 | // Zuheir Altamimi, June 28, 2018
|
---|
138 | if (_crdTrafo == "ETRF2000") {
|
---|
139 | _dx = 0.0547;
|
---|
140 | _dy = 0.0522;
|
---|
141 | _dz = -0.0741;
|
---|
142 |
|
---|
143 | _dxr = 0.0001;
|
---|
144 | _dyr = 0.0001;
|
---|
145 | _dzr = -0.0019;
|
---|
146 |
|
---|
147 | _ox = 0.001701;
|
---|
148 | _oy = 0.010290;
|
---|
149 | _oz = -0.016632;
|
---|
150 |
|
---|
151 | _oxr = 0.000081;
|
---|
152 | _oyr = 0.000490;
|
---|
153 | _ozr = -0.000729;
|
---|
154 |
|
---|
155 | _sc = 2.12;
|
---|
156 | _scr = 0.11;
|
---|
157 |
|
---|
158 | _t0 = 2010.0;
|
---|
159 | }
|
---|
160 | // Transformation Parameters from ITRF2014 to GDA2020 (Ryan Ruddick, GA)
|
---|
161 | else if (_crdTrafo == "GDA2020") {
|
---|
162 | _dx = 0.0;
|
---|
163 | _dy = 0.0;
|
---|
164 | _dz = 0.0;
|
---|
165 |
|
---|
166 | _dxr = 0.0;
|
---|
167 | _dyr = 0.0;
|
---|
168 | _dzr = 0.0;
|
---|
169 |
|
---|
170 | _ox = 0.0;
|
---|
171 | _oy = 0.0;
|
---|
172 | _oz = 0.0;
|
---|
173 |
|
---|
174 | _oxr = 0.00150379;
|
---|
175 | _oyr = 0.00118346;
|
---|
176 | _ozr = 0.00120716;
|
---|
177 |
|
---|
178 | _sc = 0.0;
|
---|
179 | _scr = 0.0;
|
---|
180 |
|
---|
181 | _t0 = 2020.0;
|
---|
182 | }
|
---|
183 | // Transformation Parameters from IGb14 to SIRGAS2000 (Thanks to Sonia Costa, BRA)
|
---|
184 | // June 29 2020: TX:-0.0027 m TY:-0.0025 m TZ:-0.0042 m SCL:1.20 (ppb) no rotations and no rates.*/
|
---|
185 | else if (_crdTrafo == "SIRGAS2000") {
|
---|
186 | _dx = -0.0027;
|
---|
187 | _dy = -0.0025;
|
---|
188 | _dz = -0.0042;
|
---|
189 |
|
---|
190 | _dxr = 0.0;
|
---|
191 | _dyr = 0.0;
|
---|
192 | _dzr = 0.0;
|
---|
193 |
|
---|
194 | _ox = 0.0;
|
---|
195 | _oy = 0.0;
|
---|
196 | _oz = 0.0;
|
---|
197 |
|
---|
198 | _oxr = 0.0;
|
---|
199 | _oyr = 0.0;
|
---|
200 | _ozr = 0.0;
|
---|
201 |
|
---|
202 | _sc = 1.2;
|
---|
203 | _scr = 0.0;
|
---|
204 | _t0 = 2000.0;
|
---|
205 | }
|
---|
206 | // Transformation Parameters from ITRF2014 to DREF91
|
---|
207 | else if (_crdTrafo == "DREF91") {
|
---|
208 | _dx = 0.0547;
|
---|
209 | _dy = 0.0522;
|
---|
210 | _dz = -0.0741;
|
---|
211 |
|
---|
212 | _dxr = 0.0001;
|
---|
213 | _dyr = 0.0001;
|
---|
214 | _dzr = -0.0019;
|
---|
215 | // ERTF200 + rotation parameters (ETRF2000 => DREF91)
|
---|
216 | _ox = 0.001701 + 0.000658;
|
---|
217 | _oy = 0.010290 - 0.000208;
|
---|
218 | _oz = -0.016632 + 0.000755;
|
---|
219 |
|
---|
220 | _oxr = 0.000081;
|
---|
221 | _oyr = 0.000490;
|
---|
222 | _ozr = -0.000729;
|
---|
223 |
|
---|
224 | _sc = 2.12;
|
---|
225 | _scr = 0.11;
|
---|
226 |
|
---|
227 | _t0 = 2010.0;
|
---|
228 | }
|
---|
229 | else if (_crdTrafo == "Custom") {
|
---|
230 | _dx = settings.value("trafo_dx").toDouble();
|
---|
231 | _dy = settings.value("trafo_dy").toDouble();
|
---|
232 | _dz = settings.value("trafo_dz").toDouble();
|
---|
233 | _dxr = settings.value("trafo_dxr").toDouble();
|
---|
234 | _dyr = settings.value("trafo_dyr").toDouble();
|
---|
235 | _dzr = settings.value("trafo_dzr").toDouble();
|
---|
236 | _ox = settings.value("trafo_ox").toDouble();
|
---|
237 | _oy = settings.value("trafo_oy").toDouble();
|
---|
238 | _oz = settings.value("trafo_oz").toDouble();
|
---|
239 | _oxr = settings.value("trafo_oxr").toDouble();
|
---|
240 | _oyr = settings.value("trafo_oyr").toDouble();
|
---|
241 | _ozr = settings.value("trafo_ozr").toDouble();
|
---|
242 | _sc = settings.value("trafo_sc").toDouble();
|
---|
243 | _scr = settings.value("trafo_scr").toDouble();
|
---|
244 | _t0 = settings.value("trafo_t0").toDouble();
|
---|
245 | }
|
---|
246 | // TODO: the following lines can be deleted if all parameters are updated regarding ITRF2020
|
---|
247 | if (_crdTrafo == "ETRF2000" ||
|
---|
248 | _crdTrafo == "GDA2020" ||
|
---|
249 | _crdTrafo == "DREF91" ||
|
---|
250 | _crdTrafo == "SIRGAS2000") {
|
---|
251 | // Transformation Parameters from ITRF2020 to ITRF2014
|
---|
252 | // from ITRF web site: https://itrf.ign.fr/en/solutions/transformations
|
---|
253 | _dx14 = -0.0014;
|
---|
254 | _dy14 = -0.0009;
|
---|
255 | _dz14 = 0.0014;
|
---|
256 | _dxr14 = 0.0;
|
---|
257 | _dyr14 = -0.0001;
|
---|
258 | _dzr14 = -0.0002;
|
---|
259 | _ox14 = 0.0;
|
---|
260 | _oy14 = 0.0;
|
---|
261 | _oz14 = 0.0;
|
---|
262 | _oxr14 = 0.0;
|
---|
263 | _oyr14 = 0.0;
|
---|
264 | _ozr14 = 0.0;
|
---|
265 | _sc14 = -0.42;
|
---|
266 | _scr14 = 0.0;
|
---|
267 | _t014 = 2015.0;
|
---|
268 | }
|
---|
269 | }
|
---|
270 |
|
---|
271 | // Destructor
|
---|
272 | ////////////////////////////////////////////////////////////////////////////
|
---|
273 | bncRtnetUploadCaster::~bncRtnetUploadCaster() {
|
---|
274 | if (isRunning()) {
|
---|
275 | wait();
|
---|
276 | }
|
---|
277 | delete _rnx;
|
---|
278 | delete _sp3;
|
---|
279 | delete _ephUser;
|
---|
280 | delete _usedEph;
|
---|
281 | delete _ssrCorr;
|
---|
282 | }
|
---|
283 |
|
---|
284 | //
|
---|
285 | ////////////////////////////////////////////////////////////////////////////
|
---|
286 | void bncRtnetUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
|
---|
287 |
|
---|
288 | QMutexLocker locker(&_mutex);
|
---|
289 |
|
---|
290 | // Append to internal buffer
|
---|
291 | // -------------------------
|
---|
292 | _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
|
---|
293 |
|
---|
294 | // Select buffer part that contains last epoch
|
---|
295 | // -------------------------------------------
|
---|
296 |
|
---|
297 | // Find the begin of last epoch
|
---|
298 | int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*');
|
---|
299 | if (iEpoBeg == -1) {
|
---|
300 | _rtnetStreamBuffer.clear();
|
---|
301 | emit(newMessage(QString("bncRtnetUploadCaster: no Epoch line found: %1").arg(_casterID).toLatin1(), false));
|
---|
302 | return;
|
---|
303 | }
|
---|
304 |
|
---|
305 | // Find the begin of the first epoch
|
---|
306 | int iEpoBegEarlier = _rtnetStreamBuffer.indexOf('*');
|
---|
307 | if (iEpoBegEarlier != -1 && iEpoBegEarlier < iEpoBeg) {
|
---|
308 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBegEarlier);
|
---|
309 | }
|
---|
310 | else {
|
---|
311 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
|
---|
312 | }
|
---|
313 |
|
---|
314 | // Find End of the last epoch
|
---|
315 | int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE");
|
---|
316 | if (iEpoEnd == -1) {
|
---|
317 | _rtnetStreamBuffer.clear();
|
---|
318 | emit(newMessage(QString("bncRtnetUploadCaster: no EOE found: %1").arg(_casterID).toLatin1(), false));
|
---|
319 | return;
|
---|
320 | }
|
---|
321 |
|
---|
322 | QStringList lines;
|
---|
323 | // If there is there more than 1 epoch line in the buffer
|
---|
324 | while (_rtnetStreamBuffer.count('*') > 1) {
|
---|
325 | emit(newMessage(QString("bncRtnetUploadCaster: more than 1 epoch in buffer: %1").arg(_rtnetStreamBuffer.count('*')).toLatin1(), false));
|
---|
326 | QString rtnetStreamBuffer = _rtnetStreamBuffer;
|
---|
327 | int nextEpoch = rtnetStreamBuffer.indexOf('*');
|
---|
328 | int nextEpochEnd = rtnetStreamBuffer.indexOf("EOE");
|
---|
329 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(1);
|
---|
330 | if (nextEpoch != -1 && nextEpoch < iEpoEnd) {
|
---|
331 | rtnetStreamBuffer = rtnetStreamBuffer.mid(nextEpoch, nextEpochEnd);
|
---|
332 | lines = rtnetStreamBuffer.split('\n', QString::SkipEmptyParts);
|
---|
333 | if (lines.size() > 2) {
|
---|
334 | decodeRtnetEpoch(lines);
|
---|
335 | }
|
---|
336 | nextEpochEnd = _rtnetStreamBuffer.indexOf("EOE");
|
---|
337 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(nextEpochEnd+3);
|
---|
338 | }
|
---|
339 | else if (nextEpoch != -1 && nextEpoch >= iEpoEnd) {
|
---|
340 | break;
|
---|
341 | }
|
---|
342 | }
|
---|
343 |
|
---|
344 | lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
|
---|
345 |
|
---|
346 | _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3);
|
---|
347 |
|
---|
348 | if (lines.size() < 2) {
|
---|
349 | emit(newMessage(QString("bncRtnetUploadCaster: less than 2 lines to decode : %1").arg(_casterID).toLatin1(), false));
|
---|
350 | return;
|
---|
351 | }
|
---|
352 | decodeRtnetEpoch(lines);
|
---|
353 | }
|
---|
354 |
|
---|
355 | //
|
---|
356 | ////////////////////////////////////////////////////////////////////////////
|
---|
357 | void bncRtnetUploadCaster::decodeRtnetEpoch(QStringList epochLines) {
|
---|
358 |
|
---|
359 | // Read first line (with epoch time)
|
---|
360 | // ---------------------------------
|
---|
361 | QTextStream in(epochLines[0].toLatin1());
|
---|
362 | QString hlp;
|
---|
363 | int year, month, day, hour, min;
|
---|
364 | double sec;
|
---|
365 | in >> hlp >> year >> month >> day >> hour >> min >> sec;
|
---|
366 | bncTime epoTime;
|
---|
367 | epoTime.set(year, month, day, hour, min, sec);
|
---|
368 |
|
---|
369 | emit(newMessage(
|
---|
370 | "bncRtnetUploadCaster: decode " + QByteArray(epoTime.datestr().c_str())
|
---|
371 | + " " + QByteArray(epoTime.timestr().c_str()) + " "
|
---|
372 | + _casterID.toLatin1(), false));
|
---|
373 |
|
---|
374 | struct SsrCorr::ClockOrbit co;
|
---|
375 | memset(&co, 0, sizeof(co));
|
---|
376 | co.EpochTime[CLOCKORBIT_SATGPS] = static_cast<int>(epoTime.gpssec());
|
---|
377 | if (_ssrFormat == "RTCM-SSR") {
|
---|
378 | double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
|
---|
379 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
|
---|
380 | }
|
---|
381 | else if (_ssrFormat == "IGS-SSR") {
|
---|
382 | co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
|
---|
383 | }
|
---|
384 | co.EpochTime[CLOCKORBIT_SATGALILEO] = static_cast<int>(epoTime.gpssec());
|
---|
385 | co.EpochTime[CLOCKORBIT_SATQZSS] = static_cast<int>(epoTime.gpssec());
|
---|
386 | co.EpochTime[CLOCKORBIT_SATSBAS] = static_cast<int>(epoTime.gpssec());
|
---|
387 | if (_ssrFormat == "RTCM-SSR") {
|
---|
388 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
|
---|
389 | }
|
---|
390 | else if (_ssrFormat == "IGS-SSR") {
|
---|
391 | co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
|
---|
392 | }
|
---|
393 | co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
|
---|
394 | co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
|
---|
395 | co.SatRefDatum = _ssrCorr->DATUM_ITRF; // ToDo: to decode from RTNET format
|
---|
396 | co.SSRIOD = _IOD;
|
---|
397 | co.SSRProviderID = _PID; // 256 .. BKG, 257 ... EUREF
|
---|
398 | co.SSRSolutionID = _SID;
|
---|
399 |
|
---|
400 | struct SsrCorr::CodeBias bias;
|
---|
401 | memset(&bias, 0, sizeof(bias));
|
---|
402 | bias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
403 | bias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
404 | bias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
405 | bias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
406 | bias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
407 | bias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
408 | bias.SSRIOD = _IOD;
|
---|
409 | bias.SSRProviderID = _PID;
|
---|
410 | bias.SSRSolutionID = _SID;
|
---|
411 |
|
---|
412 | struct SsrCorr::PhaseBias phasebias;
|
---|
413 | memset(&phasebias, 0, sizeof(phasebias));
|
---|
414 | unsigned int dispersiveBiasConsistenyIndicator = 0;
|
---|
415 | unsigned int mwConsistencyIndicator = 0;
|
---|
416 | phasebias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
|
---|
417 | phasebias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
|
---|
418 | phasebias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
|
---|
419 | phasebias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
|
---|
420 | phasebias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
|
---|
421 | phasebias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
|
---|
422 | phasebias.SSRIOD = _IOD;
|
---|
423 | phasebias.SSRProviderID = _PID;
|
---|
424 | phasebias.SSRSolutionID = _SID;
|
---|
425 |
|
---|
426 | struct SsrCorr::VTEC vtec;
|
---|
427 | memset(&vtec, 0, sizeof(vtec));
|
---|
428 | vtec.EpochTime = static_cast<int>(epoTime.gpssec());
|
---|
429 | vtec.SSRIOD = _IOD;
|
---|
430 | vtec.SSRProviderID = _PID;
|
---|
431 | vtec.SSRSolutionID = _SID;
|
---|
432 |
|
---|
433 | // Default Update Interval
|
---|
434 | // -----------------------
|
---|
435 | int clkUpdInd = 2; // 5 sec
|
---|
436 | int ephUpdInd = clkUpdInd; // default
|
---|
437 |
|
---|
438 | if (!_samplRtcmEphCorr) {
|
---|
439 | _samplRtcmEphCorr = 5.0;
|
---|
440 | }
|
---|
441 |
|
---|
442 | if (_samplRtcmClkCorr > 5.0 && _samplRtcmEphCorr <= 5.0) { // combined orb and clock
|
---|
443 | ephUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
444 | }
|
---|
445 | if (_samplRtcmClkCorr > 5.0) {
|
---|
446 | clkUpdInd = determineUpdateInd(_samplRtcmClkCorr);
|
---|
447 | }
|
---|
448 | if (_samplRtcmEphCorr > 5.0) {
|
---|
449 | ephUpdInd = determineUpdateInd(_samplRtcmEphCorr);
|
---|
450 | }
|
---|
451 |
|
---|
452 | co.UpdateInterval = clkUpdInd;
|
---|
453 | bias.UpdateInterval = ephUpdInd;
|
---|
454 | phasebias.UpdateInterval = ephUpdInd;
|
---|
455 |
|
---|
456 | for (int ii = 1; ii < epochLines.size(); ii++) {
|
---|
457 | QString key; // prn or key VTEC, IND (phase bias indicators)
|
---|
458 | double rtnUra = 0.0; // [m]
|
---|
459 | ColumnVector rtnAPC; rtnAPC.ReSize(3); rtnAPC = 0.0; // [m, m, m]
|
---|
460 | ColumnVector rtnVel; rtnVel.ReSize(3); rtnVel = 0.0; // [m/s, m/s, m/s]
|
---|
461 | ColumnVector rtnCoM; rtnCoM.ReSize(3); rtnCoM = 0.0; // [m, m, m]
|
---|
462 | ColumnVector rtnClk; rtnClk.ReSize(3); rtnClk = 0.0; // [m, m/s, m/s²]
|
---|
463 | ColumnVector rtnClkSig; rtnClkSig.ReSize(3); rtnClkSig = 0.0; // [m, m/s, m/s²]
|
---|
464 | t_prn prn;
|
---|
465 |
|
---|
466 | QTextStream in(epochLines[ii].toLatin1());
|
---|
467 |
|
---|
468 | in >> key;
|
---|
469 |
|
---|
470 | // non-satellite specific parameters
|
---|
471 | if (key.contains("IND", Qt::CaseSensitive)) {
|
---|
472 | in >> dispersiveBiasConsistenyIndicator >> mwConsistencyIndicator;
|
---|
473 | continue;
|
---|
474 | }
|
---|
475 | // non-satellite specific parameters
|
---|
476 | if (key.contains("VTEC", Qt::CaseSensitive)) {
|
---|
477 | double ui;
|
---|
478 | in >> ui >> vtec.NumLayers;
|
---|
479 | vtec.UpdateInterval = (unsigned int) determineUpdateInd(ui);
|
---|
480 | for (unsigned ll = 0; ll < vtec.NumLayers; ll++) {
|
---|
481 | int dummy;
|
---|
482 | in >> dummy >> vtec.Layers[ll].Degree >> vtec.Layers[ll].Order
|
---|
483 | >> vtec.Layers[ll].Height;
|
---|
484 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
485 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
486 | in >> vtec.Layers[ll].Cosinus[iDeg][iOrd];
|
---|
487 | }
|
---|
488 | }
|
---|
489 | for (unsigned iDeg = 0; iDeg <= vtec.Layers[ll].Degree; iDeg++) {
|
---|
490 | for (unsigned iOrd = 0; iOrd <= vtec.Layers[ll].Order; iOrd++) {
|
---|
491 | in >> vtec.Layers[ll].Sinus[iDeg][iOrd];
|
---|
492 | }
|
---|
493 | }
|
---|
494 | }
|
---|
495 | continue;
|
---|
496 | }
|
---|
497 | // satellite specific parameters
|
---|
498 | char sys = key.mid(0, 1).at(0).toLatin1();
|
---|
499 | int number = key.mid(1, 2).toInt();
|
---|
500 | int flags = 0;
|
---|
501 | if (sys == 'E') { // I/NAV
|
---|
502 | flags = 1;
|
---|
503 | }
|
---|
504 | if (number == 0) {
|
---|
505 | continue;
|
---|
506 | }
|
---|
507 | prn.set(sys, number, flags);
|
---|
508 | QString prnInternalStr = QString::fromStdString(prn.toInternalString());
|
---|
509 | QString prnStr = QString::fromStdString(prn.toString());
|
---|
510 |
|
---|
511 | const t_eph* ephLast = _ephUser->ephLast(prnInternalStr);
|
---|
512 | const t_eph* ephPrev = _ephUser->ephPrev(prnInternalStr);
|
---|
513 | const t_eph* eph = ephLast;
|
---|
514 | if (eph) {
|
---|
515 |
|
---|
516 | // Use previous ephemeris if the last one is too recent
|
---|
517 | // ----------------------------------------------------
|
---|
518 | const int MINAGE = 60; // seconds
|
---|
519 | if (ephPrev && eph->receptDateTime().isValid() &&
|
---|
520 | eph->receptDateTime().secsTo(currentDateAndTimeGPS()) < MINAGE) {
|
---|
521 | eph = ephPrev;
|
---|
522 | }
|
---|
523 |
|
---|
524 | // Make sure the clock messages refer to same IOD as orbit messages
|
---|
525 | // ----------------------------------------------------------------
|
---|
526 | if (_usedEph) {
|
---|
527 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
528 | (*_usedEph)[prnInternalStr] = eph;
|
---|
529 | }
|
---|
530 | else {
|
---|
531 | eph = 0;
|
---|
532 | if (_usedEph->contains(prnInternalStr)) {
|
---|
533 | const t_eph* usedEph = _usedEph->value(prnInternalStr);
|
---|
534 | if (usedEph == ephLast) {
|
---|
535 | eph = ephLast;
|
---|
536 | }
|
---|
537 | else if (usedEph == ephPrev) {
|
---|
538 | eph = ephPrev;
|
---|
539 | }
|
---|
540 | }
|
---|
541 | }
|
---|
542 | }
|
---|
543 | }
|
---|
544 |
|
---|
545 | if (eph &&
|
---|
546 | !outDatedBcep(eph) && // detected from storage because of no update
|
---|
547 | eph->checkState() != t_eph::bad &&
|
---|
548 | eph->checkState() != t_eph::unhealthy &&
|
---|
549 | eph->checkState() != t_eph::outdated) { // detected during reception (bncephuser)
|
---|
550 | QMap<QString, double> codeBiases;
|
---|
551 | QList<phaseBiasSignal> phaseBiasList;
|
---|
552 | phaseBiasesSat pbSat;
|
---|
553 | _phaseBiasInformationDecoded = false;
|
---|
554 |
|
---|
555 | while (true) {
|
---|
556 | QString key;
|
---|
557 | int numVal = 0;
|
---|
558 | in >> key;
|
---|
559 | if (in.status() != QTextStream::Ok) {
|
---|
560 | break;
|
---|
561 | }
|
---|
562 | if (key == "APC") {
|
---|
563 | in >> numVal;
|
---|
564 | rtnAPC.ReSize(3); rtnAPC = 0.0;
|
---|
565 | for (int ii = 0; ii < numVal; ii++) {
|
---|
566 | in >> rtnAPC[ii];
|
---|
567 | }
|
---|
568 | }
|
---|
569 | else if (key == "Ura") {
|
---|
570 | in >> numVal;
|
---|
571 | if (numVal == 1)
|
---|
572 | in >> rtnUra;
|
---|
573 | }
|
---|
574 | else if (key == "Clk") {
|
---|
575 | in >> numVal;
|
---|
576 | rtnClk.ReSize(3); rtnClk = 0.0;
|
---|
577 | for (int ii = 0; ii < numVal; ii++) {
|
---|
578 | in >> rtnClk[ii];
|
---|
579 | }
|
---|
580 | }
|
---|
581 | else if (key == "ClkSig") {
|
---|
582 | in >> numVal;
|
---|
583 | rtnClkSig.ReSize(3); rtnClkSig = 0.0;
|
---|
584 | for (int ii = 0; ii < numVal; ii++) {
|
---|
585 | in >> rtnClkSig[ii];
|
---|
586 | }
|
---|
587 | }
|
---|
588 | else if (key == "Vel") {
|
---|
589 | in >> numVal;
|
---|
590 | rtnVel.ReSize(3); rtnVel = 0.0;
|
---|
591 | for (int ii = 0; ii < numVal; ii++) {
|
---|
592 | in >> rtnVel[ii];
|
---|
593 | }
|
---|
594 | }
|
---|
595 | else if (key == "CoM") {
|
---|
596 | in >> numVal;
|
---|
597 | rtnCoM.ReSize(3); rtnCoM = 0.0;
|
---|
598 | for (int ii = 0; ii < numVal; ii++) {
|
---|
599 | in >> rtnCoM[ii];
|
---|
600 | }
|
---|
601 | }
|
---|
602 | else if (key == "CodeBias") {
|
---|
603 | in >> numVal;
|
---|
604 | for (int ii = 0; ii < numVal; ii++) {
|
---|
605 | QString type;
|
---|
606 | double value;
|
---|
607 | in >> type >> value;
|
---|
608 | codeBiases[type] = value;
|
---|
609 | }
|
---|
610 | }
|
---|
611 | else if (key == "YawAngle") {
|
---|
612 | _phaseBiasInformationDecoded = true;
|
---|
613 | in >> numVal >> pbSat.yawAngle;
|
---|
614 | if (pbSat.yawAngle < 0.0) {
|
---|
615 | pbSat.yawAngle += (2*M_PI);
|
---|
616 | }
|
---|
617 | else if (pbSat.yawAngle > 2*M_PI) {
|
---|
618 | pbSat.yawAngle -= (2*M_PI);
|
---|
619 | }
|
---|
620 | }
|
---|
621 | else if (key == "YawRate") {
|
---|
622 | _phaseBiasInformationDecoded = true;
|
---|
623 | in >> numVal >> pbSat.yawRate;
|
---|
624 | }
|
---|
625 | else if (key == "PhaseBias") {
|
---|
626 | _phaseBiasInformationDecoded = true;
|
---|
627 | in >> numVal;
|
---|
628 | for (int ii = 0; ii < numVal; ii++) {
|
---|
629 | phaseBiasSignal pb;
|
---|
630 | in >> pb.type >> pb.bias >> pb.integerIndicator
|
---|
631 | >> pb.wlIndicator >> pb.discontinuityCounter;
|
---|
632 | phaseBiasList.append(pb);
|
---|
633 | }
|
---|
634 | }
|
---|
635 | else {
|
---|
636 | in >> numVal;
|
---|
637 | for (int ii = 0; ii < numVal; ii++) {
|
---|
638 | double dummy;
|
---|
639 | in >> dummy;
|
---|
640 | }
|
---|
641 | emit(newMessage(" RTNET format error: "
|
---|
642 | + epochLines[ii].toLatin1(), false));
|
---|
643 | break;
|
---|
644 | }
|
---|
645 | }
|
---|
646 |
|
---|
647 | struct SsrCorr::ClockOrbit::SatData* sd = 0;
|
---|
648 | if (prn.system() == 'G') {
|
---|
649 | sd = co.Sat + co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
650 | ++co.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
651 | }
|
---|
652 | else if (prn.system() == 'R') {
|
---|
653 | sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
654 | ++co.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
655 | }
|
---|
656 | else if (prn.system() == 'E') {
|
---|
657 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
658 | + co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
659 | ++co.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
660 | }
|
---|
661 | else if (prn.system() == 'J') {
|
---|
662 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
663 | + CLOCKORBIT_NUMGALILEO
|
---|
664 | + co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
665 | ++co.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
666 | }
|
---|
667 | else if (prn.system() == 'S') {
|
---|
668 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
669 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
670 | + co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
671 | ++co.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
672 | }
|
---|
673 | else if (prn.system() == 'C') {
|
---|
674 | sd = co.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
675 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
676 | + CLOCKORBIT_NUMSBAS
|
---|
677 | + co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
678 | ++co.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
679 | }
|
---|
680 | if (sd) {
|
---|
681 | QString outLine;
|
---|
682 | t_irc irc = processSatellite(eph, epoTime.gpsw(), epoTime.gpssec(), prnStr, rtnAPC,
|
---|
683 | rtnUra, rtnClk, rtnVel, rtnCoM, rtnClkSig, sd, outLine);
|
---|
684 | if (irc != success) {
|
---|
685 | continue;
|
---|
686 | }
|
---|
687 | }
|
---|
688 |
|
---|
689 | // Code Biases
|
---|
690 | // -----------
|
---|
691 | struct SsrCorr::CodeBias::BiasSat* biasSat = 0;
|
---|
692 | if (!codeBiases.isEmpty()) {
|
---|
693 | if (prn.system() == 'G') {
|
---|
694 | biasSat = bias.Sat + bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
695 | ++bias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
696 | }
|
---|
697 | else if (prn.system() == 'R') {
|
---|
698 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS
|
---|
699 | + bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
700 | ++bias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
701 | }
|
---|
702 | else if (prn.system() == 'E') {
|
---|
703 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
704 | + bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
705 | ++bias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
706 | }
|
---|
707 | else if (prn.system() == 'J') {
|
---|
708 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
709 | + CLOCKORBIT_NUMGALILEO
|
---|
710 | + bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
711 | ++bias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
712 | }
|
---|
713 | else if (prn.system() == 'S') {
|
---|
714 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
715 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
716 | + bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
717 | ++bias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
718 | }
|
---|
719 | else if (prn.system() == 'C') {
|
---|
720 | biasSat = bias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
721 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
722 | + CLOCKORBIT_NUMSBAS
|
---|
723 | + bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
724 | ++bias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
725 | }
|
---|
726 | }
|
---|
727 |
|
---|
728 | if (biasSat) {
|
---|
729 | biasSat->ID = prn.number();
|
---|
730 | biasSat->NumberOfCodeBiases = 0;
|
---|
731 | QMapIterator<QString, double> it(codeBiases);
|
---|
732 | while (it.hasNext()) {
|
---|
733 | it.next();
|
---|
734 | int ii = biasSat->NumberOfCodeBiases;
|
---|
735 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
736 | break;
|
---|
737 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), it.key().toStdString());
|
---|
738 | if (type != _ssrCorr->RESERVED) {
|
---|
739 | biasSat->NumberOfCodeBiases += 1;
|
---|
740 | biasSat->Biases[ii].Type = type;
|
---|
741 | biasSat->Biases[ii].Bias = it.value();
|
---|
742 | if (_bsx) {
|
---|
743 | QString obsCode = 'C' + it.key();
|
---|
744 | _bsx->write(epoTime.gpsw(), epoTime.gpssec(), prnStr, obsCode, it.value());
|
---|
745 | }
|
---|
746 | }
|
---|
747 | }
|
---|
748 | }
|
---|
749 |
|
---|
750 | // Phase Biases
|
---|
751 | // ------------
|
---|
752 | struct SsrCorr::PhaseBias::PhaseBiasSat* phasebiasSat = 0;
|
---|
753 | if (prn.system() == 'G') {
|
---|
754 | phasebiasSat = phasebias.Sat
|
---|
755 | + phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
756 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGPS];
|
---|
757 | }
|
---|
758 | else if (prn.system() == 'R') {
|
---|
759 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS
|
---|
760 | + phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
761 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS];
|
---|
762 | }
|
---|
763 | else if (prn.system() == 'E') {
|
---|
764 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
765 | + phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
766 | ++phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO];
|
---|
767 | }
|
---|
768 | else if (prn.system() == 'J') {
|
---|
769 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
770 | + CLOCKORBIT_NUMGALILEO
|
---|
771 | + phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
772 | ++phasebias.NumberOfSat[CLOCKORBIT_SATQZSS];
|
---|
773 | }
|
---|
774 | else if (prn.system() == 'S') {
|
---|
775 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
776 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
777 | + phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
778 | ++phasebias.NumberOfSat[CLOCKORBIT_SATSBAS];
|
---|
779 | }
|
---|
780 | else if (prn.system() == 'C') {
|
---|
781 | phasebiasSat = phasebias.Sat + CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
|
---|
782 | + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
|
---|
783 | + CLOCKORBIT_NUMSBAS
|
---|
784 | + phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
785 | ++phasebias.NumberOfSat[CLOCKORBIT_SATBDS];
|
---|
786 | }
|
---|
787 |
|
---|
788 | if (phasebiasSat && _phaseBiasInformationDecoded) {
|
---|
789 | phasebias.DispersiveBiasConsistencyIndicator = dispersiveBiasConsistenyIndicator;
|
---|
790 | phasebias.MWConsistencyIndicator = mwConsistencyIndicator;
|
---|
791 | phasebiasSat->ID = prn.number();
|
---|
792 | phasebiasSat->NumberOfPhaseBiases = 0;
|
---|
793 | phasebiasSat->YawAngle = pbSat.yawAngle;
|
---|
794 | phasebiasSat->YawRate = pbSat.yawRate;
|
---|
795 | QListIterator<phaseBiasSignal> it(phaseBiasList);
|
---|
796 | while (it.hasNext()) {
|
---|
797 | const phaseBiasSignal &pbSig = it.next();
|
---|
798 | int ii = phasebiasSat->NumberOfPhaseBiases;
|
---|
799 | if (ii >= CLOCKORBIT_NUMBIAS)
|
---|
800 | break;
|
---|
801 | SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), pbSig.type.toStdString());
|
---|
802 | if (type != _ssrCorr->RESERVED) {
|
---|
803 | phasebiasSat->NumberOfPhaseBiases += 1;
|
---|
804 | phasebiasSat->Biases[ii].Type = type;
|
---|
805 | phasebiasSat->Biases[ii].Bias = pbSig.bias;
|
---|
806 | phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
|
---|
807 | phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
|
---|
808 | phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
|
---|
809 | if (_bsx) {
|
---|
810 | QString obsCode = 'L' + pbSig.type;
|
---|
811 | _bsx->write(epoTime.gpsw(), epoTime.gpssec(), prnStr, obsCode, pbSig.bias);
|
---|
812 | }
|
---|
813 | }
|
---|
814 | }
|
---|
815 | }
|
---|
816 | }
|
---|
817 | }
|
---|
818 |
|
---|
819 | QByteArray hlpBufferCo;
|
---|
820 |
|
---|
821 | // Orbit and Clock Corrections together
|
---|
822 | // ------------------------------------
|
---|
823 | if (_samplRtcmEphCorr == _samplRtcmClkCorr) {
|
---|
824 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
825 | || co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
826 | || co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
827 | || co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
828 | || co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
829 | || co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
830 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
831 | int len = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
832 | if (len > 0) {
|
---|
833 | hlpBufferCo = QByteArray(obuffer, len);
|
---|
834 | }
|
---|
835 | }
|
---|
836 | }
|
---|
837 |
|
---|
838 | // Orbit and Clock Corrections separately
|
---|
839 | // --------------------------------------
|
---|
840 | else {
|
---|
841 | if (co.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
|
---|
842 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
843 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
844 | co.UpdateInterval = ephUpdInd;
|
---|
845 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSORBIT, 1, obuffer,
|
---|
846 | sizeof(obuffer));
|
---|
847 | co.UpdateInterval = clkUpdInd;
|
---|
848 | if (len1 > 0) {
|
---|
849 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
850 | }
|
---|
851 | }
|
---|
852 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 ||
|
---|
853 | co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
854 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
855 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
856 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
857 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSCLOCK, mmsg, obuffer,
|
---|
858 | sizeof(obuffer));
|
---|
859 | if (len2 > 0) {
|
---|
860 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
861 | }
|
---|
862 | }
|
---|
863 | if (co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
|
---|
864 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
865 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
866 | co.UpdateInterval = ephUpdInd;
|
---|
867 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSORBIT, 1, obuffer,
|
---|
868 | sizeof(obuffer));
|
---|
869 | co.UpdateInterval = clkUpdInd;
|
---|
870 | if (len1 > 0) {
|
---|
871 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
872 | }
|
---|
873 | }
|
---|
874 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 ||
|
---|
875 | co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
876 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
877 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
878 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSCLOCK, mmsg, obuffer,
|
---|
879 | sizeof(obuffer));
|
---|
880 | if (len2 > 0) {
|
---|
881 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
882 | }
|
---|
883 | }
|
---|
884 | if (co.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0) {
|
---|
885 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
886 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
887 | co.UpdateInterval = ephUpdInd;
|
---|
888 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOORBIT, 1, obuffer,
|
---|
889 | sizeof(obuffer));
|
---|
890 | co.UpdateInterval = clkUpdInd;
|
---|
891 | if (len1 > 0) {
|
---|
892 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
893 | }
|
---|
894 | }
|
---|
895 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 ||
|
---|
896 | co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
897 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
898 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOCLOCK, mmsg, obuffer,
|
---|
899 | sizeof(obuffer));
|
---|
900 | if (len2 > 0) {
|
---|
901 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
902 | }
|
---|
903 | }
|
---|
904 | if (co.NumberOfSat[CLOCKORBIT_SATQZSS] > 0) {
|
---|
905 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
906 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
907 | co.UpdateInterval = ephUpdInd;
|
---|
908 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSORBIT, 1, obuffer,
|
---|
909 | sizeof(obuffer));
|
---|
910 | co.UpdateInterval = clkUpdInd;
|
---|
911 | if (len1 > 0) {
|
---|
912 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
913 | }
|
---|
914 | }
|
---|
915 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 ||
|
---|
916 | co.NumberOfSat[CLOCKORBIT_SATBDS] > 0 ) ? 1 : 0;
|
---|
917 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSCLOCK, mmsg, obuffer,
|
---|
918 | sizeof(obuffer));
|
---|
919 | if (len2 > 0) {
|
---|
920 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
921 | }
|
---|
922 | }
|
---|
923 | if (co.NumberOfSat[CLOCKORBIT_SATSBAS] > 0) {
|
---|
924 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
925 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
926 | co.UpdateInterval = ephUpdInd;
|
---|
927 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASORBIT, 1, obuffer,
|
---|
928 | sizeof(obuffer));
|
---|
929 | co.UpdateInterval = clkUpdInd;
|
---|
930 | if (len1 > 0) {
|
---|
931 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
932 | }
|
---|
933 | }
|
---|
934 | int mmsg = (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) ? 1 : 0;
|
---|
935 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASCLOCK, mmsg, obuffer,
|
---|
936 | sizeof(obuffer));
|
---|
937 | if (len2 > 0) {
|
---|
938 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
939 | }
|
---|
940 | }
|
---|
941 | if (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
942 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
943 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
944 | co.UpdateInterval = ephUpdInd;
|
---|
945 | int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSORBIT, 1, obuffer,
|
---|
946 | sizeof(obuffer));
|
---|
947 | co.UpdateInterval = clkUpdInd;
|
---|
948 | if (len1 > 0) {
|
---|
949 | hlpBufferCo += QByteArray(obuffer, len1);
|
---|
950 | }
|
---|
951 | }
|
---|
952 | int mmsg = 0;
|
---|
953 | int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSCLOCK, mmsg, obuffer,
|
---|
954 | sizeof(obuffer));
|
---|
955 | if (len2 > 0) {
|
---|
956 | hlpBufferCo += QByteArray(obuffer, len2);
|
---|
957 | }
|
---|
958 | }
|
---|
959 | }
|
---|
960 |
|
---|
961 | // Code Biases
|
---|
962 | // -----------
|
---|
963 | QByteArray hlpBufferBias;
|
---|
964 | if (bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
965 | || bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
966 | || bias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
967 | || bias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
968 | || bias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
969 | || bias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
---|
970 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
971 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
972 | int len = _ssrCorr->MakeCodeBias(&bias, _ssrCorr->CBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
973 | if (len > 0) {
|
---|
974 | hlpBufferBias = QByteArray(obuffer, len);
|
---|
975 | }
|
---|
976 | }
|
---|
977 | }
|
---|
978 |
|
---|
979 | // Phase Biases
|
---|
980 | // ------------
|
---|
981 | QByteArray hlpBufferPhaseBias;
|
---|
982 | if ((phasebias.NumberOfSat[CLOCKORBIT_SATGPS] > 0
|
---|
983 | || phasebias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0
|
---|
984 | || phasebias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0
|
---|
985 | || phasebias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0
|
---|
986 | || phasebias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0
|
---|
987 | || phasebias.NumberOfSat[CLOCKORBIT_SATBDS] > 0)
|
---|
988 | && (_phaseBiasInformationDecoded)) {
|
---|
989 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
990 | if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
|
---|
991 | int len = _ssrCorr->MakePhaseBias(&phasebias, _ssrCorr->PBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
992 | if (len > 0) {
|
---|
993 | hlpBufferPhaseBias = QByteArray(obuffer, len);
|
---|
994 | }
|
---|
995 | }
|
---|
996 | }
|
---|
997 |
|
---|
998 | // VTEC
|
---|
999 | // ----
|
---|
1000 | QByteArray hlpBufferVtec;
|
---|
1001 | if (vtec.NumLayers > 0) {
|
---|
1002 | char obuffer[CLOCKORBIT_BUFFERSIZE] = {0};
|
---|
1003 | int len = _ssrCorr->MakeVTEC(&vtec, 0, obuffer, sizeof(obuffer));
|
---|
1004 | if (len > 0) {
|
---|
1005 | hlpBufferVtec = QByteArray(obuffer, len);
|
---|
1006 | }
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | _outBuffer += hlpBufferCo + hlpBufferBias + hlpBufferPhaseBias + hlpBufferVtec + '\0';
|
---|
1010 | }
|
---|
1011 | //
|
---|
1012 | ////////////////////////////////////////////////////////////////////////////
|
---|
1013 | t_irc bncRtnetUploadCaster::processSatellite(const t_eph* eph, int GPSweek,
|
---|
1014 | double GPSweeks, const QString& prn, const ColumnVector& rtnAPC,
|
---|
1015 | double rtnUra, const ColumnVector& rtnClk, const ColumnVector& rtnVel,
|
---|
1016 | const ColumnVector& rtnCoM, const ColumnVector& rtnClkSig,
|
---|
1017 | struct SsrCorr::ClockOrbit::SatData* sd, QString& outLine) {
|
---|
1018 |
|
---|
1019 | // Broadcast Position and Velocity
|
---|
1020 | // -------------------------------
|
---|
1021 | ColumnVector xB(6);
|
---|
1022 | ColumnVector vB(3);
|
---|
1023 | t_irc irc = eph->getCrd(bncTime(GPSweek, GPSweeks), xB, vB, false);
|
---|
1024 |
|
---|
1025 | if (irc != success) {
|
---|
1026 | return irc;
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | // Precise Position
|
---|
1030 | // ----------------
|
---|
1031 | ColumnVector xP = _CoM ? rtnCoM : rtnAPC;
|
---|
1032 |
|
---|
1033 | if (xP.size() == 0) {
|
---|
1034 | return failure;
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | double dc = 0.0;
|
---|
1038 | if (_crdTrafo != "IGS20") {
|
---|
1039 | crdTrafo14(GPSweek, xP, dc); // ITRF2020 => ITRF2014
|
---|
1040 | crdTrafo(GPSweek, xP, dc); // ITRF2014 to other reference frames
|
---|
1041 | }
|
---|
1042 |
|
---|
1043 | // Difference in xyz
|
---|
1044 | // -----------------
|
---|
1045 | ColumnVector dx = xB.Rows(1, 3) - xP;
|
---|
1046 | ColumnVector dv = vB - rtnVel;
|
---|
1047 |
|
---|
1048 | // Difference in RSW
|
---|
1049 | // -----------------
|
---|
1050 | ColumnVector rsw(3);
|
---|
1051 | XYZ_to_RSW(xB.Rows(1, 3), vB, dx, rsw);
|
---|
1052 |
|
---|
1053 | ColumnVector dotRsw(3);
|
---|
1054 | XYZ_to_RSW(xB.Rows(1, 3), vB, dv, dotRsw);
|
---|
1055 |
|
---|
1056 | // Clock Correction
|
---|
1057 | // ----------------
|
---|
1058 | double dClkA0 = rtnClk(1) - (xB(4) - dc) * t_CST::c;
|
---|
1059 | double dClkA1 = 0.0;
|
---|
1060 | if (rtnClk(2)) {
|
---|
1061 | dClkA1 = rtnClk(2) - xB(5) * t_CST::c;
|
---|
1062 | }
|
---|
1063 | double dClkA2 = 0.0;
|
---|
1064 | if (rtnClk(3)) {
|
---|
1065 | dClkA2 = rtnClk(3) - xB(6) * t_CST::c;
|
---|
1066 | }
|
---|
1067 |
|
---|
1068 | if (sd) {
|
---|
1069 | sd->ID = prn.mid(1).toInt();
|
---|
1070 | sd->IOD = eph->IOD();
|
---|
1071 | sd->Clock.DeltaA0 = dClkA0;
|
---|
1072 | sd->Clock.DeltaA1 = dClkA1;
|
---|
1073 | sd->Clock.DeltaA2 = dClkA2;
|
---|
1074 | sd->UserRangeAccuracy = rtnUra;
|
---|
1075 | sd->Orbit.DeltaRadial = rsw(1);
|
---|
1076 | sd->Orbit.DeltaAlongTrack = rsw(2);
|
---|
1077 | sd->Orbit.DeltaCrossTrack = rsw(3);
|
---|
1078 | sd->Orbit.DotDeltaRadial = dotRsw(1);
|
---|
1079 | sd->Orbit.DotDeltaAlongTrack = dotRsw(2);
|
---|
1080 | sd->Orbit.DotDeltaCrossTrack = dotRsw(3);
|
---|
1081 |
|
---|
1082 | if (corrIsOutOfRange(sd)) {
|
---|
1083 | return failure;
|
---|
1084 | }
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | outLine = QString().asprintf("%d %.1f %s %u %10.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", GPSweek,
|
---|
1088 | GPSweeks, eph->prn().toString().c_str(), eph->IOD(), dClkA0, dClkA1, dClkA2,
|
---|
1089 | rsw(1), rsw(2), rsw(3)); //fprintf(stderr, "%s\n", outLine.toStdString().c_str());
|
---|
1090 |
|
---|
1091 | // RTNET full clock for RINEX and SP3 file
|
---|
1092 | // ---------------------------------------
|
---|
1093 | double relativity = -2.0 * DotProduct(xP, rtnVel) / t_CST::c;
|
---|
1094 | double clkRnx = (rtnClk[0] - relativity) / t_CST::c; // [s]
|
---|
1095 | double clkRnxRate = rtnClk[1] / t_CST::c; // [s/s = -]
|
---|
1096 | double clkRnxAcc = rtnClk[2] / t_CST::c; // [s/s² = -/s]
|
---|
1097 |
|
---|
1098 | if (_rnx) {
|
---|
1099 | double clkRnxSig, clkRnxRateSig, clkRnxAccSig;
|
---|
1100 | int s = rtnClkSig.size();
|
---|
1101 | switch (s) {
|
---|
1102 | case 1:
|
---|
1103 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
1104 | clkRnxRateSig = 0.0; // [s/s = -]
|
---|
1105 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
1106 | break;
|
---|
1107 | case 2:
|
---|
1108 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
1109 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
1110 | clkRnxAccSig = 0.0; // [s/s² ) -/s]
|
---|
1111 | break;
|
---|
1112 | case 3:
|
---|
1113 | clkRnxSig = rtnClkSig[0] / t_CST::c; // [s]
|
---|
1114 | clkRnxRateSig = rtnClkSig[1] / t_CST::c; // [s/s = -]
|
---|
1115 | clkRnxAccSig = rtnClkSig[2] / t_CST::c; // [s/s² ) -/s]
|
---|
1116 | break;
|
---|
1117 | }
|
---|
1118 | _rnx->write(GPSweek, GPSweeks, prn, clkRnx, clkRnxRate, clkRnxAcc,
|
---|
1119 | clkRnxSig, clkRnxRateSig, clkRnxAccSig);
|
---|
1120 | }
|
---|
1121 | if (_sp3) {
|
---|
1122 | _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, clkRnx, rtnVel, clkRnxRate);
|
---|
1123 | }
|
---|
1124 | return success;
|
---|
1125 | }
|
---|
1126 |
|
---|
1127 | // Transform Coordinates
|
---|
1128 | ////////////////////////////////////////////////////////////////////////////
|
---|
1129 | void bncRtnetUploadCaster::crdTrafo(int GPSWeek, ColumnVector& xyz,
|
---|
1130 | double& dc) {
|
---|
1131 |
|
---|
1132 | // Current epoch minus 2000.0 in years
|
---|
1133 | // ------------------------------------
|
---|
1134 | double dt = (GPSWeek - (1042.0 + 6.0 / 7.0)) / 365.2422 * 7.0 + 2000.0 - _t0;
|
---|
1135 |
|
---|
1136 | ColumnVector dx(3);
|
---|
1137 |
|
---|
1138 | dx(1) = _dx + dt * _dxr;
|
---|
1139 | dx(2) = _dy + dt * _dyr;
|
---|
1140 | dx(3) = _dz + dt * _dzr;
|
---|
1141 |
|
---|
1142 | static const double arcSec = 180.0 * 3600.0 / M_PI;
|
---|
1143 |
|
---|
1144 | double ox = (_ox + dt * _oxr) / arcSec;
|
---|
1145 | double oy = (_oy + dt * _oyr) / arcSec;
|
---|
1146 | double oz = (_oz + dt * _ozr) / arcSec;
|
---|
1147 |
|
---|
1148 | double sc = 1.0 + _sc * 1e-9 + dt * _scr * 1e-9;
|
---|
1149 |
|
---|
1150 | // Specify approximate center of area
|
---|
1151 | // ----------------------------------
|
---|
1152 | ColumnVector meanSta(3);
|
---|
1153 |
|
---|
1154 | if (_crdTrafo == "ETRF2000") {
|
---|
1155 | meanSta(1) = 3661090.0;
|
---|
1156 | meanSta(2) = 845230.0;
|
---|
1157 | meanSta(3) = 5136850.0;
|
---|
1158 | }
|
---|
1159 | else if (_crdTrafo == "GDA2020") {
|
---|
1160 | meanSta(1) = -4052050.0;
|
---|
1161 | meanSta(2) = 4212840.0;
|
---|
1162 | meanSta(3) = -2545110.0;
|
---|
1163 | }
|
---|
1164 | else if (_crdTrafo == "SIRGAS2000") {
|
---|
1165 | meanSta(1) = 3740860.0;
|
---|
1166 | meanSta(2) = -4964290.0;
|
---|
1167 | meanSta(3) = -1425420.0;
|
---|
1168 | }
|
---|
1169 | else if (_crdTrafo == "DREF91") {
|
---|
1170 | meanSta(1) = 3959579.0;
|
---|
1171 | meanSta(2) = 721719.0;
|
---|
1172 | meanSta(3) = 4931539.0;
|
---|
1173 | }
|
---|
1174 | else if (_crdTrafo == "Custom") {
|
---|
1175 | meanSta(1) = 0.0;
|
---|
1176 | meanSta(2) = 0.0;
|
---|
1177 | meanSta(3) = 0.0;
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | // Clock correction proportional to topocentric distance to satellites
|
---|
1181 | // -------------------------------------------------------------------
|
---|
1182 | double rho = (xyz - meanSta).NormFrobenius();
|
---|
1183 | dc = rho * (sc - 1.0) / sc / t_CST::c;
|
---|
1184 |
|
---|
1185 | Matrix rMat(3, 3);
|
---|
1186 | rMat(1, 1) = 1.0;
|
---|
1187 | rMat(1, 2) = -oz;
|
---|
1188 | rMat(1, 3) = oy;
|
---|
1189 | rMat(2, 1) = oz;
|
---|
1190 | rMat(2, 2) = 1.0;
|
---|
1191 | rMat(2, 3) = -ox;
|
---|
1192 | rMat(3, 1) = -oy;
|
---|
1193 | rMat(3, 2) = ox;
|
---|
1194 | rMat(3, 3) = 1.0;
|
---|
1195 |
|
---|
1196 | xyz = sc * rMat * xyz + dx;
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | // Transform Coordinates
|
---|
1200 | ////////////////////////////////////////////////////////////////////////////
|
---|
1201 | void bncRtnetUploadCaster::crdTrafo14(int GPSWeek, ColumnVector& xyz,
|
---|
1202 | double& dc) {
|
---|
1203 |
|
---|
1204 | // Current epoch minus 2000.0 in years
|
---|
1205 | // ------------------------------------
|
---|
1206 | double dt = (GPSWeek - (1042.0 + 6.0 / 7.0)) / 365.2422 * 7.0 + 2000.0 - _t0;
|
---|
1207 |
|
---|
1208 | ColumnVector dx(3);
|
---|
1209 |
|
---|
1210 | dx(1) = _dx14 + dt * _dxr14;
|
---|
1211 | dx(2) = _dy14 + dt * _dyr14;
|
---|
1212 | dx(3) = _dz14 + dt * _dzr14;
|
---|
1213 |
|
---|
1214 | static const double arcSec = 180.0 * 3600.0 / M_PI;
|
---|
1215 |
|
---|
1216 | double ox = (_ox14 + dt * _oxr14) / arcSec;
|
---|
1217 | double oy = (_oy14 + dt * _oyr14) / arcSec;
|
---|
1218 | double oz = (_oz14 + dt * _ozr14) / arcSec;
|
---|
1219 |
|
---|
1220 | double sc = 1.0 + _sc14 * 1e-9 + dt * _scr14 * 1e-9;
|
---|
1221 |
|
---|
1222 | // Specify approximate center of area
|
---|
1223 | // ----------------------------------
|
---|
1224 | ColumnVector meanSta(3);
|
---|
1225 | meanSta(1) = 0.0; // TODO
|
---|
1226 | meanSta(2) = 0.0; // TODO
|
---|
1227 | meanSta(3) = 0.0; // TODO
|
---|
1228 |
|
---|
1229 | // Clock correction proportional to topocentric distance to satellites
|
---|
1230 | // -------------------------------------------------------------------
|
---|
1231 | double rho = (xyz - meanSta).NormFrobenius();
|
---|
1232 | dc = rho * (sc - 1.0) / sc / t_CST::c;
|
---|
1233 |
|
---|
1234 | Matrix rMat(3, 3);
|
---|
1235 | rMat(1, 1) = 1.0;
|
---|
1236 | rMat(1, 2) = -oz;
|
---|
1237 | rMat(1, 3) = oy;
|
---|
1238 | rMat(2, 1) = oz;
|
---|
1239 | rMat(2, 2) = 1.0;
|
---|
1240 | rMat(2, 3) = -ox;
|
---|
1241 | rMat(3, 1) = -oy;
|
---|
1242 | rMat(3, 2) = ox;
|
---|
1243 | rMat(3, 3) = 1.0;
|
---|
1244 |
|
---|
1245 | xyz = sc * rMat * xyz + dx;
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | // Update Interval
|
---|
1249 | ////////////////////////////////////////////////////////////////////////////
|
---|
1250 | int bncRtnetUploadCaster::determineUpdateInd(double samplingRate) {
|
---|
1251 |
|
---|
1252 | if (samplingRate == 10.0) {
|
---|
1253 | return 3;
|
---|
1254 | }
|
---|
1255 | else if (samplingRate == 15.0) {
|
---|
1256 | return 4;
|
---|
1257 | }
|
---|
1258 | else if (samplingRate == 30.0) {
|
---|
1259 | return 5;
|
---|
1260 | }
|
---|
1261 | else if (samplingRate == 60.0) {
|
---|
1262 | return 6;
|
---|
1263 | }
|
---|
1264 | else if (samplingRate == 120.0) {
|
---|
1265 | return 7;
|
---|
1266 | }
|
---|
1267 | else if (samplingRate == 240.0) {
|
---|
1268 | return 8;
|
---|
1269 | }
|
---|
1270 | else if (samplingRate == 300.0) {
|
---|
1271 | return 9;
|
---|
1272 | }
|
---|
1273 | else if (samplingRate == 600.0) {
|
---|
1274 | return 10;
|
---|
1275 | }
|
---|
1276 | else if (samplingRate == 900.0) {
|
---|
1277 | return 11;
|
---|
1278 | }
|
---|
1279 | else if (samplingRate == 1800.0) {
|
---|
1280 | return 12;
|
---|
1281 | }
|
---|
1282 | else if (samplingRate == 3600.0) {
|
---|
1283 | return 13;
|
---|
1284 | }
|
---|
1285 | else if (samplingRate == 7200.0) {
|
---|
1286 | return 14;
|
---|
1287 | }
|
---|
1288 | else if (samplingRate == 10800.0) {
|
---|
1289 | return 15;
|
---|
1290 | }
|
---|
1291 | return 2; // default
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | // Check corrections
|
---|
1295 | ////////////////////////////////////////////////////////////////////////////
|
---|
1296 | bool bncRtnetUploadCaster::corrIsOutOfRange(struct SsrCorr::ClockOrbit::SatData* sd) {
|
---|
1297 |
|
---|
1298 | if (fabs(sd->Clock.DeltaA0) > 209.7151) {return true;}
|
---|
1299 | if (fabs(sd->Clock.DeltaA1) > 1.048575) {return true;}
|
---|
1300 | if (fabs(sd->Clock.DeltaA2) > 1.34217726) {return true;}
|
---|
1301 |
|
---|
1302 | if (fabs(sd->Orbit.DeltaRadial) > 209.7151) {return true;}
|
---|
1303 | if (fabs(sd->Orbit.DeltaAlongTrack) > 209.7148) {return true;}
|
---|
1304 | if (fabs(sd->Orbit.DeltaCrossTrack) > 209.7148) {return true;}
|
---|
1305 |
|
---|
1306 | if (fabs(sd->Orbit.DotDeltaRadial) > 1.048575) {return true;}
|
---|
1307 | if (fabs(sd->Orbit.DotDeltaAlongTrack) > 1.048572) {return true;}
|
---|
1308 | if (fabs(sd->Orbit.DotDeltaCrossTrack) > 1.048572) {return true;}
|
---|
1309 | return false;
|
---|
1310 | }
|
---|