Sun position
Sun position algorithm
sky0.h
Go to the documentation of this file.
1 #ifndef SKY0_H
2 #define SKY0_H
3 /*============================================================================*/
4 /*!\file
5  * \brief sky0.h - astronomical coordinate conversion for NREL Sun Position
6  * Algorithm
7  *
8  * \author David Hoadley
9  *
10  * \details
11  * This is one of three alternative modules: sky0.h / sky0.c,
12  * sky1.h / sky1.c and sky2.h / sky2.c. They contain routines for
13  * transforming astronomical positions from frame to another:
14  * precession, nutation, sidereal time etc. and they reflect changes
15  * in the International Astronomical Union's precession and nutation
16  * theory.
17  * The differences are:
18  * - sky0.h / sky0.c: nutation, obliquity and sidereal time routines
19  * from the NREL Solar Position Algorithm document. These are based
20  * on the IAU 1980 nutation theory.
21  * - sky1.h / sky1.c: precession, nutation and their associated
22  * rotation matrices, obliquity and sidereal time. These are the
23  * IAU 1980 precession and nutation theory.
24  * - sky2.h / sky2.c: precession, nutation and their associated
25  * rotation matrices, obliquity and sidereal time. These are the
26  * newer IAU 2000 precession and nutation theory.
27  *
28  * This module (sky0.h / sky0.c) contains only those routines necessary
29  * for supporting the NREL Solar Position Algorithm and Moon Position
30  * algorithms. Basically this is a subset of the routines in the
31  * sky1.h / sky1.c module. Precession is omitted, and the nutation
32  * routine uses only the largest 63 terms of the IAU 1980 nutation
33  * algorithm.
34  *
35  *==============================================================================
36  */
37 /*
38  * Copyright (c) 2020, David Hoadley <vcrumble@westnet.com.au>
39  * All rights reserved.
40  *
41  * Redistribution and use in source and binary forms, with or without
42  * modification, are permitted provided that the following conditions are met:
43  *
44  * * Redistributions of source code must retain the above copyright notice, this
45  * list of conditions and the following disclaimer.
46  * * Redistributions in binary form must reproduce the above copyright notice,
47  * this list of conditions and the following disclaimer in the documentation
48  * and/or other materials provided with the distribution.
49  *
50  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
51  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
54  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
55  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
56  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
57  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
58  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
59  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60  * POSSIBILITY OF SUCH DAMAGE.
61  */
62 /*------------------------------------------------------------------------------
63  * Notes:
64  * Character set: UTF-8. (Non-ASCII characters appear in this file)
65  *----------------------------------------------------------------------------*/
66 
67 #include "vectors3d.h"
68 
69 /*
70  * Global #defines and typedefs
71  */
72 /*! Nutation angles and obliquity */
73 typedef struct {
74  double dPsi_rad; //!< Nutation in longitude (Δψ) (radian)
75  double dEps_rad; //!< Nutation in obliquity (Δε) (radian)
76  double eps0_rad; //!< Mean obliquity of ecliptic at date (ε0)(radian)
77  double eqEq_rad; //!< Equation of the Equinoxes (radian)
78 } Sky0_Nut1980;
79 
80 
81 /*
82  * Global functions available to be called by other modules
83  */
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 
88 void sky0_nutationSpa(double t_cy, Sky0_Nut1980 *nut);
89 void sky0_epsilonSpa(double t_cy, Sky0_Nut1980 *nut);
90 
91 double sky0_gmSiderealTimeSpa(double du);
92 
93 void sky0_appToTirs(const V3D_Vector *appV,
94  double j2kUT1_d,
95  double eqEq_rad,
96  V3D_Vector *terInterV);
97 /*
98  * Global variables accessible by other modules
99  */
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* SKY0_H */
sky0_gmSiderealTimeSpa
double sky0_gmSiderealTimeSpa(double du)
Calculate the Greenwich mean sidereal time using the algorithm from the NREL SPA document.
Definition: sky0.c:392
sky0_nutationSpa
void sky0_nutationSpa(double t_cy, Sky0_Nut1980 *nut)
Calculates the nutation in longitude and obliquity, according to the algorithm set out in the NREL SP...
Definition: sky0.c:222
sky0_appToTirs
void sky0_appToTirs(const V3D_Vector *appV, double j2kUT1_d, double eqEq_rad, V3D_Vector *terInterV)
Convert a position in geocentric apparent coordinates to geocentric coordinates in the Terrestrial In...
Definition: sky0.c:432
Sky0_Nut1980::dPsi_rad
double dPsi_rad
Nutation in longitude (Δψ) (radian)
Definition: sky0.h:74
Sky0_Nut1980::dEps_rad
double dEps_rad
Nutation in obliquity (Δε) (radian)
Definition: sky0.h:75
sky0_epsilonSpa
void sky0_epsilonSpa(double t_cy, Sky0_Nut1980 *nut)
Calculate the obliquity of the ecliptic and the equation of the equinoxes.
Definition: sky0.c:334
V3D_Vector
3x1 vector.
Definition: vectors3d.h:57
Sky0_Nut1980::eps0_rad
double eps0_rad
Mean obliquity of ecliptic at date (ε0)(radian)
Definition: sky0.h:76
Sky0_Nut1980
Nutation angles and obliquity.
Definition: sky0.h:73
vectors3d.h
vectors3d.h - Three dimensional geometry, vectors and matrices
Sky0_Nut1980::eqEq_rad
double eqEq_rad
Equation of the Equinoxes (radian)
Definition: sky0.h:77