PoleTides.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
44 #include "PoleTides.hpp"
45 #include "CivilTime.hpp"
46 #include "MJD.hpp"
47 
48 
49 namespace gnsstk
50 {
51 
52  /* Returns the effect of pole tides (meters) at the given
53  * position and epoch, in the Up-East-North (UEN) reference frame.
54  *
55  * @param[in] t Epoch to look up
56  * @param[in] p Position of interest
57  *
58  * @return a Triple with the pole tide effect, in meters and in
59  * the UEN reference frame.
60  *
61  * @throw InvalidRequest If the request can not be completed for
62  * any reason, this is thrown. The text may have additional
63  * information about the reason the request failed.
64  *
65  * @warning In order to use this method, you must have previously
66  * set the current pole displacement parameters
67  *
68  */
70  const Position& p )
71  {
72 
73  // We will store here the results
74  Triple res(0.0, 0.0, 0.0);
75 
76  // Declare J2000 reference time: January 1st, 2000, at noon
77  const CivilTime j2000(2000, 1, 1, 12, 0, 0.0);
78 
79 
80  try
81  {
82 
83  // Get current position's latitude and longitude, in radians
84  double latitude(p.geodeticLatitude()*DEG_TO_RAD);
85  double longitude(p.longitude()*DEG_TO_RAD);
86 
87  // Compute appropriate running averages
88  // Get time difference between current epoch and
89  // J2000.0, in years
90  double timedif(static_cast<double>((MJD(t).mjd - MJD(j2000).mjd)/365.25));
91 
92  double xpbar(0.054 + timedif*0.00083);
93  double ypbar(0.357 + timedif*0.00395);
94 
95  // Now, compute m1 and m2 parameters
96  double m1(xdisp-xpbar);
97  double m2(ypbar-ydisp);
98 
99  // Now, compute some useful values
100  double sin2lat(std::sin(2.0*latitude));
101  double cos2lat(std::cos(2.0*latitude));
102  double sinlat(std::sin(latitude));
103  double sinlon(std::sin(longitude));
104  double coslon(std::cos(longitude));
105 
106  // Finally, get the pole tide values, in UEN reference
107  // frame and meters
108  res[0] = -0.033 * sin2lat * ( m1*coslon + m2*sinlon );
109  res[1] = +0.009 * sinlat * ( m1*sinlon - m2*coslon );
110  res[2] = -0.009 * cos2lat * ( m1*coslon + m2*sinlon );
111 
112  // Please be aware that the former equations take into account
113  // that the IERS pole tide equations use CO-LATITUDE instead
114  // of LATITUDE. See Wahr, 1985.
115 
116  } // End of try block
117  catch(...)
118  {
119 
120  InvalidRequest ir("Unknown error when computing pole tides.");
121  GNSSTK_THROW(ir);
122 
123  }
124 
125  return res;
126 
127  } // End of method 'PoleTides::getPoleTide()'
128 
129 
130 
131  /* Method to set the pole displacement parameters
132  *
133  * @param x Pole displacement x, in arcseconds
134  * @param y Pole displacement y, in arcseconds
135  *
136  * @return This same object
137  */
138  PoleTides& PoleTides::setXY( const double& x,
139  const double& y )
140  {
141 
142  xdisp = x;
143  ydisp = y;
144 
145  return (*this);
146 
147  } // End of method 'PoleTides::setXY()'
148 
149 
150 
151 } // End of namespace gnsstk
example6.mjd
mjd
Definition: example6.py:102
gnsstk::Triple
Definition: Triple.hpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
MJD.hpp
std::sin
double sin(gnsstk::Angle x)
Definition: Angle.hpp:144
gnsstk::Position::geodeticLatitude
double geodeticLatitude() const noexcept
return geodetic latitude (degrees North).
Definition: Position.cpp:386
y
page HOWTO subpage DoxygenGuide Documenting Your Code page DoxygenGuide Documenting Your Code todo Flesh out this document section doctips Tips for Documenting When defining make sure that the prototype is identical between the cpp and hpp including both the namespaces and the parameter names for you have std::string as the return type in the hpp file and string as the return type in the cpp Doxygen may get confused and autolink to the cpp version with no documentation If you don t use the same parameter names between the cpp and hpp that will also confuse Doxygen Don t put type information in return or param documentation It doesn t really add anything and will often cause Doxygen to complain and not produce the documentation< br > use note Do not put a comma after a param name unless you mean to document multiple parameters< br/> the output stream</code >< br/> y
Definition: DOCUMENTING.dox:15
gnsstk::PoleTides::getPoleTide
Triple getPoleTide(const CommonTime &t, const Position &p)
Definition: PoleTides.cpp:69
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::PoleTides
Definition: PoleTides.hpp:91
CivilTime.hpp
gnsstk::PoleTides::xdisp
double xdisp
Pole displacement x, in arcseconds.
Definition: PoleTides.hpp:173
std::cos
double cos(gnsstk::Angle x)
Definition: Angle.hpp:146
gnsstk::PoleTides::setXY
PoleTides & setXY(const double &x, const double &y)
Definition: PoleTides.cpp:138
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::PoleTides::ydisp
double ydisp
Pole displacement y, in arcseconds.
Definition: PoleTides.hpp:184
gnsstk::Position::longitude
double longitude() const noexcept
Definition: Position.cpp:432
gnsstk::Position
Definition: Position.hpp:136
gnsstk::MJD
Definition: MJD.hpp:54
PoleTides.hpp
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
gnsstk::DEG_TO_RAD
static const double DEG_TO_RAD
Conversion Factor from degrees to radians (units: degrees^-1)
Definition: GNSSconstants.hpp:76


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40