[756] | 1 | /* -------------------------------------------------------------------------
|
---|
| 2 | * BKG NTRIP Server
|
---|
| 3 | * -------------------------------------------------------------------------
|
---|
| 4 | *
|
---|
| 5 | * Class: bns
|
---|
| 6 | *
|
---|
| 7 | * Purpose: This class implements the main application behaviour
|
---|
| 8 | *
|
---|
| 9 | * Author: L. Mervart
|
---|
| 10 | *
|
---|
| 11 | * Created: 29-Mar-2008
|
---|
| 12 | *
|
---|
| 13 | * Changes:
|
---|
| 14 | *
|
---|
| 15 | * -----------------------------------------------------------------------*/
|
---|
| 16 |
|
---|
[858] | 17 | #include <math.h>
|
---|
[756] | 18 | #include <iostream>
|
---|
[800] | 19 | #include <newmatio.h>
|
---|
[756] | 20 |
|
---|
| 21 | #include "bns.h"
|
---|
[799] | 22 | #include "bnsutils.h"
|
---|
[847] | 23 | #include "bnsrinex.h"
|
---|
[848] | 24 | #include "bnssp3.h"
|
---|
[756] | 25 |
|
---|
| 26 | using namespace std;
|
---|
| 27 |
|
---|
| 28 | // Constructor
|
---|
| 29 | ////////////////////////////////////////////////////////////////////////////
|
---|
[757] | 30 | t_bns::t_bns(QObject* parent) : QThread(parent) {
|
---|
[760] | 31 |
|
---|
[764] | 32 | this->setTerminationEnabled(true);
|
---|
[828] | 33 |
|
---|
[836] | 34 | connect(this, SIGNAL(moveSocket(QThread*)),
|
---|
| 35 | this, SLOT(slotMoveSocket(QThread*)));
|
---|
| 36 |
|
---|
[979] | 37 | QSettings settings;
|
---|
| 38 |
|
---|
| 39 | // Set Proxy (application-wide)
|
---|
| 40 | // ----------------------------
|
---|
| 41 | QString proxyHost = settings.value("proxyHost").toString();
|
---|
| 42 | int proxyPort = settings.value("proxyPort").toInt();
|
---|
[980] | 43 |
|
---|
| 44 | QNetworkProxy proxy;
|
---|
| 45 | if (proxyHost.isEmpty()) {
|
---|
| 46 | proxy.setType(QNetworkProxy::NoProxy);
|
---|
| 47 | }
|
---|
| 48 | else {
|
---|
[979] | 49 | proxy.setType(QNetworkProxy::Socks5Proxy);
|
---|
| 50 | proxy.setHostName(proxyHost);
|
---|
| 51 | proxy.setPort(proxyPort);
|
---|
| 52 | }
|
---|
[980] | 53 | QNetworkProxy::setApplicationProxy(proxy);
|
---|
[979] | 54 |
|
---|
[828] | 55 | // Thread that handles broadcast ephemeris
|
---|
| 56 | // ---------------------------------------
|
---|
| 57 | _bnseph = new t_bnseph(parent);
|
---|
[827] | 58 |
|
---|
[1059] | 59 | connect(_bnseph, SIGNAL(newEph(t_eph*, int)),
|
---|
[1058] | 60 | this, SLOT(slotNewEph(t_eph*, int)));
|
---|
[828] | 61 | connect(_bnseph, SIGNAL(newMessage(QByteArray)),
|
---|
| 62 | this, SLOT(slotMessage(const QByteArray)));
|
---|
| 63 | connect(_bnseph, SIGNAL(error(QByteArray)),
|
---|
| 64 | this, SLOT(slotError(const QByteArray)));
|
---|
[760] | 65 |
|
---|
[827] | 66 | // Server listening for rtnet results
|
---|
| 67 | // ----------------------------------
|
---|
[828] | 68 | _clkSocket = 0;
|
---|
[827] | 69 | _clkServer = new QTcpServer;
|
---|
| 70 | _clkServer->listen(QHostAddress::Any, settings.value("clkPort").toInt());
|
---|
[828] | 71 | connect(_clkServer, SIGNAL(newConnection()),this, SLOT(slotNewConnection()));
|
---|
[827] | 72 |
|
---|
[828] | 73 | // Socket and file for outputting the results
|
---|
| 74 | // -------------------------------------------
|
---|
[1067] | 75 | for (int ic = 1; ic <= 2; ic++) {
|
---|
[827] | 76 |
|
---|
[1069] | 77 | QString mountpoint = settings.value(QString("mountpoint_%1").arg(ic)).toString();
|
---|
[1068] | 78 | if (!mountpoint.isEmpty()) {
|
---|
[1069] | 79 | QString outFileName = settings.value(QString("outFile_%1").arg(ic)).toString();
|
---|
| 80 | QString refSys = settings.value(QString("refSys_%1").arg(ic)).toString();
|
---|
[1067] | 81 |
|
---|
[1068] | 82 | _caster.push_back(new t_bnscaster(mountpoint, outFileName, refSys));
|
---|
| 83 | connect(_caster.back(), SIGNAL(error(const QByteArray)),
|
---|
| 84 | this, SLOT(slotError(const QByteArray)));
|
---|
| 85 | connect(_caster.back(), SIGNAL(newMessage(const QByteArray)),
|
---|
| 86 | this, SLOT(slotMessage(const QByteArray)));
|
---|
| 87 | }
|
---|
[1067] | 88 | }
|
---|
| 89 |
|
---|
[1065] | 90 | // Log File
|
---|
| 91 | // --------
|
---|
[983] | 92 | QIODevice::OpenMode oMode;
|
---|
| 93 | if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) {
|
---|
| 94 | oMode = QIODevice::WriteOnly | QIODevice::Unbuffered | QIODevice::Append;
|
---|
| 95 | }
|
---|
| 96 | else {
|
---|
| 97 | oMode = QIODevice::WriteOnly | QIODevice::Unbuffered;
|
---|
| 98 | }
|
---|
| 99 |
|
---|
[816] | 100 | QString logFileName = settings.value("logFile").toString();
|
---|
| 101 | if (logFileName.isEmpty()) {
|
---|
[947] | 102 | _logFile = 0;
|
---|
| 103 | _logStream = 0;
|
---|
[812] | 104 | }
|
---|
[816] | 105 | else {
|
---|
| 106 | _logFile = new QFile(logFileName);
|
---|
[983] | 107 | if (_logFile->open(oMode)) {
|
---|
[816] | 108 | _logStream = new QTextStream(_logFile);
|
---|
| 109 | }
|
---|
[948] | 110 | else {
|
---|
| 111 | _logStream = 0;
|
---|
| 112 | }
|
---|
[816] | 113 | }
|
---|
[847] | 114 |
|
---|
[1072] | 115 | // Echo input from RTNet into a file
|
---|
| 116 | // ---------------------------------
|
---|
| 117 | QString echoFileName = settings.value("inpEcho").toString();
|
---|
| 118 | if (echoFileName.isEmpty()) {
|
---|
| 119 | _echoFile = 0;
|
---|
| 120 | _echoStream = 0;
|
---|
| 121 | }
|
---|
| 122 | else {
|
---|
| 123 | _echoFile = new QFile(echoFileName);
|
---|
| 124 | if (_echoFile->open(oMode)) {
|
---|
| 125 | _echoStream = new QTextStream(_echoFile);
|
---|
| 126 | }
|
---|
| 127 | else {
|
---|
| 128 | _echoStream = 0;
|
---|
| 129 | }
|
---|
| 130 | }
|
---|
| 131 |
|
---|
[847] | 132 | // RINEX writer
|
---|
| 133 | // ------------
|
---|
| 134 | if ( settings.value("rnxPath").toString().isEmpty() ) {
|
---|
| 135 | _rnx = 0;
|
---|
| 136 | }
|
---|
| 137 | else {
|
---|
[850] | 138 | QString prep = "BNS";
|
---|
[857] | 139 | QString ext = ".clk";
|
---|
[850] | 140 | QString path = settings.value("rnxPath").toString();
|
---|
| 141 | QString intr = settings.value("rnxIntr").toString();
|
---|
| 142 | int sampl = settings.value("rnxSampl").toInt();
|
---|
| 143 | _rnx = new bnsRinex(prep, ext, path, intr, sampl);
|
---|
[847] | 144 | }
|
---|
[848] | 145 |
|
---|
| 146 | // SP3 writer
|
---|
| 147 | // ----------
|
---|
| 148 | if ( settings.value("sp3Path").toString().isEmpty() ) {
|
---|
| 149 | _sp3 = 0;
|
---|
| 150 | }
|
---|
| 151 | else {
|
---|
[850] | 152 | QString prep = "BNS";
|
---|
[857] | 153 | QString ext = ".sp3";
|
---|
[850] | 154 | QString path = settings.value("sp3Path").toString();
|
---|
| 155 | QString intr = settings.value("sp3Intr").toString();
|
---|
| 156 | int sampl = settings.value("sp3Sampl").toInt();
|
---|
| 157 | _sp3 = new bnsSP3(prep, ext, path, intr, sampl);
|
---|
[848] | 158 | }
|
---|
[756] | 159 | }
|
---|
| 160 |
|
---|
| 161 | // Destructor
|
---|
| 162 | ////////////////////////////////////////////////////////////////////////////
|
---|
[757] | 163 | t_bns::~t_bns() {
|
---|
[763] | 164 | deleteBnsEph();
|
---|
[769] | 165 | delete _clkServer;
|
---|
[837] | 166 | delete _clkSocket;
|
---|
[1066] | 167 | for (int ic = 0; ic < _caster.size(); ic++) {
|
---|
| 168 | delete _caster.at(ic);
|
---|
| 169 | }
|
---|
[816] | 170 | delete _logStream;
|
---|
[812] | 171 | delete _logFile;
|
---|
[1072] | 172 | delete _echoStream;
|
---|
| 173 | delete _echoFile;
|
---|
[779] | 174 | QMapIterator<QString, t_ephPair*> it(_ephList);
|
---|
| 175 | while (it.hasNext()) {
|
---|
| 176 | it.next();
|
---|
| 177 | delete it.value();
|
---|
| 178 | }
|
---|
[849] | 179 | delete _rnx;
|
---|
| 180 | delete _sp3;
|
---|
[756] | 181 | }
|
---|
| 182 |
|
---|
[763] | 183 | // Delete bns thread
|
---|
| 184 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 185 | void t_bns::deleteBnsEph() {
|
---|
| 186 | if (_bnseph) {
|
---|
| 187 | _bnseph->terminate();
|
---|
[764] | 188 | _bnseph->wait(100);
|
---|
[763] | 189 | delete _bnseph;
|
---|
| 190 | _bnseph = 0;
|
---|
| 191 | }
|
---|
| 192 | }
|
---|
| 193 |
|
---|
[756] | 194 | // Write a Program Message
|
---|
| 195 | ////////////////////////////////////////////////////////////////////////////
|
---|
[758] | 196 | void t_bns::slotMessage(const QByteArray msg) {
|
---|
[816] | 197 | if (_logStream) {
|
---|
| 198 | *_logStream << msg << endl;
|
---|
[818] | 199 | _logStream->flush();
|
---|
[812] | 200 | }
|
---|
[757] | 201 | emit(newMessage(msg));
|
---|
[756] | 202 | }
|
---|
| 203 |
|
---|
[760] | 204 | // Write a Program Message
|
---|
| 205 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 206 | void t_bns::slotError(const QByteArray msg) {
|
---|
[816] | 207 | if (_logStream) {
|
---|
| 208 | *_logStream << msg << endl;
|
---|
[818] | 209 | _logStream->flush();
|
---|
[812] | 210 | }
|
---|
[763] | 211 | deleteBnsEph();
|
---|
[760] | 212 | emit(error(msg));
|
---|
| 213 | }
|
---|
| 214 |
|
---|
[769] | 215 | // New Connection
|
---|
| 216 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 217 | void t_bns::slotNewConnection() {
|
---|
[786] | 218 | slotMessage("t_bns::slotNewConnection");
|
---|
[787] | 219 | delete _clkSocket;
|
---|
[769] | 220 | _clkSocket = _clkServer->nextPendingConnection();
|
---|
| 221 | }
|
---|
| 222 |
|
---|
[784] | 223 | //
|
---|
| 224 | ////////////////////////////////////////////////////////////////////////////
|
---|
[1058] | 225 | void t_bns::slotNewEph(t_eph* ep, int nBytes) {
|
---|
[784] | 226 |
|
---|
| 227 | QMutexLocker locker(&_mutex);
|
---|
| 228 |
|
---|
[1058] | 229 | emit(newEphBytes(nBytes));
|
---|
| 230 |
|
---|
[784] | 231 | t_ephPair* pair;
|
---|
[884] | 232 | if ( !_ephList.contains(ep->prn()) ) {
|
---|
[784] | 233 | pair = new t_ephPair();
|
---|
[884] | 234 | _ephList.insert(ep->prn(), pair);
|
---|
[784] | 235 | }
|
---|
| 236 | else {
|
---|
[884] | 237 | pair = _ephList[ep->prn()];
|
---|
[784] | 238 | }
|
---|
| 239 |
|
---|
| 240 | if (pair->eph == 0) {
|
---|
| 241 | pair->eph = ep;
|
---|
| 242 | }
|
---|
| 243 | else {
|
---|
[884] | 244 | if (ep->isNewerThan(pair->eph)) {
|
---|
[784] | 245 | delete pair->oldEph;
|
---|
| 246 | pair->oldEph = pair->eph;
|
---|
| 247 | pair->eph = ep;
|
---|
| 248 | }
|
---|
| 249 | else {
|
---|
| 250 | delete ep;
|
---|
| 251 | }
|
---|
| 252 | }
|
---|
| 253 | }
|
---|
| 254 |
|
---|
[756] | 255 | // Start
|
---|
| 256 | ////////////////////////////////////////////////////////////////////////////
|
---|
[757] | 257 | void t_bns::run() {
|
---|
[769] | 258 |
|
---|
[758] | 259 | slotMessage("============ Start BNS ============");
|
---|
[770] | 260 |
|
---|
[828] | 261 | // Start Thread that retrieves broadcast Ephemeris
|
---|
| 262 | // -----------------------------------------------
|
---|
[758] | 263 | _bnseph->start();
|
---|
[769] | 264 |
|
---|
[770] | 265 | // Endless loop
|
---|
| 266 | // ------------
|
---|
[769] | 267 | while (true) {
|
---|
[836] | 268 |
|
---|
| 269 | if (_clkSocket && _clkSocket->thread() != currentThread()) {
|
---|
| 270 | emit(moveSocket(currentThread()));
|
---|
| 271 | }
|
---|
| 272 |
|
---|
[796] | 273 | if (_clkSocket && _clkSocket->state() == QAbstractSocket::ConnectedState) {
|
---|
| 274 | if ( _clkSocket->canReadLine()) {
|
---|
| 275 | readEpoch();
|
---|
| 276 | }
|
---|
[809] | 277 | else {
|
---|
| 278 | _clkSocket->waitForReadyRead(10);
|
---|
| 279 | }
|
---|
[769] | 280 | }
|
---|
| 281 | else {
|
---|
[794] | 282 | msleep(10);
|
---|
[769] | 283 | }
|
---|
| 284 | }
|
---|
[756] | 285 | }
|
---|
| 286 |
|
---|
[778] | 287 | //
|
---|
| 288 | ////////////////////////////////////////////////////////////////////////////
|
---|
[784] | 289 | void t_bns::readEpoch() {
|
---|
[778] | 290 |
|
---|
[784] | 291 | QByteArray line = _clkSocket->readLine();
|
---|
[786] | 292 |
|
---|
[1072] | 293 | if (_echoStream) {
|
---|
[1073] | 294 | *_echoStream << line;
|
---|
[1072] | 295 | _echoStream->flush();
|
---|
| 296 | }
|
---|
| 297 |
|
---|
[1058] | 298 | emit(newClkBytes(line.length()));
|
---|
| 299 |
|
---|
[784] | 300 | if (line.indexOf('*') == -1) {
|
---|
| 301 | return;
|
---|
[778] | 302 | }
|
---|
| 303 |
|
---|
[784] | 304 | QTextStream in(line);
|
---|
| 305 |
|
---|
| 306 | QString hlp;
|
---|
[798] | 307 | int GPSweek, numSat;
|
---|
| 308 | double GPSweeks;
|
---|
[784] | 309 |
|
---|
[798] | 310 | in >> hlp >> GPSweek >> GPSweeks >> numSat;
|
---|
[784] | 311 |
|
---|
[874] | 312 | if (numSat > 0) {
|
---|
| 313 |
|
---|
[922] | 314 | QStringList prns;
|
---|
| 315 |
|
---|
[1066] | 316 | for (int ic = 0; ic < _caster.size(); ic++) {
|
---|
| 317 | _caster.at(ic)->open();
|
---|
[927] | 318 |
|
---|
[1066] | 319 | for (int oldEph = 0; oldEph <= 0; oldEph++) { // TODO: handle old ephemeris
|
---|
| 320 |
|
---|
| 321 | struct ClockOrbit co;
|
---|
| 322 | memset(&co, 0, sizeof(co));
|
---|
| 323 | co.GPSEpochTime = (int)GPSweeks;
|
---|
| 324 | co.GLONASSEpochTime = (int)fmod(GPSweeks, 86400.0);
|
---|
| 325 | co.ClockDataSupplied = 1;
|
---|
| 326 | co.OrbitDataSupplied = 1;
|
---|
| 327 | co.SatRefPoint = POINT_CENTER;
|
---|
| 328 | co.SatRefDatum = DATUM_ITRF;
|
---|
| 329 |
|
---|
| 330 | for (int ii = 1; ii <= numSat; ii++) {
|
---|
| 331 |
|
---|
| 332 | QString prn;
|
---|
| 333 | ColumnVector xx(5);
|
---|
| 334 | t_eph* ep = 0;
|
---|
| 335 |
|
---|
[1075] | 336 | if (oldEph == 0 && ic == 0) {
|
---|
[1066] | 337 | line = _clkSocket->readLine();
|
---|
[1073] | 338 |
|
---|
| 339 | if (_echoStream) {
|
---|
| 340 | *_echoStream << line;
|
---|
| 341 | _echoStream->flush();
|
---|
| 342 | }
|
---|
| 343 |
|
---|
[1066] | 344 | QTextStream in(line);
|
---|
| 345 | in >> prn;
|
---|
| 346 | prns << prn;
|
---|
| 347 | if ( _ephList.contains(prn) ) {
|
---|
| 348 | in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6;
|
---|
| 349 |
|
---|
| 350 | //// beg test (zero clock correction for Gerhard Wuebbena)
|
---|
| 351 | //// xx(4) -= xx(5) / 299792458.0;
|
---|
| 352 | //// end test
|
---|
| 353 |
|
---|
| 354 | t_ephPair* pair = _ephList[prn];
|
---|
| 355 | pair->xx = xx;
|
---|
| 356 | ep = pair->eph;
|
---|
| 357 | }
|
---|
[872] | 358 | }
|
---|
[1066] | 359 | else {
|
---|
| 360 | prn = prns[ii-1];
|
---|
| 361 | if ( _ephList.contains(prn) ) {
|
---|
| 362 | t_ephPair* pair = _ephList[prn];
|
---|
| 363 | prn = pair->eph->prn();
|
---|
| 364 | xx = pair->xx;
|
---|
[1076] | 365 | if (oldEph) {
|
---|
| 366 | ep = pair->oldEph;
|
---|
| 367 | }
|
---|
| 368 | else {
|
---|
| 369 | ep = pair->eph;
|
---|
| 370 | }
|
---|
[1066] | 371 | }
|
---|
[873] | 372 | }
|
---|
[1066] | 373 |
|
---|
| 374 | if (ep != 0) {
|
---|
| 375 | struct ClockOrbit::SatData* sd = 0;
|
---|
| 376 | if (prn[0] == 'G') {
|
---|
| 377 | sd = co.Sat + co.NumberOfGPSSat;
|
---|
| 378 | ++co.NumberOfGPSSat;
|
---|
| 379 | }
|
---|
| 380 | else if (prn[0] == 'R') {
|
---|
| 381 | sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
|
---|
| 382 | ++co.NumberOfGLONASSSat;
|
---|
| 383 | }
|
---|
| 384 | if (sd) {
|
---|
| 385 | QString outLine;
|
---|
| 386 | processSatellite(oldEph, _caster.at(ic)->crdTrafo(), ep, GPSweek,
|
---|
| 387 | GPSweeks, prn, xx, sd, outLine);
|
---|
[1074] | 388 | _caster.at(ic)->printAscii(outLine);
|
---|
[1066] | 389 | }
|
---|
| 390 | }
|
---|
[873] | 391 | }
|
---|
[1066] | 392 |
|
---|
| 393 | if ( _caster.at(ic)->used() &&
|
---|
| 394 | (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
|
---|
| 395 | char obuffer[CLOCKORBIT_BUFFERSIZE];
|
---|
| 396 | int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
|
---|
| 397 | if (len > 0) {
|
---|
| 398 | emit(newOutBytes(len));
|
---|
| 399 | _caster.at(ic)->write(obuffer, len);
|
---|
[872] | 400 | }
|
---|
| 401 | }
|
---|
[863] | 402 | }
|
---|
| 403 | }
|
---|
[780] | 404 | }
|
---|
[778] | 405 | }
|
---|
[784] | 406 |
|
---|
| 407 | //
|
---|
| 408 | ////////////////////////////////////////////////////////////////////////////
|
---|
[1066] | 409 | void t_bns::processSatellite(int oldEph, bool trafo, t_eph* ep, int GPSweek,
|
---|
| 410 | double GPSweeks, const QString& prn,
|
---|
| 411 | const ColumnVector& xx,
|
---|
[1065] | 412 | struct ClockOrbit::SatData* sd,
|
---|
| 413 | QString& outLine) {
|
---|
[784] | 414 |
|
---|
[799] | 415 | ColumnVector xB(4);
|
---|
[802] | 416 | ColumnVector vv(3);
|
---|
[799] | 417 |
|
---|
[884] | 418 | ep->position(GPSweek, GPSweeks, xB, vv);
|
---|
[799] | 419 |
|
---|
[984] | 420 | ColumnVector xyz = xx.Rows(1,3);
|
---|
[1066] | 421 | if (trafo) {
|
---|
[985] | 422 | crdTrafo(GPSweek, xyz);
|
---|
[984] | 423 | }
|
---|
[927] | 424 |
|
---|
[984] | 425 | ColumnVector dx = xyz - xB.Rows(1,3);
|
---|
| 426 |
|
---|
[804] | 427 | double dClk = (xx(4) - xB(4)) * 299792458.0;
|
---|
| 428 | ColumnVector rsw(3);
|
---|
[800] | 429 |
|
---|
[806] | 430 | XYZ_to_RSW(xB.Rows(1,3), vv, dx, rsw);
|
---|
[804] | 431 |
|
---|
[863] | 432 | if (sd) {
|
---|
| 433 | sd->ID = prn.mid(1).toInt();
|
---|
[884] | 434 | sd->IOD = ep->IOD();
|
---|
[862] | 435 | sd->Clock.DeltaA0 = dClk;
|
---|
| 436 | sd->Orbit.DeltaRadial = rsw(1);
|
---|
| 437 | sd->Orbit.DeltaAlongTrack = rsw(2);
|
---|
| 438 | sd->Orbit.DeltaCrossTrack = rsw(3);
|
---|
[863] | 439 | }
|
---|
[862] | 440 |
|
---|
[1065] | 441 | char oldCh = (oldEph ? '!' : ' ');
|
---|
| 442 | outLine.sprintf("%c %d %.1f %s %3d %10.3f %8.3f %8.3f %8.3f\n",
|
---|
| 443 | oldCh, GPSweek, GPSweeks, ep->prn().toAscii().data(),
|
---|
| 444 | ep->IOD(), dClk, rsw(1), rsw(2), rsw(3));
|
---|
| 445 |
|
---|
[923] | 446 | if (!oldEph) {
|
---|
| 447 | if (_rnx) {
|
---|
| 448 | _rnx->write(GPSweek, GPSweeks, prn, xx);
|
---|
| 449 | }
|
---|
| 450 | if (_sp3) {
|
---|
| 451 | _sp3->write(GPSweek, GPSweeks, prn, xx);
|
---|
| 452 | }
|
---|
[847] | 453 | }
|
---|
[784] | 454 | }
|
---|
[836] | 455 |
|
---|
| 456 | //
|
---|
| 457 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 458 | void t_bns::slotMoveSocket(QThread* tt) {
|
---|
| 459 | _clkSocket->setParent(0);
|
---|
| 460 | _clkSocket->moveToThread(tt);
|
---|
| 461 | slotMessage("bns::slotMoveSocket");
|
---|
| 462 | }
|
---|
[984] | 463 |
|
---|
| 464 | // Transform Coordinates IGS -> ETRF
|
---|
| 465 | ////////////////////////////////////////////////////////////////////////////
|
---|
[985] | 466 | void t_bns::crdTrafo(int GPSWeek, ColumnVector& xyz) {
|
---|
[984] | 467 |
|
---|
[985] | 468 | ColumnVector dx(3);
|
---|
[1017] | 469 | dx(1) = 0.054;
|
---|
| 470 | dx(2) = 0.051;
|
---|
| 471 | dx(3) = -0.048;
|
---|
[1100] | 472 | static const double arcSec = 180.0 * 3600.0 / M_PI;
|
---|
| 473 | static const double ox = 0.000081 / arcSec;
|
---|
| 474 | static const double oy = 0.000490 / arcSec;
|
---|
| 475 | static const double oz = -0.000792 / arcSec;
|
---|
[984] | 476 |
|
---|
[985] | 477 | Matrix rMat(3,3); rMat = 0.0;
|
---|
| 478 | rMat(1,2) = -oz;
|
---|
| 479 | rMat(1,3) = oy;
|
---|
| 480 | rMat(2,1) = oz;
|
---|
| 481 | rMat(2,3) = -ox;
|
---|
| 482 | rMat(3,1) = -oy;
|
---|
| 483 | rMat(3,2) = ox;
|
---|
| 484 |
|
---|
| 485 | // Current epoch minus 1989.0 in years
|
---|
| 486 | // ------------------------------------
|
---|
| 487 | double dt = (GPSWeek - 469.0) / 365.2422 * 7.0;
|
---|
| 488 |
|
---|
| 489 | xyz += dx + dt * rMat * xyz;
|
---|
[984] | 490 | }
|
---|