source: trunk/FACT++/erfa/src/pvtob.c@ 18679

Last change on this file since 18679 was 18348, checked in by tbretz, 9 years ago
File size: 6.1 KB
Line 
1#include "erfa.h"
2
3void eraPvtob(double elong, double phi, double hm,
4 double xp, double yp, double sp, double theta,
5 double pv[2][3])
6/*
7** - - - - - - - - -
8** e r a P v t o b
9** - - - - - - - - -
10**
11** Position and velocity of a terrestrial observing station.
12**
13** Given:
14** elong double longitude (radians, east +ve, Note 1)
15** phi double latitude (geodetic, radians, Note 1)
16** hm double height above ref. ellipsoid (geodetic, m)
17** xp,yp double coordinates of the pole (radians, Note 2)
18** sp double the TIO locator s' (radians, Note 2)
19** theta double Earth rotation angle (radians, Note 3)
20**
21** Returned:
22** pv double[2][3] position/velocity vector (m, m/s, CIRS)
23**
24** Notes:
25**
26** 1) The terrestrial coordinates are with respect to the ERFA_WGS84
27** reference ellipsoid.
28**
29** 2) xp and yp are the coordinates (in radians) of the Celestial
30** Intermediate Pole with respect to the International Terrestrial
31** Reference System (see IERS Conventions), measured along the
32** meridians 0 and 90 deg west respectively. sp is the TIO locator
33** s', in radians, which positions the Terrestrial Intermediate
34** Origin on the equator. For many applications, xp, yp and
35** (especially) sp can be set to zero.
36**
37** 3) If theta is Greenwich apparent sidereal time instead of Earth
38** rotation angle, the result is with respect to the true equator
39** and equinox of date, i.e. with the x-axis at the equinox rather
40** than the celestial intermediate origin.
41**
42** 4) The velocity units are meters per UT1 second, not per SI second.
43** This is unlikely to have any practical consequences in the modern
44** era.
45**
46** 5) No validation is performed on the arguments. Error cases that
47** could lead to arithmetic exceptions are trapped by the eraGd2gc
48** function, and the result set to zeros.
49**
50** References:
51**
52** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
53** IERS Technical Note No. 32, BKG (2004)
54**
55** Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
56** the Astronomical Almanac, 3rd ed., University Science Books
57** (2013), Section 7.4.3.3.
58**
59** Called:
60** eraGd2gc geodetic to geocentric transformation
61** eraPom00 polar motion matrix
62** eraTrxp product of transpose of r-matrix and p-vector
63**
64** Copyright (C) 2013-2015, NumFOCUS Foundation.
65** Derived, with permission, from the SOFA library. See notes at end of file.
66*/
67{
68/* Earth rotation rate in radians per UT1 second */
69 const double OM = 1.00273781191135448 * ERFA_D2PI / ERFA_DAYSEC;
70
71 double xyzm[3], rpm[3][3], xyz[3], x, y, z, s, c;
72
73/* Geodetic to geocentric transformation (ERFA_WGS84). */
74 (void) eraGd2gc(1, elong, phi, hm, xyzm);
75
76/* Polar motion and TIO position. */
77 eraPom00(xp, yp, sp, rpm);
78 eraTrxp(rpm, xyzm, xyz);
79 x = xyz[0];
80 y = xyz[1];
81 z = xyz[2];
82
83/* Functions of ERA. */
84 s = sin(theta);
85 c = cos(theta);
86
87/* Position. */
88 pv[0][0] = c*x - s*y;
89 pv[0][1] = s*x + c*y;
90 pv[0][2] = z;
91
92/* Velocity. */
93 pv[1][0] = OM * ( -s*x - c*y );
94 pv[1][1] = OM * ( c*x - s*y );
95 pv[1][2] = 0.0;
96
97/* Finished. */
98
99}
100/*----------------------------------------------------------------------
101**
102**
103** Copyright (C) 2013-2015, NumFOCUS Foundation.
104** All rights reserved.
105**
106** This library is derived, with permission, from the International
107** Astronomical Union's "Standards of Fundamental Astronomy" library,
108** available from http://www.iausofa.org.
109**
110** The ERFA version is intended to retain identical functionality to
111** the SOFA library, but made distinct through different function and
112** file names, as set out in the SOFA license conditions. The SOFA
113** original has a role as a reference standard for the IAU and IERS,
114** and consequently redistribution is permitted only in its unaltered
115** state. The ERFA version is not subject to this restriction and
116** therefore can be included in distributions which do not support the
117** concept of "read only" software.
118**
119** Although the intent is to replicate the SOFA API (other than
120** replacement of prefix names) and results (with the exception of
121** bugs; any that are discovered will be fixed), SOFA is not
122** responsible for any errors found in this version of the library.
123**
124** If you wish to acknowledge the SOFA heritage, please acknowledge
125** that you are using a library derived from SOFA, rather than SOFA
126** itself.
127**
128**
129** TERMS AND CONDITIONS
130**
131** Redistribution and use in source and binary forms, with or without
132** modification, are permitted provided that the following conditions
133** are met:
134**
135** 1 Redistributions of source code must retain the above copyright
136** notice, this list of conditions and the following disclaimer.
137**
138** 2 Redistributions in binary form must reproduce the above copyright
139** notice, this list of conditions and the following disclaimer in
140** the documentation and/or other materials provided with the
141** distribution.
142**
143** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
144** the International Astronomical Union nor the names of its
145** contributors may be used to endorse or promote products derived
146** from this software without specific prior written permission.
147**
148** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
149** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
150** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
151** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
152** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
153** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
154** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
155** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
156** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
157** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
158** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
159** POSSIBILITY OF SUCH DAMAGE.
160**
161*/
Note: See TracBrowser for help on using the repository browser.