Sun position
Sun position algorithm
|
sun.h - routines to calculate the Sun's position More...
Go to the source code of this file.
Functions | |
void | sun_aaApparentApprox (double n, V3D_Vector *appV, double *dist_au) |
This function calculates an approximate Sun position in apparent coordinates using the algorithm given in the Astronomical Almanac. More... | |
void | sun_nrelApp2 (double t_cy, const Sky0_Nut1980 *nut, V3D_Vector *appV, double *dist_au) |
This function calculates the Sun position in apparent coordinates, using the NREL SPA algorithm (see reference). More... | |
void | sun_nrelApparent (double j2kTT_cy, Sky_TrueEquatorial *pos) |
Calculate the Sun's position as a unit vector and a distance, in apparent coordinates. More... | |
void | sun_nrelTopocentric (double j2kUtc_d, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo) |
Calls sun_nrelApparent() to calculate the Sun's position in apparent coordinates using the NREL Sun Position Algorithm, and then converts this to topocentric horizon coordinates at the specified site. More... | |
double | sun_solarNoon (int year, int month, int day, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo) |
Routine to calculate the time of solar noon (Sun transit) for the day specified by year, month and day. More... | |
double | sun_riseSet (int year, int month, int day, bool getSunrise, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo) |
Routine to calculate the time of sunrise or sunset for the day specified by year, month and day. More... | |
sun.h - routines to calculate the Sun's position
Alternative routines which calculate the sun's position with differing levels of accuracy. The alternatives are
Rectangular coordinates are used wherever possible, to minimise the unnecessary recalculation of trigonometric functions.
Definition in file sun.h.
void sun_aaApparentApprox | ( | double | n, |
V3D_Vector * | appV, | ||
double * | dist_au | ||
) |
This function calculates an approximate Sun position in apparent coordinates using the algorithm given in the Astronomical Almanac.
The quoted accuracy is a precision of 0.01 degrees between 1950 and 2050.
[in] | n | Days since J2000.0, UT1 timescale |
[out] | appV | Position vector of Sun in apparent coordinates (unit vector i.e. direction cosines) |
[out] | dist_au | Geocentric distance of the Sun (Astronomical Units) |
void sun_nrelApp2 | ( | double | t_cy, |
const Sky0_Nut1980 * | nut, | ||
V3D_Vector * | appV, | ||
double * | dist_au | ||
) |
This function calculates the Sun position in apparent coordinates, using the NREL SPA algorithm (see reference).
The quoted accuracy of this algorithm os 0.0003° (or about 1 arcsecond). It is much more computationally intensive than the approximate algorithm from the Astronomical Almanac implemented by the routine sun_aaApparentApprox().
[in] | t_cy | Julian centuries since J2000.0, TT timescale |
[in] | nut | Nutation terms and obliquity of the ecliptic, as returned by functions sky0_nutationSpa() and sky0_epsilonSpa(). |
[out] | appV | Position vector of Sun in apparent coordinates (unit vector i.e. direction cosines) |
[out] | dist_au | Geocentric distance of the Sun (Astronomical Units) |
void sun_nrelApparent | ( | double | j2kTT_cy, |
Sky_TrueEquatorial * | pos | ||
) |
Calculate the Sun's position as a unit vector and a distance, in apparent coordinates.
It calls sun_nrelApp2() to obtain the Sun's position, after having called sky0_nutationSpa() to obtain the necessary nutation terms.
[in] | j2kTT_cy | Julian centuries since J2000.0, TT timescale |
[out] | pos | Timestamped structure containing position data and the equation of the equinoxes |
void sun_nrelTopocentric | ( | double | j2kUtc_d, |
const Sky_DeltaTs * | deltas, | ||
const Sky_SiteProp * | site, | ||
Sky_SiteHorizon * | topo | ||
) |
Calls sun_nrelApparent() to calculate the Sun's position in apparent coordinates using the NREL Sun Position Algorithm, and then converts this to topocentric horizon coordinates at the specified site.
[in] | j2kUtc_d | UTC time in "J2KD" form - i.e days since J2000.0 (= JD - 2 451 545.0) |
[in] | deltas | Delta T values, as set by the sky_initTime() (or sky_initTimeSimple() or sky_initTimeDetailed()) routines |
[in] | site | Properties of the observing site, particularly its geometric location on the surface of the Earth, as set by the sky_setSiteLocation() function (or sky_setSiteLoc2()) |
[out] | topo | Topocentric position, in both rectangular (unit vector) form, and as Azimuth and Elevation (altitude) angles |
double sun_solarNoon | ( | int | year, |
int | month, | ||
int | day, | ||
const Sky_DeltaTs * | deltas, | ||
const Sky_SiteProp * | site, | ||
Sky_SiteHorizon * | topo | ||
) |
Routine to calculate the time of solar noon (Sun transit) for the day specified by year, month and day.
This function uses the NREL SPA algorithm of sun_nrelTopocentric() to calculate the Sun's position.
[in] | year,month,day | Date for which solar noon is desired |
[in] | deltas | Delta T values, as set by the sky_initTime() (or sky_initTimeSimple() or sky_initTimeDetailed()) routines |
[in] | site | Properties of the observing site, particularly its geometric location on the surface of the Earth and its time zone, as set by the sky_setSiteLocation() function (or sky_setSiteLoc2()) |
[out] | topo | Optional. Topocentric position of the Sun at transit, in both rectangular (unit vector) form, and as Azimuth and Elevation (altitude) angles. If you are not interested in these values, you can pass NULL to this parameter. |
This routine uses an iterative approach. Two iterations is all that is needed to get a result within about 0.05 seconds.
double sun_riseSet | ( | int | year, |
int | month, | ||
int | day, | ||
bool | getSunrise, | ||
const Sky_DeltaTs * | deltas, | ||
const Sky_SiteProp * | site, | ||
Sky_SiteHorizon * | topo | ||
) |
Routine to calculate the time of sunrise or sunset for the day specified by year, month and day.
This function uses the NREL SPA algorithm of sun_nrelTopocentric() to calculate the Sun's position.
[in] | year,month,day | Date for which sunrise or sunset time is desired |
[in] | getSunrise | If true, get sunrise time. If false, get sunset time |
[in] | deltas | Delta T values, as set by the sky_initTime() (or sky_initTimeSimple() or sky_initTimeDetailed()) routines |
[in] | site | Properties of the observing site, particularly its geometric location on the surface of the Earth and its time zone, as set by the sky_setSiteLocation() function (or sky_setSiteLoc2()) and sky_setSiteTimeZone(). |
[out] | topo | Optional. Topocentric position of the Sun at rise or set, in both rectangular (unit vector) form, and as Azimuth and Elevation (altitude) angles. If you are not interested in these values, you can pass NULL to this parameter. |
This routine uses an iterative approach. It does two iterations.