Changeset 11027 in ntrip for trunk


Ignore:
Timestamp:
Sep 11, 2026, 3:40:50 PM (2 days ago)
Author:
stuerze
Message:

Lat/Lon/Height is supperted as well as a priori coordinates

Location:
trunk/BNC
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/Example_Configs/Input/BNC_IGS20.CRD

    r11026 r11027  
    1010# - antenna, and
    1111# - receiver
     12#
     13# insteed of XYZ optional supported is 
     14# - geodetic Latitude/Longitude/Height through the keywords LAT: LON: H:
     15#   in D,M,S, which are comma-separated Degrees, Minutes and decimal Seconds,
     16#   the sign of Degrees carries the hemisphere, negative meaning South or West), and
     17#   height is the ellipsoidal height in meters, e.g.: LAT:49,8,39.12 LON:12,52,44.09 H:666.02
    1218################################################################################################
    1319# Reference System: IGS20 (IGS0OPSSNX_1994002_2026185_00U_CRD.SNX)
     
    2026PARK00AUS0 -4554255.23564276  2816652.46115249 -3454059.72019472 EPOCH:2020.0 VEL:-0.0360614781690518,-0.00224882614802764,0.0466110997530548  0.0000  0.0000  0.0250 LEIAR25         NONE SEPT POLARX5TR
    2127BRUX00BEL0  4027881.37719374  306998.748539549  4919499.01582683 EPOCH:2020.0 VEL:-0.0136005676831508,0.0167589259554315,0.0103501502632278  0.0010  0.0000  0.4689 JAVRINGANT_DM   SCIS SEPT POLARX5TR
     28"0688" LAT:52,24,27.03277 LON:9,48,5.44970 H:123.7785 EPOCH:2026.5   0.0000   0.0000   0.053
     29
    2230# RINEX
    2331FFMJ01DEU  4053455.66002983  617729.911377446  4869395.86849437 EPOCH:2020.0 VEL:-0.0148149200700258,0.0173394525889122,0.00993903277554994   0.0000  0.0000  0.0450 LEIAR25.R3      LEIT JAVAD TRE_3S DELTA
     
    3240
    3341################################################################################################
    34 # Howto extract the correct values from a cumulative SINEX file to fill BNCs  coordinates file #
     42# Howto extract the correct values from a cumulative SINEX file to fill BNCs coordinates file  
    3543################################################################################################
    3644# Two different "epochs" are in play in a cumulative SINEX file
  • trunk/BNC/src/bnchelp.html

    r11019 r11027  
    60886088      station's ITRF velocity is unknown;
    60896089      in that case the a priori coordinate is used unchanged, as before.
     6090    </li>
     6091    <br>
     6092    <li>Instead of a Cartesian XYZ coordinate, the a priori coordinate may alternatively be specified as a geodetic
     6093      Latitude/Longitude/Height through the keyword tokens
     6094      <span style="font-family:Monospace">LAT:&lt;D,M,S&gt;</span>,
     6095      <span style="font-family:Monospace">LON:&lt;D,M,S&gt;</span> and
     6096      <span style="font-family:Monospace">H:&lt;height&gt;</span> (in any order, in place of the 'X Y Z' fields).
     6097      <span style="font-family:Monospace">D,M,S</span> are comma-separated Degrees, Minutes and decimal Seconds (the
     6098      sign of Degrees carries the hemisphere, negative meaning South or West), and
     6099      <span style="font-family:Monospace">&lt;height&gt;</span> is the ellipsoidal height in meters, e.g.:
     6100      <pre><p style="font-family:Monospace">LAT:49,8,39.12 LON:12,52,44.09 H:666.02</p></pre>
     6101      BNC converts this internally to a Cartesian XYZ coordinate. 'EPOCH:' and 'VEL:' may be combined with
     6102      'LAT:'/'LON:'/'H:' the same way as with a Cartesian coordinate — in particular, 'EPOCH:' may be given on its
     6103      own, without 'VEL:', if only the coordinate's reference epoch is known but its velocity is not; in that case no
     6104      propagation is performed and the a priori coordinate is used as given.
    60906105    </li>
    60916106    <br>
  • trunk/BNC/src/bncutils.cpp

    r11022 r11027  
    392392}
    393393
     394// Ellipsoidal Coordinates -> Rectangular Coordinates
     395////////////////////////////////////////////////////////////////////////////
     396void ell2xyz(const double* Ell, double* XYZ) {
     397
     398  const double bell = t_CST::aell*(1.0-1.0/t_CST::fInv) ;
     399  const double e2   = (t_CST::aell*t_CST::aell-bell*bell)/(t_CST::aell*t_CST::aell) ;
     400
     401  double sinPhi = sin(Ell[0]);
     402  double cosPhi = cos(Ell[0]);
     403  double sinLam = sin(Ell[1]);
     404  double cosLam = cos(Ell[1]);
     405  double hh     = Ell[2];
     406
     407  double nn = t_CST::aell/sqrt(1.0-e2*sinPhi*sinPhi) ;
     408
     409  XYZ[0] = (nn+hh) * cosPhi * cosLam;
     410  XYZ[1] = (nn+hh) * cosPhi * sinLam;
     411  XYZ[2] = (nn*(1.0-e2)+hh) * sinPhi;
     412}
     413
    394414// Rectangular Coordinates -> Ellipsoidal Coordinates
    395415////////////////////////////////////////////////////////////////////////////
  • trunk/BNC/src/bncutils.h

    r11022 r11027  
    9292t_irc        xyz2geoc(const double* XYZ, double* Geoc);
    9393
     94void         ell2xyz(const double* Ell, double* XYZ);
    9495void         xyz2neu(const double* Ell, const double* xyz, double* neu);
    9596
  • trunk/BNC/src/pppCrdFile.cpp

    r11022 r11027  
    4040 * -----------------------------------------------------------------------*/
    4141
     42#include <cmath>
    4243#include <cstdlib>
    4344#include <fstream>
     
    4849using namespace std;
    4950using namespace BNC_PPP;
     51
     52// Convert a 'D,M,S' (degrees, minutes, seconds) token into decimal degrees;
     53// the sign of D carries the hemisphere (negative == South/West).
     54//////////////////////////////////////////////////////////////////////////////
     55static double dmsToDeg(const string& dms) {
     56  string str = dms;
     57  for (string::iterator it = str.begin(); it != str.end(); ++it) {
     58    if (*it == ',') *it = ' ';
     59  }
     60  istringstream in(str);
     61  double d = 0.0, m = 0.0, s = 0.0;
     62  in >> d >> m >> s;
     63  double sign = (d < 0.0) ? -1.0 : 1.0;
     64  return sign * (fabs(d) + m / 60.0 + s / 3600.0);
     65}
    5066
    5167//
     
    8197    }
    8298
    83     in >> staInfo._xyz(1) >> staInfo._xyz(2) >> staInfo._xyz(3);
     99    // The a priori coordinate is given either as plain Cartesian 'X Y Z', or,
     100    // if the line's first coordinate token is 'LAT:<D,M,S>', as geodetic
     101    // 'LAT:<D,M,S> LON:<D,M,S> H:<height>' (converted to XYZ below).
     102    streampos posBeforeCoord = in.tellg();
     103    string firstCoordTok;
     104    bool geodetic = false;
     105    if (in >> firstCoordTok) {
     106      geodetic = (firstCoordTok.compare(0, 4, "LAT:") == 0);
     107      in.seekg(posBeforeCoord);
     108    }
     109    if (!geodetic) {
     110      in >> staInfo._xyz(1) >> staInfo._xyz(2) >> staInfo._xyz(3);
     111    }
    84112
    85     // Optional 'EPOCH:<decimalYear>' and 'VEL:<vx>,<vy>,<vz>' keyword tokens
    86     // (ITRF reference epoch and velocity in m/year of the coordinate above),
    87     // may appear in any order before the antenna eccentricity / name fields.
     113    // Optional keyword tokens, may appear in any order before the antenna
     114    // eccentricity / name fields:
     115    //  - 'LAT:<D,M,S>', 'LON:<D,M,S>', 'H:<height>'  (geodetic a priori coordinate)
     116    //  - 'EPOCH:<decimalYear>'                       (ITRF reference epoch of the coordinate)
     117    //  - 'VEL:<vx>,<vy>,<vz>'                         (ITRF velocity [m/year] of the coordinate)
     118    double lat = 0.0, lon = 0.0, hgt = 0.0;
     119    bool haveLat = false, haveLon = false, haveHgt = false;
    88120    while (!in.eof()) {
    89121      streampos posBeforeToken = in.tellg();
     
    92124        break;
    93125      }
    94       if (token.compare(0, 6, "EPOCH:") == 0) {
     126      if (token.compare(0, 4, "LAT:") == 0) {
     127        lat = dmsToDeg(token.substr(4));
     128        haveLat = true;
     129      }
     130      else if (token.compare(0, 4, "LON:") == 0) {
     131        lon = dmsToDeg(token.substr(4));
     132        haveLon = true;
     133      }
     134      else if (token.compare(0, 2, "H:") == 0) {
     135        hgt = atof(token.substr(2).c_str());
     136        haveHgt = true;
     137      }
     138      else if (token.compare(0, 6, "EPOCH:") == 0) {
    95139        staInfo._epoch = atof(token.substr(6).c_str());
    96140      }
     
    107151        break;
    108152      }
     153    }
     154
     155    if (geodetic && haveLat && haveLon && haveHgt) {
     156      double Ell[3] = { lat * M_PI / 180.0, lon * M_PI / 180.0, hgt };
     157      double XYZ[3];
     158      ell2xyz(Ell, XYZ);
     159      staInfo._xyz(1) = XYZ[0];
     160      staInfo._xyz(2) = XYZ[1];
     161      staInfo._xyz(3) = XYZ[2];
    109162    }
    110163
Note: See TracChangeset for help on using the changeset viewer.