Changeset 804 in ntrip for trunk/BNS/bnsutils.cpp


Ignore:
Timestamp:
Apr 9, 2008, 12:50:05 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnsutils.cpp

    r802 r804  
    9494}
    9595
    96 //  
     96// Satellite Position computed using broadcast ephemeris
    9797////////////////////////////////////////////////////////////////////////////
    98 void satellitePosition(double GPSweeks, const gpsEph* ep,
     98void satellitePosition(int GPSweek, double GPSweeks, const gpsEph* ep,
    9999                       double& X, double& Y, double& Z, double& dt,
    100100                       double& vX, double& vY, double& vZ) {
    101101
     102  const static double secPerWeek = 7 * 86400.0;
    102103  const static double omegaEarth = 7292115.1467e-11;
    103104  const static double gmWGS      = 398.6005e12;
     
    112113  double n0 = sqrt(gmWGS/(a0*a0*a0));
    113114  double tk = GPSweeks - ep->TOE;
     115  if (GPSweek != ep->GPSweek) { 
     116    tk += (GPSweek - ep->GPSweek) * secPerWeek;
     117  }
    114118  double n  = n0 + ep->Delta_n;
    115119  double M  = ep->M0 + n*tk;
     
    141145 
    142146  double tc = GPSweeks - ep->TOC;
     147  if (GPSweek != ep->GPSweek) { 
     148    tc += (GPSweek - ep->GPSweek) * secPerWeek;
     149  }
    143150  dt = ep->clock_bias + ep->clock_drift*tc + ep->clock_driftrate*tc*tc
    144151       - 4.442807633e-10 * ep->e * sqrt(a0) *sin(E);
     
    168175  vZ  = sini    *doty  + yp*cosi      *doti;
    169176}
     177
     178// Transformation xyz --> radial, along track, out-of-plane
     179////////////////////////////////////////////////////////////////////////////
     180void XYZ_to_RSW(const ColumnVector& rr, const ColumnVector& vv,
     181                const ColumnVector& xyz, ColumnVector& rsw) {
     182
     183  ColumnVector cross = crossproduct(rr, vv);
     184
     185  rsw.ReSize(3);
     186  rsw(1) = DotProduct(xyz, rr)    / rr.norm_Frobenius();
     187  rsw(2) = DotProduct(xyz, vv)    / vv.norm_Frobenius();
     188  rsw(3) = DotProduct(xyz, cross) / cross.norm_Frobenius();
     189}
Note: See TracChangeset for help on using the changeset viewer.