Sun position
Sun position algorithm
moon.h
Go to the documentation of this file.
1 #ifndef MOON_H
2 #define MOON_H
3 /*============================================================================*/
4 /*!\file
5  * \brief moon.h - routines to calculate the Moon's position
6  *
7  * \author David Hoadley
8  *
9  * \details
10  * An implementation of the SAMPA (Moon Position Algorithm) from the
11  * National Renewable Energy Laboratory
12  *
13  * Rectangular coordinates are used wherever possible, to minimise the
14  * unnecessary recalculation of trigonometric functions.
15  * \par Reference:
16  * Reda, I., _Solar Eclipse Monitoring for Solar Energy Applications
17  * Using the Solar and Moon Position Algorithms_. National Renewable
18  * Energy Laboratory Technical Report NREL/TP-3B0-47681, March 2010
19  *
20  *==============================================================================
21  */
22 /*
23  * Copyright (c) 2020, David Hoadley <vcrumble@westnet.com.au>
24  * All rights reserved.
25  *
26  * Redistribution and use in source and binary forms, with or without
27  * modification, are permitted provided that the following conditions are met:
28  *
29  * * Redistributions of source code must retain the above copyright notice, this
30  * list of conditions and the following disclaimer.
31  * * Redistributions in binary form must reproduce the above copyright notice,
32  * this list of conditions and the following disclaimer in the documentation
33  * and/or other materials provided with the distribution.
34  *
35  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
39  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
40  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
43  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45  * POSSIBILITY OF SUCH DAMAGE.
46  */
47 #include "sky.h"
48 #include "sky0.h"
49 #include "vectors3d.h"
50 
51 /*
52  * Global #defines and typedefs
53  */
54 
55 /*
56  * Global functions available to be called by other modules
57  */
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 void moon_nrelApp2(double t_cy,
63  const Sky0_Nut1980 *nut,
64  V3D_Vector *appV,
65  double *dist_au);
66 void moon_nrelApparent(double j2kTT_cy, Sky_TrueEquatorial *pos);
67 void moon_nrelTopocentric(double j2kdUtc,
68  const Sky_DeltaTs *deltas,
69  const Sky_SiteProp *site,
70  Sky_SiteHorizon *topo);
71 
72 double moon_riseSet(int year,
73  int month,
74  int day,
75  bool getMoonrise,
76  const Sky_DeltaTs *deltas,
77  const Sky_SiteProp *site,
78  Sky_SiteHorizon *topo);
79 
80 /*
81  * Global variables accessible by other modules
82  */
83 /* (none) */
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* MOON_H */
90 
moon_nrelApparent
void moon_nrelApparent(double j2kTT_cy, Sky_TrueEquatorial *pos)
Calculate the Moon's position as a unit vector and a distance, in apparent coordinates.
Definition: moon.c:223
Sky_DeltaTs
This structure contains relatively constant data, and is set up by one of the three functions sky_ini...
Definition: sky.h:166
Sky_TrueEquatorial
Struct used for holding an object's coordinates in equatorial apparent or Intermediate coordinates.
Definition: sky.h:106
moon_riseSet
double moon_riseSet(int year, int month, int day, bool getMoonrise, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo)
Routine to calculate the time of moonrise or moonset for the day specified by year,...
Definition: moon.c:316
Sky_SiteProp
Site properties.
Definition: sky.h:315
moon_nrelApp2
void moon_nrelApp2(double t_cy, const Sky0_Nut1980 *nut, V3D_Vector *appV, double *dist_au)
Calculates the Moon's position in geocentric apparent coordinates, using the NREL Moon Position Algor...
Definition: moon.c:143
V3D_Vector
3x1 vector.
Definition: vectors3d.h:57
moon_nrelTopocentric
void moon_nrelTopocentric(double j2kdUtc, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo)
Calls moon_nrelApparent() to calculate the Moon's position in apparent coordinates using the NREL Moo...
Definition: moon.c:278
Sky0_Nut1980
Nutation angles and obliquity.
Definition: sky0.h:73
sky.h
sky.h - structures and routines for astronomical observing & tracking
vectors3d.h
vectors3d.h - Three dimensional geometry, vectors and matrices
sky0.h
sky0.h - astronomical coordinate conversion for NREL Sun Position Algorithm
Sky_SiteHorizon
Coordinates of a celestial object in the horizon frame, in both rectangular and polar forms.
Definition: sky.h:129