source: trunk/FACT++/sofa/src/apcs.c@ 18355

Last change on this file since 18355 was 18346, checked in by tbretz, 11 years ago
File size: 10.7 KB
Line 
1#include "sofa.h"
2
3void iauApcs(double date1, double date2, double pv[2][3],
4 double ebpv[2][3], double ehp[3],
5 iauASTROM *astrom)
6/*
7** - - - - - - - -
8** i a u A p c s
9** - - - - - - - -
10**
11** For an observer whose geocentric position and velocity are known,
12** prepare star-independent astrometry parameters for transformations
13** between ICRS and GCRS. The Earth ephemeris is supplied by the
14** caller.
15**
16** The parameters produced by this function are required in the space
17** motion, parallax, light deflection and aberration parts of the
18** astrometric transformation chain.
19**
20** This function is part of the International Astronomical Union's
21** SOFA (Standards of Fundamental Astronomy) software collection.
22**
23** Status: support function.
24**
25** Given:
26** date1 double TDB as a 2-part...
27** date2 double ...Julian Date (Note 1)
28** pv double[2][3] observer's geocentric pos/vel (m, m/s)
29** ebpv double[2][3] Earth barycentric PV (au, au/day)
30** ehp double[3] Earth heliocentric P (au)
31**
32** Returned:
33** astrom iauASTROM* star-independent astrometry parameters:
34** pmt double PM time interval (SSB, Julian years)
35** eb double[3] SSB to observer (vector, au)
36** eh double[3] Sun to observer (unit vector)
37** em double distance from Sun to observer (au)
38** v double[3] barycentric observer velocity (vector, c)
39** bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
40** bpn double[3][3] bias-precession-nutation matrix
41** along double unchanged
42** xpl double unchanged
43** ypl double unchanged
44** sphi double unchanged
45** cphi double unchanged
46** diurab double unchanged
47** eral double unchanged
48** refa double unchanged
49** refb double unchanged
50**
51** Notes:
52**
53** 1) The TDB date date1+date2 is a Julian Date, apportioned in any
54** convenient way between the two arguments. For example,
55** JD(TDB)=2450123.7 could be expressed in any of these ways, among
56** others:
57**
58** date1 date2
59**
60** 2450123.7 0.0 (JD method)
61** 2451545.0 -1421.3 (J2000 method)
62** 2400000.5 50123.2 (MJD method)
63** 2450123.5 0.2 (date & time method)
64**
65** The JD method is the most natural and convenient to use in cases
66** where the loss of several decimal digits of resolution is
67** acceptable. The J2000 method is best matched to the way the
68** argument is handled internally and will deliver the optimum
69** resolution. The MJD method and the date & time methods are both
70** good compromises between resolution and convenience. For most
71** applications of this function the choice will not be at all
72** critical.
73**
74** TT can be used instead of TDB without any significant impact on
75** accuracy.
76**
77** 2) All the vectors are with respect to BCRS axes.
78**
79** 3) Providing separate arguments for (i) the observer's geocentric
80** position and velocity and (ii) the Earth ephemeris is done for
81** convenience in the geocentric, terrestrial and Earth orbit cases.
82** For deep space applications it maybe more convenient to specify
83** zero geocentric position and velocity and to supply the
84** observer's position and velocity information directly instead of
85** with respect to the Earth. However, note the different units:
86** m and m/s for the geocentric vectors, au and au/day for the
87** heliocentric and barycentric vectors.
88**
89** 4) In cases where the caller does not wish to provide the Earth
90** ephemeris, the function iauApcs13 can be used instead of the
91** present function. This computes the Earth ephemeris using the
92** SOFA function iauEpv00.
93**
94** 5) This is one of several functions that inserts into the astrom
95** structure star-independent parameters needed for the chain of
96** astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
97**
98** The various functions support different classes of observer and
99** portions of the transformation chain:
100**
101** functions observer transformation
102**
103** iauApcg iauApcg13 geocentric ICRS <-> GCRS
104** iauApci iauApci13 terrestrial ICRS <-> CIRS
105** iauApco iauApco13 terrestrial ICRS <-> observed
106** iauApcs iauApcs13 space ICRS <-> GCRS
107** iauAper iauAper13 terrestrial update Earth rotation
108** iauApio iauApio13 terrestrial CIRS <-> observed
109**
110** Those with names ending in "13" use contemporary SOFA models to
111** compute the various ephemerides. The others accept ephemerides
112** supplied by the caller.
113**
114** The transformation from ICRS to GCRS covers space motion,
115** parallax, light deflection, and aberration. From GCRS to CIRS
116** comprises frame bias and precession-nutation. From CIRS to
117** observed takes account of Earth rotation, polar motion, diurnal
118** aberration and parallax (unless subsumed into the ICRS <-> GCRS
119** transformation), and atmospheric refraction.
120**
121** 6) The context structure astrom produced by this function is used by
122** iauAtciq* and iauAticq*.
123**
124** Called:
125** iauCp copy p-vector
126** iauPm modulus of p-vector
127** iauPn decompose p-vector into modulus and direction
128** iauIr initialize r-matrix to identity
129**
130** This revision: 2013 October 9
131**
132** SOFA release 2015-02-09
133**
134** Copyright (C) 2015 IAU SOFA Board. See notes at end.
135*/
136{
137/* au/d to m/s */
138 const double AUDMS = DAU/DAYSEC;
139
140/* Light time for 1 AU (day) */
141 const double CR = AULT/DAYSEC;
142
143 int i;
144 double dp, dv, pb[3], vb[3], ph[3], v2, w;
145
146/* Time since reference epoch, years (for proper motion calculation). */
147 astrom->pmt = ( (date1 - DJ00) + date2 ) / DJY;
148
149/* Adjust Earth ephemeris to observer. */
150 for (i = 0; i < 3; i++) {
151 dp = pv[0][i] / DAU;
152 dv = pv[1][i] / AUDMS;
153 pb[i] = ebpv[0][i] + dp;
154 vb[i] = ebpv[1][i] + dv;
155 ph[i] = ehp[i] + dp;
156 }
157
158/* Barycentric position of observer (au). */
159 iauCp(pb, astrom->eb);
160
161/* Heliocentric direction and distance (unit vector and au). */
162 iauPn(ph, &astrom->em, astrom->eh);
163
164/* Barycentric vel. in units of c, and reciprocal of Lorenz factor. */
165 v2 = 0.0;
166 for (i = 0; i < 3; i++) {
167 w = vb[i] * CR;
168 astrom->v[i] = w;
169 v2 += w*w;
170 }
171 astrom->bm1 = sqrt(1.0 - v2);
172
173/* Reset the NPB matrix. */
174 iauIr(astrom->bpn);
175
176/* Finished. */
177
178/*----------------------------------------------------------------------
179**
180** Copyright (C) 2015
181** Standards Of Fundamental Astronomy Board
182** of the International Astronomical Union.
183**
184** =====================
185** SOFA Software License
186** =====================
187**
188** NOTICE TO USER:
189**
190** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
191** CONDITIONS WHICH APPLY TO ITS USE.
192**
193** 1. The Software is owned by the IAU SOFA Board ("SOFA").
194**
195** 2. Permission is granted to anyone to use the SOFA software for any
196** purpose, including commercial applications, free of charge and
197** without payment of royalties, subject to the conditions and
198** restrictions listed below.
199**
200** 3. You (the user) may copy and distribute SOFA source code to others,
201** and use and adapt its code and algorithms in your own software,
202** on a world-wide, royalty-free basis. That portion of your
203** distribution that does not consist of intact and unchanged copies
204** of SOFA source code files is a "derived work" that must comply
205** with the following requirements:
206**
207** a) Your work shall be marked or carry a statement that it
208** (i) uses routines and computations derived by you from
209** software provided by SOFA under license to you; and
210** (ii) does not itself constitute software provided by and/or
211** endorsed by SOFA.
212**
213** b) The source code of your derived work must contain descriptions
214** of how the derived work is based upon, contains and/or differs
215** from the original SOFA software.
216**
217** c) The names of all routines in your derived work shall not
218** include the prefix "iau" or "sofa" or trivial modifications
219** thereof such as changes of case.
220**
221** d) The origin of the SOFA components of your derived work must
222** not be misrepresented; you must not claim that you wrote the
223** original software, nor file a patent application for SOFA
224** software or algorithms embedded in the SOFA software.
225**
226** e) These requirements must be reproduced intact in any source
227** distribution and shall apply to anyone to whom you have
228** granted a further right to modify the source code of your
229** derived work.
230**
231** Note that, as originally distributed, the SOFA software is
232** intended to be a definitive implementation of the IAU standards,
233** and consequently third-party modifications are discouraged. All
234** variations, no matter how minor, must be explicitly marked as
235** such, as explained above.
236**
237** 4. You shall not cause the SOFA software to be brought into
238** disrepute, either by misuse, or use for inappropriate tasks, or
239** by inappropriate modification.
240**
241** 5. The SOFA software is provided "as is" and SOFA makes no warranty
242** as to its use or performance. SOFA does not and cannot warrant
243** the performance or results which the user may obtain by using the
244** SOFA software. SOFA makes no warranties, express or implied, as
245** to non-infringement of third party rights, merchantability, or
246** fitness for any particular purpose. In no event will SOFA be
247** liable to the user for any consequential, incidental, or special
248** damages, including any lost profits or lost savings, even if a
249** SOFA representative has been advised of such damages, or for any
250** claim by any third party.
251**
252** 6. The provision of any version of the SOFA software under the terms
253** and conditions specified herein does not imply that future
254** versions will also be made available under the same terms and
255** conditions.
256*
257** In any published work or commercial product which uses the SOFA
258** software directly, acknowledgement (see www.iausofa.org) is
259** appreciated.
260**
261** Correspondence concerning SOFA software should be addressed as
262** follows:
263**
264** By email: sofa@ukho.gov.uk
265** By post: IAU SOFA Center
266** HM Nautical Almanac Office
267** UK Hydrographic Office
268** Admiralty Way, Taunton
269** Somerset, TA1 2DN
270** United Kingdom
271**
272**--------------------------------------------------------------------*/
273
274}
Note: See TracBrowser for help on using the repository browser.