source: ntrip/trunk/BNC/src/upload/bncrtnetuploadcaster.cpp@ 5132

Last change on this file since 5132 was 5132, checked in by mervart, 11 years ago
File size: 19.0 KB
RevLine 
[3222]1/* -------------------------------------------------------------------------
2 * BKG NTRIP Server
3 * -------------------------------------------------------------------------
4 *
[3224]5 * Class: bncRtnetUploadCaster
[3222]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>
[3224]18#include "bncrtnetuploadcaster.h"
[3222]19#include "bncsettings.h"
[3224]20#include "bncephuser.h"
[3222]21#include "bncclockrinex.h"
22#include "bncsp3.h"
23
24using namespace std;
25
26// Constructor
27////////////////////////////////////////////////////////////////////////////
[3224]28bncRtnetUploadCaster::bncRtnetUploadCaster(const QString& mountpoint,
[3222]29 const QString& outHost, int outPort,
30 const QString& password,
31 const QString& crdTrafo, bool CoM,
32 const QString& sp3FileName,
33 const QString& rnxFileName,
[4111]34 int PID, int SID, int IOD, int iRow) :
[3273]35 bncUploadCaster(mountpoint, outHost, outPort, password, iRow, 0) {
[3224]36
[5130]37 if (!outHost.isEmpty()) {
38 _casterID += outHost;
39 }
40 if (!crdTrafo.isEmpty()) {
41 _casterID += " " + crdTrafo;
42 }
43 if (!sp3FileName.isEmpty()) {
44 _casterID += " " + sp3FileName;
45 }
46 if (!rnxFileName.isEmpty()) {
47 _casterID += " " + rnxFileName;
48 }
49
[3222]50 _crdTrafo = crdTrafo;
51 _CoM = CoM;
[4111]52 _PID = PID;
53 _SID = SID;
54 _IOD = IOD;
[3222]55
[3224]56 // Member that receives the ephemeris
57 // ----------------------------------
58 _ephUser = new bncEphUser();
[3222]59
[3272]60 bncSettings settings;
61 QString intr = settings.value("uploadIntr").toString();
[4174]62
63 _samplRtcmEphCorr = settings.value("uploadSamplRtcmEphCorr").toDouble();
[4542]64 int samplClkRnx = settings.value("uploadSamplClkRnx").toInt();
65 int samplSp3 = settings.value("uploadSamplSp3").toInt() * 60;
[4174]66
67 if (_samplRtcmEphCorr == 0.0) {
[3753]68 _usedEph = 0;
69 }
70 else {
71 _usedEph = new QMap<QString, t_eph*>;
72 }
[3272]73
[3222]74 // RINEX writer
75 // ------------
76 if (!rnxFileName.isEmpty()) {
[4174]77 _rnx = new bncClockRinex(rnxFileName, intr, samplClkRnx);
[3222]78 }
79 else {
80 _rnx = 0;
81 }
82
83 // SP3 writer
84 // ----------
85 if (!sp3FileName.isEmpty()) {
[4174]86 _sp3 = new bncSP3(sp3FileName, intr, samplSp3);
[3222]87 }
88 else {
89 _sp3 = 0;
90 }
91
92 // Set Transformation Parameters
93 // -----------------------------
94 if (_crdTrafo == "ETRF2000") {
[3890]95 _dx = 0.0521;
96 _dy = 0.0493;
97 _dz = -0.0585;
98 _dxr = 0.0001;
[3222]99 _dyr = 0.0001;
100 _dzr = -0.0018;
101 _ox = 0.000891;
102 _oy = 0.005390;
103 _oz = -0.008712;
104 _oxr = 0.000081;
105 _oyr = 0.000490;
106 _ozr = -0.000792;
[3890]107 _sc = 1.34;
[3222]108 _scr = 0.08;
109 _t0 = 2000.0;
110 }
111 else if (_crdTrafo == "NAD83") {
112 _dx = 0.9963;
113 _dy = -1.9024;
114 _dz = -0.5210;
115 _dxr = 0.0005;
116 _dyr = -0.0006;
117 _dzr = -0.0013;
[3498]118 _ox = -0.025915;
119 _oy = -0.009426;
120 _oz = -0.011599;
121 _oxr = -0.000067;
122 _oyr = 0.000757;
123 _ozr = 0.000051;
[3222]124 _sc = 0.78;
125 _scr = -0.10;
126 _t0 = 1997.0;
127 }
128 else if (_crdTrafo == "GDA94") {
[4963]129 _dx = -0.08468;
130 _dy = -0.01942;
131 _dz = 0.03201;
132 _dxr = 0.00142;
133 _dyr = 0.00134;
134 _dzr = 0.00090;
135 _ox = 0.0004254;
136 _oy = -0.0022578;
137 _oz = -0.0024015;
138 _oxr = -0.0015461;
139 _oyr = -0.0011820;
140 _ozr = -0.0011551;
141 _sc = 9.710;
142 _scr = 0.109;
[3222]143 _t0 = 1994.0;
144 }
145 else if (_crdTrafo == "SIRGAS2000") {
[4956]146 _dx = 0.0020;
147 _dy = 0.0041;
148 _dz = 0.0039;
[3222]149 _dxr = 0.0000;
150 _dyr = 0.0000;
151 _dzr = 0.0000;
[4956]152 _ox = 0.000170;
153 _oy = -0.000030;
154 _oz = 0.000070;
[3222]155 _oxr = 0.000000;
156 _oyr = 0.000000;
157 _ozr = 0.000000;
158 _sc = 0.000;
159 _scr = 0.000;
160 _t0 = 0000.0;
161 }
162 else if (_crdTrafo == "SIRGAS95") {
163 _dx = 0.0077;
164 _dy = 0.0058;
165 _dz = -0.0138;
166 _dxr = 0.0000;
167 _dyr = 0.0000;
168 _dzr = 0.0000;
169 _ox = 0.000000;
170 _oy = 0.000000;
171 _oz = -0.000030;
172 _oxr = 0.000000;
173 _oyr = 0.000000;
174 _ozr = 0.000000;
175 _sc = 1.570;
176 _scr = 0.000;
177 _t0 = 0000.0;
178 }
179 else if (_crdTrafo == "Custom") {
180 _dx = settings.value("trafo_dx").toDouble();
181 _dy = settings.value("trafo_dy").toDouble();
182 _dz = settings.value("trafo_dz").toDouble();
183 _dxr = settings.value("trafo_dxr").toDouble();
184 _dyr = settings.value("trafo_dyr").toDouble();
185 _dzr = settings.value("trafo_dzr").toDouble();
186 _ox = settings.value("trafo_ox").toDouble();
187 _oy = settings.value("trafo_oy").toDouble();
188 _oz = settings.value("trafo_oz").toDouble();
189 _oxr = settings.value("trafo_oxr").toDouble();
190 _oyr = settings.value("trafo_oyr").toDouble();
191 _ozr = settings.value("trafo_ozr").toDouble();
192 _sc = settings.value("trafo_sc").toDouble();
193 _scr = settings.value("trafo_scr").toDouble();
194 _t0 = settings.value("trafo_t0").toDouble();
195 }
196}
197
198// Destructor
199////////////////////////////////////////////////////////////////////////////
[3224]200bncRtnetUploadCaster::~bncRtnetUploadCaster() {
[3222]201 if (isRunning()) {
202 wait();
203 }
204 delete _rnx;
205 delete _sp3;
206 delete _ephUser;
[3753]207 delete _usedEph;
[3222]208}
209
210//
211////////////////////////////////////////////////////////////////////////////
[3224]212void bncRtnetUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
[3222]213
214 QMutexLocker locker(&_mutex);
215
[3230]216 // Append to internal buffer
217 // -------------------------
[3222]218 _rtnetStreamBuffer.append(QByteArray(buffer, bufLen));
[3230]219
220 // Select buffer part that contains last epoch
221 // -------------------------------------------
222 QStringList lines;
223 int iEpoBeg = _rtnetStreamBuffer.lastIndexOf('*'); // begin of last epoch
224 if (iEpoBeg == -1) {
[3226]225 _rtnetStreamBuffer.clear();
226 return;
[3222]227 }
[3230]228 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoBeg);
229
230 int iEpoEnd = _rtnetStreamBuffer.lastIndexOf("EOE"); // end of last epoch
231 if (iEpoEnd == -1) {
232 return;
233 }
[3226]234 else {
[3230]235 lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
236 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd+3);
[3226]237 }
[3222]238
[3226]239 if (lines.size() < 2) {
[3222]240 return;
241 }
242
[3226]243 // Keep the last unfinished line in buffer
244 // ---------------------------------------
245 int iLastEOL = _rtnetStreamBuffer.lastIndexOf('\n');
246 if (iLastEOL != -1) {
247 _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iLastEOL+1);
248 }
249
250 // Read first line (with epoch time)
251 // ---------------------------------
252 QTextStream in(lines[0].toAscii());
253 QString hlp;
254 int year, month, day, hour, min;
255 double sec;
256 in >> hlp >> year >> month >> day >> hour >> min >> sec;
257 bncTime epoTime; epoTime.set( year, month, day, hour, min, sec);
258
[5131]259 emit(newMessage("bncRtnetUploadCaster: decode " +
260 QByteArray(epoTime.datestr().c_str()) + " " +
[5132]261 QByteArray(epoTime.timestr().c_str()) + " " +
262 _casterID.toAscii(), false));
[4808]263
[3222]264 struct ClockOrbit co;
265 memset(&co, 0, sizeof(co));
[3226]266 co.GPSEpochTime = static_cast<int>(epoTime.gpssec());
267 co.GLONASSEpochTime = static_cast<int>(fmod(epoTime.gpssec(), 86400.0))
[3222]268 + 3 * 3600 - gnumleap(year, month, day);
269 co.ClockDataSupplied = 1;
270 co.OrbitDataSupplied = 1;
271 co.SatRefDatum = DATUM_ITRF;
[4111]272 co.SSRIOD = _IOD;
273 co.SSRProviderID = _PID; // 256 .. BKG, 257 ... EUREF
274 co.SSRSolutionID = _SID;
[3222]275
276 struct Bias bias;
277 memset(&bias, 0, sizeof(bias));
[3226]278 bias.GPSEpochTime = co.GPSEpochTime;
279 bias.GLONASSEpochTime = co.GLONASSEpochTime;
[3222]280
[4753]281 // Default Update Interval
282 // -----------------------
[4754]283 int clkUpdInd = 2; // 5 sec
284 int ephUpdInd = clkUpdInd; // default
285 if (_samplRtcmEphCorr == 10.0) {
286 ephUpdInd = 3;
287 }
288 else if (_samplRtcmEphCorr == 15.0) {
289 ephUpdInd = 4;
290 }
291 else if (_samplRtcmEphCorr == 30.0) {
292 ephUpdInd = 5;
293 }
294 else if (_samplRtcmEphCorr == 60.0) {
295 ephUpdInd = 6;
296 }
297 else if (_samplRtcmEphCorr == 120.0) {
298 ephUpdInd = 7;
299 }
300 else if (_samplRtcmEphCorr == 240.0) {
301 ephUpdInd = 8;
302 }
303 else if (_samplRtcmEphCorr == 300.0) {
304 ephUpdInd = 9;
305 }
306 else if (_samplRtcmEphCorr == 600.0) {
307 ephUpdInd = 10;
308 }
309 else if (_samplRtcmEphCorr == 900.0) {
310 ephUpdInd = 11;
311 }
[4753]312
[4754]313 co.UpdateInterval = clkUpdInd;
314 bias.UpdateInterval = clkUpdInd;
[4753]315
[3226]316 for (int ii = 1; ii < lines.size(); ii++) {
317
[3222]318 QString prn;
[4991]319 ColumnVector rtnAPC;
320 ColumnVector rtnVel;
321 ColumnVector rtnCoM;
322 double rtnClk;
[3222]323
324 QTextStream in(lines[ii].toAscii());
325
326 in >> prn;
327
[3753]328 t_eph* eph = 0;
[3222]329 const bncEphUser::t_ephPair* ephPair = _ephUser->ephPair(prn);
330 if (ephPair) {
331
[3754]332 eph = ephPair->last;
333
[4098]334 // Use previous ephemeris if the last one is too recent
335 // ----------------------------------------------------
336 const int MINAGE = 60; // seconds
337 if (ephPair->prev && eph->receptDateTime().isValid() &&
338 eph->receptDateTime().secsTo(currentDateAndTimeGPS()) < MINAGE) {
339 eph = ephPair->prev;
340 }
[3754]341
[3753]342 // Make sure the clock messages refer to same IOD as orbit messages
343 // ----------------------------------------------------------------
344 if (_usedEph) {
[4174]345 if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
[3753]346 (*_usedEph)[prn] = eph;
347 }
348 else {
349 eph = 0;
350 if (_usedEph->contains(prn)) {
351 t_eph* usedEph = _usedEph->value(prn);
352 if (usedEph == ephPair->last) {
353 eph = ephPair->last;
354 }
355 else if (usedEph == ephPair->prev) {
356 eph = ephPair->prev;
357 }
358 }
359 }
360 }
361 }
362
363 if (eph) {
364
[4991]365 while (true) {
366 QString key;
367 int numVal = 0;
368 in >> key >> numVal;
369 if (in.status() != QTextStream::Ok) {
370 break;
371 }
372 if (key == "APC") {
373 rtnAPC.ReSize(3);
374 in >> rtnAPC[0] >> rtnAPC[1] >> rtnAPC[2];
375 }
376 else if (key == "Clk") {
377 in >> rtnClk;
378 }
379 else if (key == "Vel") {
380 rtnVel.ReSize(3);
381 in >> rtnVel[0] >> rtnVel[1] >> rtnVel[2];
382 }
383 else if (key == "CoM") {
384 rtnCoM.ReSize(3);
385 in >> rtnCoM[0] >> rtnCoM[1] >> rtnCoM[2];
386 }
387 else {
388 for (int ii = 0; ii < numVal; ii++) {
389 double dummy;
390 in >> dummy;
391 }
392 }
393 }
[3222]394 struct ClockOrbit::SatData* sd = 0;
395 if (prn[0] == 'G') {
396 sd = co.Sat + co.NumberOfGPSSat;
397 ++co.NumberOfGPSSat;
398 }
399 else if (prn[0] == 'R') {
400 sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
401 ++co.NumberOfGLONASSSat;
402 }
403 if (sd) {
404 QString outLine;
[3226]405 processSatellite(eph, epoTime.gpsw(), epoTime.gpssec(), prn,
[4991]406 rtnAPC, rtnClk, rtnVel, rtnCoM, sd, outLine);
[3222]407 }
408
409 struct Bias::BiasSat* biasSat = 0;
410 if (prn[0] == 'G') {
411 biasSat = bias.Sat + bias.NumberOfGPSSat;
412 ++bias.NumberOfGPSSat;
413 }
414 else if (prn[0] == 'R') {
415 biasSat = bias.Sat + CLOCKORBIT_NUMGPS + bias.NumberOfGLONASSSat;
416 ++bias.NumberOfGLONASSSat;
417 }
418
419 // Coefficient of Ionosphere-Free LC
420 // ---------------------------------
[4991]421 // const static double a_L1_GPS = 2.54572778;
422 // const static double a_L2_GPS = -1.54572778;
423 // const static double a_L1_Glo = 2.53125000;
424 // const static double a_L2_Glo = -1.53125000;
[3222]425
426 if (biasSat) {
427 biasSat->ID = prn.mid(1).toInt();
428 biasSat->NumberOfCodeBiases = 3;
429 if (prn[0] == 'G') {
430 biasSat->Biases[0].Type = CODETYPEGPS_L1_Z;
[4991]431 // biasSat->Biases[0].Bias = - a_L2_GPS * xx(10);
432 biasSat->Biases[0].Bias = 0.0;
[3222]433 biasSat->Biases[1].Type = CODETYPEGPS_L1_CA;
[4991]434 // biasSat->Biases[1].Bias = - a_L2_GPS * xx(10) + xx(9);
435 biasSat->Biases[1].Bias = 0.0;
[3222]436 biasSat->Biases[2].Type = CODETYPEGPS_L2_Z;
[4991]437 // biasSat->Biases[2].Bias = a_L1_GPS * xx(10);
438 biasSat->Biases[2].Bias = 0.0;
[3222]439 }
440 else if (prn[0] == 'R') {
441 biasSat->Biases[0].Type = CODETYPEGLONASS_L1_P;
[4991]442 // biasSat->Biases[0].Bias = - a_L2_Glo * xx(10);
443 biasSat->Biases[0].Bias = 0.0;
[3222]444 biasSat->Biases[1].Type = CODETYPEGLONASS_L1_CA;
[4991]445 // biasSat->Biases[1].Bias = - a_L2_Glo * xx(10) + xx(9);
446 biasSat->Biases[1].Bias = 0.0;
[3222]447 biasSat->Biases[2].Type = CODETYPEGLONASS_L2_P;
[4991]448 // biasSat->Biases[2].Bias = a_L1_Glo * xx(10);
449 biasSat->Biases[2].Bias = 0.0;
[3222]450 }
451 }
452 }
453 }
[3227]454
455 QByteArray hlpBufferCo;
[3493]456
457 // Orbit and Clock Corrections together
458 // ------------------------------------
[4174]459 if (_samplRtcmEphCorr == 0.0) {
[3493]460 if (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) {
461 char obuffer[CLOCKORBIT_BUFFERSIZE];
462 int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
463 if (len > 0) {
464 hlpBufferCo = QByteArray(obuffer, len);
465 }
[3222]466 }
467 }
[3493]468
469 // Orbit and Clock Corrections separately
470 // --------------------------------------
471 else {
472 if (co.NumberOfGPSSat > 0) {
473 char obuffer[CLOCKORBIT_BUFFERSIZE];
[4174]474 if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
[4754]475 co.UpdateInterval = ephUpdInd;
[3591]476 int len1 = MakeClockOrbit(&co, COTYPE_GPSORBIT, 1, obuffer, sizeof(obuffer));
[4754]477 co.UpdateInterval = clkUpdInd;
[3493]478 if (len1 > 0) {
479 hlpBufferCo += QByteArray(obuffer, len1);
480 }
481 }
[3591]482 int mmsg = (co.NumberOfGLONASSSat > 0) ? 1 : 0;
483 int len2 = MakeClockOrbit(&co, COTYPE_GPSCLOCK, mmsg, obuffer, sizeof(obuffer));
[3493]484 if (len2 > 0) {
485 hlpBufferCo += QByteArray(obuffer, len2);
486 }
487 }
488 if (co.NumberOfGLONASSSat > 0) {
489 char obuffer[CLOCKORBIT_BUFFERSIZE];
[4174]490 if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
[4754]491 co.UpdateInterval = ephUpdInd;
[3591]492 int len1 = MakeClockOrbit(&co, COTYPE_GLONASSORBIT, 1, obuffer, sizeof(obuffer));
[4754]493 co.UpdateInterval = clkUpdInd;
[3493]494 if (len1 > 0) {
495 hlpBufferCo += QByteArray(obuffer, len1);
496 }
497 }
498 int len2 = MakeClockOrbit(&co, COTYPE_GLONASSCLOCK, 0, obuffer, sizeof(obuffer));
499 if (len2 > 0) {
500 hlpBufferCo += QByteArray(obuffer, len2);
501 }
502 }
503 }
[3222]504
[3493]505 // Biases
506 // ------
[3227]507 QByteArray hlpBufferBias;
[3222]508 if (bias.NumberOfGPSSat > 0 || bias.NumberOfGLONASSSat > 0) {
509 char obuffer[CLOCKORBIT_BUFFERSIZE];
510 int len = MakeBias(&bias, BTYPE_AUTO, 0, obuffer, sizeof(obuffer));
511 if (len > 0) {
[3227]512 hlpBufferBias = QByteArray(obuffer, len);
[3222]513 }
514 }
[3227]515
[4808]516 _outBuffer += hlpBufferCo + hlpBufferBias;
[3222]517}
518
519//
520////////////////////////////////////////////////////////////////////////////
[3224]521void bncRtnetUploadCaster::processSatellite(t_eph* eph, int GPSweek,
[4991]522 double GPSweeks, const QString& prn,
523 const ColumnVector& rtnAPC,
524 double rtnClk,
525 const ColumnVector& rtnVel,
526 const ColumnVector& rtnCoM,
527 struct ClockOrbit::SatData* sd,
528 QString& outLine) {
[3222]529
[4930]530 // Broadcast Position and Velocity
531 // -------------------------------
532 ColumnVector xB(4);
533 ColumnVector vB(3);
534 eph->position(GPSweek, GPSweeks, xB.data(), vB.data());
535
[4991]536 // Precise Position
537 // ----------------
538 ColumnVector xP = _CoM ? rtnCoM : rtnAPC;
[3222]539
[4930]540 double dc = 0.0;
541 if (_crdTrafo != "IGS08") {
542 crdTrafo(GPSweek, xP, dc);
543 }
544
545 // Difference in xyz
546 // -----------------
547 ColumnVector dx = xB.Rows(1,3) - xP;
[4991]548 ColumnVector dv = vB - rtnVel;
[4930]549
550 // Difference in RSW
551 // -----------------
[3222]552 ColumnVector rsw(3);
[4930]553 XYZ_to_RSW(xB.Rows(1,3), vB, dx, rsw);
[3222]554
[4930]555 ColumnVector dotRsw(3);
556 XYZ_to_RSW(xB.Rows(1,3), vB, dv, dotRsw);
[3222]557
[4930]558 // Clock Correction
559 // ----------------
[4991]560 double dClk = rtnClk - (xB(4) - dc) * t_CST::c;
[3222]561
562 if (sd) {
[4930]563 sd->ID = prn.mid(1).toInt();
564 sd->IOD = eph->IOD();
565 sd->Clock.DeltaA0 = dClk;
566 sd->Orbit.DeltaRadial = rsw(1);
567 sd->Orbit.DeltaAlongTrack = rsw(2);
568 sd->Orbit.DeltaCrossTrack = rsw(3);
569 sd->Orbit.DotDeltaRadial = dotRsw(1);
570 sd->Orbit.DotDeltaAlongTrack = dotRsw(2);
571 sd->Orbit.DotDeltaCrossTrack = dotRsw(3);
[3222]572 }
573
574 outLine.sprintf("%d %.1f %s %3d %10.3f %8.3f %8.3f %8.3f\n",
[3255]575 GPSweek, GPSweeks, eph->prn().toAscii().data(),
[3222]576 eph->IOD(), dClk, rsw(1), rsw(2), rsw(3));
577
[4991]578 double relativity = -2.0 * DotProduct(xP, rtnVel) / t_CST::c;
579 double sp3Clk = (rtnClk - relativity) / t_CST::c; // in seconds
580
[3222]581 if (_rnx) {
[4991]582 _rnx->write(GPSweek, GPSweeks, prn, sp3Clk);
[3222]583 }
584 if (_sp3) {
[4991]585 _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, sp3Clk);
[3222]586 }
587}
588
589// Transform Coordinates
590////////////////////////////////////////////////////////////////////////////
[4803]591void bncRtnetUploadCaster::crdTrafo(int GPSWeek, ColumnVector& xyz,
592 double& dc) {
[3222]593
594 // Current epoch minus 2000.0 in years
595 // ------------------------------------
596 double dt = (GPSWeek - (1042.0+6.0/7.0)) / 365.2422 * 7.0 + 2000.0 - _t0;
597
598 ColumnVector dx(3);
599
600 dx(1) = _dx + dt * _dxr;
601 dx(2) = _dy + dt * _dyr;
602 dx(3) = _dz + dt * _dzr;
603
604 static const double arcSec = 180.0 * 3600.0 / M_PI;
605
606 double ox = (_ox + dt * _oxr) / arcSec;
607 double oy = (_oy + dt * _oyr) / arcSec;
608 double oz = (_oz + dt * _ozr) / arcSec;
609
610 double sc = 1.0 + _sc * 1e-9 + dt * _scr * 1e-9;
611
[4912]612 // Specify approximate center of area
613 // ----------------------------------
614 ColumnVector meanSta(3);
615
616 if (_crdTrafo == "ETRF2000") {
[4973]617 meanSta(1) = 3661090.0;
618 meanSta(2) = 845230.0;
619 meanSta(3) = 5136850.0;
[4908]620 }
[4912]621 else if (_crdTrafo == "NAD83") {
[4973]622 meanSta(1) = -1092950.0;
623 meanSta(2) = -4383600.0;
624 meanSta(3) = 4487420.0;
[4912]625 }
626 else if (_crdTrafo == "GDA94") {
[4973]627 meanSta(1) = -4052050.0;
628 meanSta(2) = 4212840.0;
629 meanSta(3) = -2545110.0;
[4912]630 }
631 else if (_crdTrafo == "SIRGAS2000") {
[4973]632 meanSta(1) = 3740860.0;
633 meanSta(2) = -4964290.0;
634 meanSta(3) = -1425420.0;
[4912]635 }
636 else if (_crdTrafo == "SIRGAS95") {
[4973]637 meanSta(1) = 3135390.0;
638 meanSta(2) = -5017670.0;
639 meanSta(3) = -2374440.0;
[4912]640 }
641 else if (_crdTrafo == "Custom") {
642 meanSta(1) = 0.0; // TODO
643 meanSta(2) = 0.0; // TODO
644 meanSta(3) = 0.0; // TODO
645 }
[4908]646
[4912]647 // Clock correction proportional to topocentric distance to satellites
648 // -------------------------------------------------------------------
649 double rho = (xyz - meanSta).norm_Frobenius();
[4913]650 dc = rho * (sc - 1.0) / sc / t_CST::c;
[4908]651
[3222]652 Matrix rMat(3,3);
653 rMat(1,1) = 1.0;
654 rMat(1,2) = -oz;
655 rMat(1,3) = oy;
656 rMat(2,1) = oz;
657 rMat(2,2) = 1.0;
658 rMat(2,3) = -ox;
659 rMat(3,1) = -oy;
660 rMat(3,2) = ox;
661 rMat(3,3) = 1.0;
662
663 xyz = sc * rMat * xyz + dx;
664}
665
Note: See TracBrowser for help on using the repository browser.