Changeset 804 in ntrip


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

* empty log message *

Location:
trunk/BNS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bns.cpp

    r803 r804  
    240240                    vv(1), vv(2), vv(3));
    241241
    242   ColumnVector dx = xx - xB;
    243   dx(4) *= 299792458.0;
     242  ColumnVector dx   = xx.Rows(1,3) - xB.Rows(1,3);
     243  double       dClk = (xx(4) - xB(4)) * 299792458.0;
     244  ColumnVector rsw(3);
     245
     246  XYZ_to_RSW(xB, vv, dx, rsw);
    244247
    245248  cout.setf(ios::showpoint | ios::fixed);
    246249  cout << GPSweek << " "
    247250       << setprecision(1) << GPSweeks << " " << ep->prn.toAscii().data()
    248        << setw(8) << setprecision(3) << dx.t();
    249 }
     251       << setw(8) << setprecision(3) << dClk
     252       << setw(8) << setprecision(3) << rsw.t();
     253}
  • trunk/BNS/bns.pro

    r784 r804  
    22# Switch to debug configuration
    33# -----------------------------
    4 CONFIG -= release
    5 CONFIG += debug
     4### CONFIG -= release
     5### CONFIG += debug
    66
    77RESOURCES += bns.qrc
  • 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}
  • trunk/BNS/bnsutils.h

    r802 r804  
    22#ifndef BNSUTILS_H
    33#define BNSUTILS_H
     4
     5#include <newmat.h>
    46
    57#include <QString>
     
    1719void currentGPSWeeks(int& week, double& sec);
    1820
    19 void satellitePosition(double GPSweeks, const gpsEph* ep,
     21void satellitePosition(int GPSweek, double GPSweeks, const gpsEph* ep,
    2022                       double& X, double& Y, double& Z, double&,
    2123                       double& vX, double& vY, double& vZ);
     24
     25void XYZ_to_RSW(const ColumnVector& rr, const ColumnVector& vv,
     26                const ColumnVector& xyz, ColumnVector& rsw);
    2227#endif
Note: See TracChangeset for help on using the changeset viewer.