Changeset 5801 in ntrip


Ignore:
Timestamp:
Aug 6, 2014, 10:24:02 AM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP/pppModel.cpp

    r5800 r5801  
    22#include <cmath>
    33
    4 #include "bnctides.h"
     4#include "pppModel.h"
    55#include "bncutils.h"
    66
    77using namespace std;
    88
    9 // Auxiliary Functions
    10 ///////////////////////////////////////////////////////////////////////////
    11 namespace {
    12 
    13   static const double RHO_DEG   = 180.0 / M_PI;
    14   static const double RHO_SEC   = 3600.0 * RHO_DEG;
    15   static const double MJD_J2000 = 51544.5;
    16 
    17   double Frac (double x) { return x-floor(x); };
    18   double Modulo (double x, double y) { return y*Frac(x/y); }
    19 
    20   Matrix rotX(double Angle) {
    21     const double C = cos(Angle);
    22     const double S = sin(Angle);
    23     Matrix UU(3,3);
    24     UU[0][0] = 1.0;  UU[0][1] = 0.0;  UU[0][2] = 0.0;
    25     UU[1][0] = 0.0;  UU[1][1] =  +C;  UU[1][2] =  +S;
    26     UU[2][0] = 0.0;  UU[2][1] =  -S;  UU[2][2] =  +C;
    27     return UU;
    28   }
    29  
    30   Matrix rotY(double Angle) {
    31     const double C = cos(Angle);
    32     const double S = sin(Angle);
    33     Matrix UU(3,3);
    34     UU[0][0] =  +C;  UU[0][1] = 0.0;  UU[0][2] =  -S;
    35     UU[1][0] = 0.0;  UU[1][1] = 1.0;  UU[1][2] = 0.0;
    36     UU[2][0] =  +S;  UU[2][1] = 0.0;  UU[2][2] =  +C;
    37     return UU;
    38   }
    39  
    40   Matrix rotZ(double Angle) {
    41     const double C = cos(Angle);
    42     const double S = sin(Angle);
    43     Matrix UU(3,3);
    44     UU[0][0] =  +C;  UU[0][1] =  +S;  UU[0][2] = 0.0;
    45     UU[1][0] =  -S;  UU[1][1] =  +C;  UU[1][2] = 0.0;
    46     UU[2][0] = 0.0;  UU[2][1] = 0.0;  UU[2][2] = 1.0;
    47     return UU;
    48   }
     9double Frac (double x) { return x-floor(x); };
     10double Modulo (double x, double y) { return y*Frac(x/y); }
     11
     12Matrix t_astro::rotX(double Angle) {
     13  const double C = cos(Angle);
     14  const double S = sin(Angle);
     15  Matrix UU(3,3);
     16  UU[0][0] = 1.0;  UU[0][1] = 0.0;  UU[0][2] = 0.0;
     17  UU[1][0] = 0.0;  UU[1][1] =  +C;  UU[1][2] =  +S;
     18  UU[2][0] = 0.0;  UU[2][1] =  -S;  UU[2][2] =  +C;
     19  return UU;
     20}
     21
     22Matrix t_astro::rotY(double Angle) {
     23  const double C = cos(Angle);
     24  const double S = sin(Angle);
     25  Matrix UU(3,3);
     26  UU[0][0] =  +C;  UU[0][1] = 0.0;  UU[0][2] =  -S;
     27  UU[1][0] = 0.0;  UU[1][1] = 1.0;  UU[1][2] = 0.0;
     28  UU[2][0] =  +S;  UU[2][1] = 0.0;  UU[2][2] =  +C;
     29  return UU;
     30}
     31
     32Matrix t_astro::rotZ(double Angle) {
     33  const double C = cos(Angle);
     34  const double S = sin(Angle);
     35  Matrix UU(3,3);
     36  UU[0][0] =  +C;  UU[0][1] =  +S;  UU[0][2] = 0.0;
     37  UU[1][0] =  -S;  UU[1][1] =  +C;  UU[1][2] = 0.0;
     38  UU[2][0] = 0.0;  UU[2][1] = 0.0;  UU[2][2] = 1.0;
     39  return UU;
    4940}
    5041
    5142// Greenwich Mean Sidereal Time
    5243///////////////////////////////////////////////////////////////////////////
    53 double GMST(double Mjd_UT1) {
     44double t_astro::GMST(double Mjd_UT1) {
    5445
    5546  const double Secs = 86400.0;
     
    6859// Nutation Matrix
    6960///////////////////////////////////////////////////////////////////////////
    70 Matrix NutMatrix(double Mjd_TT) {
     61Matrix t_astro::NutMatrix(double Mjd_TT) {
    7162
    7263  const double T  = (Mjd_TT-MJD_J2000)/36525.0;
     
    8980// Precession Matrix
    9081///////////////////////////////////////////////////////////////////////////
    91 Matrix PrecMatrix (double Mjd_1, double Mjd_2) {
     82Matrix t_astro::PrecMatrix(double Mjd_1, double Mjd_2) {
    9283
    9384  const double T  = (Mjd_1-MJD_J2000)/36525.0;
     
    10596// Sun's position
    10697///////////////////////////////////////////////////////////////////////////
    107 ColumnVector Sun(double Mjd_TT) {
     98ColumnVector t_astro::Sun(double Mjd_TT) {
    10899
    109100  const double eps = 23.43929111/RHO_DEG;
     
    126117// Moon's position
    127118///////////////////////////////////////////////////////////////////////////
    128 ColumnVector Moon(double Mjd_TT) {
     119ColumnVector t_astro::Moon(double Mjd_TT) {
    129120
    130121  const double eps = 23.43929111/RHO_DEG;
     
    169160// Tidal Correction
    170161////////////////////////////////////////////////////////////////////////////
    171 void tides(const bncTime& time, ColumnVector& xyz) {
    172 
    173   static double       lastMjd = 0.0;
    174   static ColumnVector xSun;
    175   static ColumnVector xMoon;
    176   static double       rSun;
    177   static double       rMoon;
     162ColumnVector t_tides::displacement(const bncTime& time, const ColumnVector& xyz) {
    178163
    179164  double Mjd = time.mjd() + time.daysec() / 86400.0;
    180165
    181   if (Mjd != lastMjd) {
    182     lastMjd = Mjd;
    183     xSun = Sun(Mjd);
    184     rSun = sqrt(DotProduct(xSun,xSun));
    185     xSun /= rSun;
    186     xMoon = Moon(Mjd);
    187     rMoon = sqrt(DotProduct(xMoon,xMoon));
    188     xMoon /= rMoon;
     166  if (Mjd != _lastMjd) {
     167    _lastMjd = Mjd;
     168    _xSun = t_astro::Sun(Mjd);
     169    _rSun = sqrt(DotProduct(_xSun,_xSun));
     170    _xSun /= _rSun;
     171    _xMoon = t_astro::Moon(Mjd);
     172    _rMoon = sqrt(DotProduct(_xMoon,_xMoon));
     173    _xMoon /= _rMoon;
    189174  }
    190175
     
    199184  // Tidal Displacement
    200185  // ------------------
    201   double scSun  = DotProduct(xyzUnit, xSun);
    202   double scMoon = DotProduct(xyzUnit, xMoon);
     186  double scSun  = DotProduct(xyzUnit, _xSun);
     187  double scMoon = DotProduct(xyzUnit, _xMoon);
    203188
    204189  double p2Sun  = 3.0 * (H2/2.0-L2) * scSun  * scSun  - H2/2.0;
     
    213198
    214199  double facSun  = gms / gmWGS *
    215                    (rRec * rRec * rRec * rRec) / (rSun * rSun * rSun);
     200                   (rRec * rRec * rRec * rRec) / (_rSun * _rSun * _rSun);
    216201
    217202  double facMoon = gmm / gmWGS *
    218                    (rRec * rRec * rRec * rRec) / (rMoon * rMoon * rMoon);
    219 
    220   ColumnVector dX = facSun  * (x2Sun  * xSun  + p2Sun  * xyzUnit) +
    221                     facMoon * (x2Moon * xMoon + p2Moon * xyzUnit);
    222 
    223   xyz += dX;
    224 }
     203                   (rRec * rRec * rRec * rRec) / (_rMoon * _rMoon * _rMoon);
     204
     205  ColumnVector dX = facSun  * (x2Sun  * _xSun  + p2Sun  * xyzUnit) +
     206                    facMoon * (x2Moon * _xMoon + p2Moon * xyzUnit);
     207
     208  return dX;
     209}
  • trunk/BNC/src/PPP/pppModel.h

    r5800 r5801  
    1 #ifndef BNCTIDES_H
    2 #define BNCTIDES_H
     1#ifndef PPPMODEL_H
     2#define PPPMODEL_H
    33
    44#include <newmat.h>
    55#include "bnctime.h"
    66
    7 ColumnVector Sun(double Mjd_TT);
     7class t_astro {
     8 public:
     9  static ColumnVector Sun(double Mjd_TT);
     10  static ColumnVector Moon(double Mjd_TT);
    811
    9 void         tides(const bncTime& time, ColumnVector& xyz);
     12 private:
     13  static const double RHO_DEG   = 180.0 / M_PI;
     14  static const double RHO_SEC   = 3600.0 * 180.0 / M_PI;
     15  static const double MJD_J2000 = 51544.5;
     16
     17  static Matrix rotX(double Angle);
     18  static Matrix rotY(double Angle);
     19  static Matrix rotZ(double Angle);
     20
     21  static double GMST(double Mjd_UT1);
     22  static Matrix NutMatrix(double Mjd_TT);
     23  static Matrix PrecMatrix (double Mjd_1, double Mjd_2);
     24};
     25
     26class t_tides {
     27 public:
     28  t_tides() {
     29    _lastMjd = 0.0;
     30  }
     31  ~t_tides() {}
     32  ColumnVector displacement(const bncTime& time, const ColumnVector& xyz);
     33 private:
     34  double       _lastMjd;
     35  ColumnVector _xSun;
     36  ColumnVector _xMoon;
     37  double       _rSun;
     38  double       _rMoon;
     39};
    1040
    1141#endif
  • trunk/BNC/src/src.pri

    r5753 r5801  
    4646          bncfigurelate.h bncpppclient.h bncversion.h                 \
    4747          bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h           \
    48           bnctides.h bncmap.h bncantex.h                              \
     48          bncmap.h bncantex.h                              \
    4949          bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h             \
    5050          bncbytescounter.h bncsslconfig.h reqcdlg.h                  \
     
    6161          PPP/pppThread.h PPP/pppClient.h                             \
    6262          PPP/obspool.h PPP/station.h PPP/filter.h PPP/ephpool.h      \
    63           PPP/satobs.h PPP/satbias.h PPP/parlist.h PPP/windup.h
     63          PPP/satobs.h PPP/satbias.h PPP/parlist.h PPP/windup.h       \
     64          PPP/pppModel.h
    6465
    6566HEADERS       += serial/qextserialbase.h serial/qextserialport.h
     
    7778          bncfigurelate.cpp bncpppclient.cpp bnctime.cpp              \
    7879          bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp   \
    79           bnctides.cpp bncmap_svg.cpp bncantex.cpp                    \
     80          bncmap_svg.cpp bncantex.cpp                    \
    8081          bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp     \
    8182          bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp            \
     
    9293          PPP/pppThread.cpp PPP/pppClient.cpp                         \
    9394          PPP/obspool.cpp PPP/station.cpp PPP/filter.cpp PPP/ephpool.cpp \
    94           PPP/satobs.cpp PPP/satbias.cpp PPP/parlist.cpp PPP/windup.cpp
     95          PPP/satobs.cpp PPP/satbias.cpp PPP/parlist.cpp PPP/windup.cpp \
     96          PPP/pppModel.cpp
    9597
    9698SOURCES       += serial/qextserialbase.cpp serial/qextserialport.cpp
  • trunk/BNC/src/src.pro

    r5078 r5801  
    22TARGET = ../bnc
    33
    4 CONFIG -= debug
    5 CONFIG += release
     4CONFIG -= release
     5CONFIG += debug
    66
    77include(src.pri)
Note: See TracChangeset for help on using the changeset viewer.