1 /*
2  *  - - - - - - - - - - -
3  *   g a l _ e q e q 9 4
4  *  - - - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *  Equation of the equinoxes, IAU 1994 model.
11  *
12  *  This routine is an independent translation of a FORTRAN routine
13  *  that is part of IAU's SOFA software collection.
14  *
15  *  Status:
16  *
17  *     canonical model.
18  *
19  *  Given:
20  *
21  *     date1,date2         d        TDB date (Note 1)
22  *
23  *  Returned:
24  *
25  *     gal_eqeq94          d        equation of the equinoxes (Note 2)
26  *
27  *  Notes:
28  *
29  *  1) The date date1+date2 is a Julian Date, apportioned in any
30  *     convenient way between the two arguments.  For example,
31  *     JD(TT)=2450123.7 could be expressed in any of these ways,
32  *     among others:
33  *
34  *            date1         date2
35  *
36  *         2450123.7          0.0        (JD method)
37  *         2451545.0      -1421.3        (J2000 method)
38  *         2400000.5      50123.2        (MJD method)
39  *         2450123.5          0.2        (date & time method)
40  *
41  *     The JD method is the most natural and convenient to use in
42  *     cases where the loss of several decimal digits of resolution
43  *     is acceptable.  The J2000 method is best matched to the way
44  *     the argument is handled internally and will deliver the
45  *     optimum resolution.  The MJD method and the date & time methods
46  *     are both good compromises between resolution and convenience.
47  *
48  *  2) The result, which is in radians, operates in the following sense:
49  *
50  *        Greenwich apparent ST = GMST + equation of the equinoxes
51  *
52  *  Called:
53  *
54  *     gal_nut80          nutation, IAU 1980
55  *     gal_obl80          mean obliquity, IAU 1980
56  *
57  *  References:
58  *
59  *     IAU Resolution C7, Recommendation 3 (1994)
60  *
61  *     Capitaine, N. & Gontier, A.-M., Astron. Astrophys., 275,
62  *     645-650 (1993)
63  *
64  *  This revision:
65  *
66  *     2006 November 13 ( c version January 19, 2008 )
67  *
68  *
69  *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
70  *
71  *-----------------------------------------------------------------------
72  */
73 
74 #include <math.h>
75 #include "gal_eqeq94.h"
76 #include "gal_const.h"
77 #include "gal_nut80.h"
78 #include "gal_obl80.h"
79 #include "gal_anpm.h"
80 
81 double
gal_eqeq94(double date1,double date2)82 gal_eqeq94
83  (
84     double date1,
85     double date2
86  )
87 {
88 
89     double t, om, dpsi, deps, eps0 ;
90 
91 /*
92  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
93  */
94 
95 /*
96  * Interval between fundamental epoch J2000.0 and given date (JC).
97  */
98 
99     t = ( ( date1 - GAL_J2000 ) + date2 ) / GAL_DJC ;
100 
101 /*
102  * Longitude of the mean ascending node of the lunar orbit on the
103  * ecliptic, measured from the mean equinox of date.
104  */
105 
106     om = gal_anpm ( ( 450160.280 + ( -482890.539 +
107                         ( 7.455 + 0.008 * t ) * t ) * t ) * GAL_AS2R
108                      + fmod ( -5.0 * t, 1.0 ) * GAL_2PI ) ;
109 
110 /*
111  * Nutation components and mean obliquity.
112  */
113 
114     gal_nut80 ( date1, date2, &dpsi, &deps ) ;
115     eps0 = gal_obl80 ( date1, date2 ) ;
116 
117 /*
118  * Equation of the equinoxes.
119  */
120 
121     return dpsi * cos ( eps0 ) + GAL_AS2R * ( 0.00264 * sin ( om ) + 0.000063 * sin ( om + om ) ) ;
122 
123 /*
124  * Finished.
125  */
126 
127 }
128 
129 /*
130  *  gal - General Astrodynamics Library
131  *  Copyright (C) 2008 Paul C. L. Willmott
132  *
133  *  This program is free software; you can redistribute it and/or modify
134  *  it under the terms of the GNU General Public License as published by
135  *  the Free Software Foundation; either version 2 of the License, or
136  *  (at your option) any later version.
137  *
138  *  This program is distributed in the hope that it will be useful,
139  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
140  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
141  *  GNU General Public License for more details.
142  *
143  *  You should have received a copy of the GNU General Public License along
144  *  with this program; if not, write to the Free Software Foundation, Inc.,
145  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
146  *
147  *  Contact:
148  *
149  *  Paul Willmott
150  *  vp9mu@amsat.org
151  */
152