Changeset 5801 in ntrip
- Timestamp:
- Aug 6, 2014, 10:24:02 AM (10 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP/pppModel.cpp
r5800 r5801 2 2 #include <cmath> 3 3 4 #include " bnctides.h"4 #include "pppModel.h" 5 5 #include "bncutils.h" 6 6 7 7 using namespace std; 8 8 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 } 9 double Frac (double x) { return x-floor(x); }; 10 double Modulo (double x, double y) { return y*Frac(x/y); } 11 12 Matrix 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 22 Matrix 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 32 Matrix 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; 49 40 } 50 41 51 42 // Greenwich Mean Sidereal Time 52 43 /////////////////////////////////////////////////////////////////////////// 53 double GMST(double Mjd_UT1) {44 double t_astro::GMST(double Mjd_UT1) { 54 45 55 46 const double Secs = 86400.0; … … 68 59 // Nutation Matrix 69 60 /////////////////////////////////////////////////////////////////////////// 70 Matrix NutMatrix(double Mjd_TT) {61 Matrix t_astro::NutMatrix(double Mjd_TT) { 71 62 72 63 const double T = (Mjd_TT-MJD_J2000)/36525.0; … … 89 80 // Precession Matrix 90 81 /////////////////////////////////////////////////////////////////////////// 91 Matrix PrecMatrix(double Mjd_1, double Mjd_2) {82 Matrix t_astro::PrecMatrix(double Mjd_1, double Mjd_2) { 92 83 93 84 const double T = (Mjd_1-MJD_J2000)/36525.0; … … 105 96 // Sun's position 106 97 /////////////////////////////////////////////////////////////////////////// 107 ColumnVector Sun(double Mjd_TT) {98 ColumnVector t_astro::Sun(double Mjd_TT) { 108 99 109 100 const double eps = 23.43929111/RHO_DEG; … … 126 117 // Moon's position 127 118 /////////////////////////////////////////////////////////////////////////// 128 ColumnVector Moon(double Mjd_TT) {119 ColumnVector t_astro::Moon(double Mjd_TT) { 129 120 130 121 const double eps = 23.43929111/RHO_DEG; … … 169 160 // Tidal Correction 170 161 //////////////////////////////////////////////////////////////////////////// 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; 162 ColumnVector t_tides::displacement(const bncTime& time, const ColumnVector& xyz) { 178 163 179 164 double Mjd = time.mjd() + time.daysec() / 86400.0; 180 165 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; 189 174 } 190 175 … … 199 184 // Tidal Displacement 200 185 // ------------------ 201 double scSun = DotProduct(xyzUnit, xSun);202 double scMoon = DotProduct(xyzUnit, xMoon);186 double scSun = DotProduct(xyzUnit, _xSun); 187 double scMoon = DotProduct(xyzUnit, _xMoon); 203 188 204 189 double p2Sun = 3.0 * (H2/2.0-L2) * scSun * scSun - H2/2.0; … … 213 198 214 199 double facSun = gms / gmWGS * 215 (rRec * rRec * rRec * rRec) / ( rSun * rSun *rSun);200 (rRec * rRec * rRec * rRec) / (_rSun * _rSun * _rSun); 216 201 217 202 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_H2 #define BNCTIDES_H1 #ifndef PPPMODEL_H 2 #define PPPMODEL_H 3 3 4 4 #include <newmat.h> 5 5 #include "bnctime.h" 6 6 7 ColumnVector Sun(double Mjd_TT); 7 class t_astro { 8 public: 9 static ColumnVector Sun(double Mjd_TT); 10 static ColumnVector Moon(double Mjd_TT); 8 11 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 26 class 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 }; 10 40 11 41 #endif -
trunk/BNC/src/src.pri
r5753 r5801 46 46 bncfigurelate.h bncpppclient.h bncversion.h \ 47 47 bancroft.h bncmodel.h bncfigureppp.h bncrawfile.h \ 48 bnc tides.h bncmap.h bncantex.h \48 bncmap.h bncantex.h \ 49 49 bncephuser.h bncoutf.h bncclockrinex.h bncsp3.h \ 50 50 bncbytescounter.h bncsslconfig.h reqcdlg.h \ … … 61 61 PPP/pppThread.h PPP/pppClient.h \ 62 62 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 64 65 65 66 HEADERS += serial/qextserialbase.h serial/qextserialport.h … … 77 78 bncfigurelate.cpp bncpppclient.cpp bnctime.cpp \ 78 79 bancroft.cpp bncmodel.cpp bncfigureppp.cpp bncrawfile.cpp \ 79 bnc tides.cpp bncmap_svg.cpp bncantex.cpp \80 bncmap_svg.cpp bncantex.cpp \ 80 81 bncephuser.cpp bncoutf.cpp bncclockrinex.cpp bncsp3.cpp \ 81 82 bncbytescounter.cpp bncsslconfig.cpp reqcdlg.cpp \ … … 92 93 PPP/pppThread.cpp PPP/pppClient.cpp \ 93 94 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 95 97 96 98 SOURCES += serial/qextserialbase.cpp serial/qextserialport.cpp -
trunk/BNC/src/src.pro
r5078 r5801 2 2 TARGET = ../bnc 3 3 4 CONFIG -= debug5 CONFIG += release4 CONFIG -= release 5 CONFIG += debug 6 6 7 7 include(src.pri)
Note:
See TracChangeset
for help on using the changeset viewer.