Ignore:
Timestamp:
Sep 17, 2024, 4:55:28 PM (8 weeks ago)
Author:
stuerze
Message:

Service and RTCM CRS encoding and decoding as well as Helmert parameter decoding added + some re-organisation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncrtnetuploadcaster.cpp

    r10416 r10533  
    6060  }
    6161
    62   _crdTrafo = crdTrafo;
     62  _crdTrafoStr = crdTrafo;
    6363
    6464  _ssrFormat = ssrFormat;
     
    135135  // Transformation Parameters from ITRF2014 to ETRF2000
    136136  // http://etrs89.ign.fr/pub/EUREF-TN-1-Mar-04-2024.pdf
    137   if (_crdTrafo == "ETRF2000") {
     137  if (_crdTrafoStr == "ETRF2000") {
    138138    _dx  =  0.0552;
    139139    _dy  =  0.0527;
     
    158158  }
    159159  // Transformation Parameters from ITRF2014 to GDA2020 (Ryan Ruddick, GA)
    160   else if (_crdTrafo == "GDA2020") {
     160  else if (_crdTrafoStr == "GDA2020") {
    161161    _dx  = 0.0;
    162162    _dy  = 0.0;
     
    182182  // Transformation Parameters from IGb14 to SIRGAS2000 (Thanks to Sonia Costa, BRA)
    183183  // June 29 2020: TX:-0.0027 m  TY:-0.0025 m  TZ:-0.0042 m  SCL:1.20 (ppb) no rotations and no rates.*/
    184   else if (_crdTrafo == "SIRGAS2000") {
     184  else if (_crdTrafoStr == "SIRGAS2000") {
    185185    _dx  = -0.0027;
    186186    _dy  = -0.0025;
     
    204204  }
    205205  // Transformation Parameters from ITRF2014 to DREF91
    206   else if (_crdTrafo == "DREF91") {
     206  else if (_crdTrafoStr == "DREF91") {
    207207    _dx  =  0.0547;
    208208    _dy  =  0.0522;
     
    226226    _t0  =  2010.0;
    227227  }
    228   else if (_crdTrafo == "Custom") {
     228  else if (_crdTrafoStr == "Custom") {
    229229    _dx = settings.value("trafo_dx").toDouble();
    230230    _dy = settings.value("trafo_dy").toDouble();
     
    244244  }
    245245    // TODO: the following lines can be deleted if all parameters are updated regarding ITRF2020
    246   if (_crdTrafo == "ETRF2000" ||
    247       _crdTrafo == "GDA2020"  ||
    248       _crdTrafo == "DREF91"   ||
    249       _crdTrafo == "SIRGAS2000") {
     246  if (_crdTrafoStr == "ETRF2000" ||
     247      _crdTrafoStr == "GDA2020"  ||
     248      _crdTrafoStr == "DREF91"   ||
     249      _crdTrafoStr == "SIRGAS2000") {
    250250       // Transformation Parameters from ITRF2020 to ITRF2014
    251251       // from ITRF web site: https://itrf.ign.fr/en/solutions/transformations
     
    329329    if      (nextEpoch != -1 && nextEpoch < iEpoEnd) {
    330330      rtnetStreamBuffer = rtnetStreamBuffer.mid(nextEpoch, nextEpochEnd);
    331       lines = rtnetStreamBuffer.split('\n', QString::SkipEmptyParts);
     331      lines = rtnetStreamBuffer.split('\n', Qt::SkipEmptyParts);
    332332      if (lines.size() > 2) {
    333333        decodeRtnetEpoch(lines);
     
    341341  }
    342342
    343   lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', QString::SkipEmptyParts);
     343  lines = _rtnetStreamBuffer.left(iEpoEnd).split('\n', Qt::SkipEmptyParts);
    344344
    345345  _rtnetStreamBuffer = _rtnetStreamBuffer.mid(iEpoEnd + 3);
     
    374374  memset(&co, 0, sizeof(co));
    375375  co.EpochTime[CLOCKORBIT_SATGPS] = static_cast<int>(epoTime.gpssec());
     376  double gt = epoTime.gpssec() - gnumleap(year, month, day);
    376377  if      (_ssrFormat == "RTCM-SSR") {
    377     double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
    378     co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
    379   }
    380   else if (_ssrFormat == "IGS-SSR") {
    381     co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
    382   }
     378    gt += 3 * 3600;
     379  }
     380  co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
    383381  co.EpochTime[CLOCKORBIT_SATGALILEO] = static_cast<int>(epoTime.gpssec());
    384382  co.EpochTime[CLOCKORBIT_SATQZSS]    = static_cast<int>(epoTime.gpssec());
    385383  co.EpochTime[CLOCKORBIT_SATSBAS]    = static_cast<int>(epoTime.gpssec());
    386   if      (_ssrFormat == "RTCM-SSR") {
    387     co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
    388   }
    389   else if (_ssrFormat == "IGS-SSR") {
    390     co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
    391   }
     384  co.EpochTime[CLOCKORBIT_SATBDS]     = static_cast<int>(epoTime.bdssec());
    392385  co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
    393386  co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
    394   co.SatRefDatum = _ssrCorr->DATUM_ITRF; // ToDo: to decode from RTNET format
     387  (_crdTrafoStr == "IGS20") ?
     388      co.SatRefDatum = _ssrCorr->DATUM_ITRF :
     389      co.SatRefDatum = _ssrCorr->DATUM_LOCAL;
    395390  co.SSRIOD        = _IOD;
    396391  co.SSRProviderID = _PID; // 256 .. BKG,  257 ... EUREF
    397392  co.SSRSolutionID = _SID;
     393  if      (_ssrFormat == "RTCM-SSR") {
     394    co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
     395  }
     396  else if (_ssrFormat == "IGS-SSR") {
     397    co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
     398  }
     399  co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
     400  co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
     401
     402
     403  t_serviceCrs serviceCrs;
     404  t_rtcmCrs    rtcmCrs;
     405  if (_crdTrafoStr == "IGS20") {
     406    serviceCrs._CE = serviceCrs._coordinateEpoch  = 0;
     407    int nc = _crdTrafoStr.length();
     408    if (nc > 31) {nc = 31;}
     409    for (int i = 0; i < nc; i++) {
     410      serviceCrs._name[i] =
     411         rtcmCrs._name[i] = _crdTrafoStr.toStdString()[i];
     412    }
     413    serviceCrs._name[nc] = 0;
     414    rtcmCrs._name[nc] = 0;
     415    rtcmCrs._anchor      = 0; // global CRS
     416    rtcmCrs._plateNumber = 0; // unknown
     417    rtcmCrs._databaseLinks << "ISO.DATUM.979" << "ISO.CRS:980";
     418  }
     419  else {
     420    if (_crdTrafoStr != "Custom") {
     421      serviceCrs._coordinateEpoch = _t0;
     422      serviceCrs.setCEFromCoordinateEpoch();
     423      int nc = _crdTrafoStr.length();
     424      if (nc > 31) {nc = 31;}
     425      for (int i = 0; i < nc; i++) {
     426        serviceCrs._name[i] = _crdTrafoStr.toStdString()[i];
     427      }
     428      serviceCrs._name[nc] = 0;
     429      QString rtcmcrsname = _crdTrafoStr + QString("(%1)").arg(_t0,4,'d',0);
     430      nc = rtcmcrsname.length();
     431      if (nc > 31) {nc = 31;}
     432      for (int i = 0; i < nc; i++) {
     433        rtcmCrs._name[i] = rtcmcrsname.toStdString()[i];
     434      }
     435      rtcmCrs._name[nc] = 0;
     436      if (_crdTrafoStr == "ETRF2000") {
     437        rtcmCrs._anchor      = 1; // plate-fixed CRS
     438        rtcmCrs._plateNumber = 7; // Eurasia
     439        rtcmCrs._databaseLinks << "ISO.DATUM.187"    << "ISO.CRS:260"   << "ISO.CRS:457"
     440                               << "EPSG.DATUM:1186"  << "EPSG.CRS:7930" << "EPSG.CRS:7931";
     441      }
     442      else if (_crdTrafoStr == "DREF91") {
     443        rtcmCrs._anchor      = 1; // plate-fixed CRS
     444        rtcmCrs._plateNumber = 7; // Eurasia
     445      }
     446      else if (_crdTrafoStr == "GDA2020") {
     447        rtcmCrs._anchor      = 1; // plate-fixed CRS
     448        rtcmCrs._plateNumber = 4; // Australia
     449        rtcmCrs._databaseLinks << "ISO.DATUM.186"   << "ISO.CRS:404"   << "ISO.CRS:329"
     450                               << "EPSG.DATUM:1168" << "EPSG.CRS:7842" << "EPSG.CRS:7843";
     451      }
     452      else if (_crdTrafoStr == "SIRGAS2000") {
     453        rtcmCrs._anchor      =  1; // plate-fixed CRS
     454        rtcmCrs._plateNumber = 12; // S.America
     455        rtcmCrs._databaseLinks << "ISO.DATUM:169"   << "ISO.CRS:384"   << "ISO.CRS:313"
     456                               << "EPSG.DATUM:6674" << "EPSG.CRS:4988" << "EPSG.CRS:4989";
     457      }
     458    }
     459  }
     460
    398461
    399462  struct SsrCorr::CodeBias bias;
     
    10261089
    10271090  double dc = 0.0;
    1028   if (_crdTrafo != "IGS20") {
     1091  if (_crdTrafoStr != "IGS20") {
    10291092    crdTrafo14(GPSweek, xP, dc); // ITRF2020 => ITRF2014
    10301093    crdTrafo(GPSweek, xP, dc);   // ITRF2014 to other reference frames
     
    11421205  ColumnVector meanSta(3);
    11431206
    1144   if (_crdTrafo == "ETRF2000") {
     1207  if (_crdTrafoStr == "ETRF2000") {
    11451208    meanSta(1) = 3661090.0;
    11461209    meanSta(2) = 845230.0;
    11471210    meanSta(3) = 5136850.0;
    11481211  }
    1149   else if (_crdTrafo == "GDA2020") {
     1212  else if (_crdTrafoStr == "GDA2020") {
    11501213    meanSta(1) = -4052050.0;
    11511214    meanSta(2) = 4212840.0;
    11521215    meanSta(3) = -2545110.0;
    11531216  }
    1154   else if (_crdTrafo == "SIRGAS2000") {
     1217  else if (_crdTrafoStr == "SIRGAS2000") {
    11551218    meanSta(1) = 3740860.0;
    11561219    meanSta(2) = -4964290.0;
    11571220    meanSta(3) = -1425420.0;
    11581221  }
    1159   else if (_crdTrafo == "DREF91") {
     1222  else if (_crdTrafoStr == "DREF91") {
    11601223    meanSta(1) = 3959579.0;
    11611224    meanSta(2) = 721719.0;
    11621225    meanSta(3) = 4931539.0;
    11631226  }
    1164   else if (_crdTrafo == "Custom") {
     1227  else if (_crdTrafoStr == "Custom") {
    11651228    meanSta(1) = 0.0;
    11661229    meanSta(2) = 0.0;
Note: See TracChangeset for help on using the changeset viewer.