SuperNOVAS v1.2
The NOVAS C library, made better
Loading...
Searching...
No Matches
solsys3.c File Reference

Functions

short earth_sun_calc (double jd_tdb, enum novas_planet body, enum novas_origin origin, double *position, double *velocity)
 
short earth_sun_calc_hp (const double jd_tdb[2], enum novas_planet body, enum novas_origin origin, double *position, double *velocity)
 
void enable_earth_sun_hp (int value)
 
short solarsystem (double jd_tdb, short body, short origin, double *position, double *velocity)
 
short solarsystem_hp (const double jd_tdb[2], short body, short origin, double *position, double *velocity)
 
int sun_eph (double jd, double *ra, double *dec, double *dis)
 

Detailed Description

Author
G. Kaplan and A. Kovacs

SuperNOVAS plane calculator functions for the Earth and Sun only, with an orbital model based on the DE405 ephemerides by JPL.

Based on the NOVAS C Edition, Version 3.1:

U. S. Naval Observatory
Astronomical Applications Dept.
Washington, DC
http://www.usno.navy.mil/USNO/astronomical-applications

See also
solarsystem.h
solsys-calceph.c
solsys-cspice.c
solsys-ephem.c

Function Documentation

◆ earth_sun_calc()

short earth_sun_calc ( double  jd_tdb,
enum novas_planet  body,
enum novas_origin  origin,
double *  position,
double *  velocity 
)

Provides the position and velocity of the Earth and Sun only at epoch 'jd_tdb' by evaluating a closed-form theory without reference to an external file. This function can also provide the position and velocity of the Sun.

REFERENCES:

  1. Kaplan, G. H. "NOVAS: Naval Observatory Vector Astrometry Subroutines"; USNO internal document dated 20 Oct 1988; revised 15 Mar 1990.
  2. Explanatory Supplement to The Astronomical Almanac (1992).
Parameters
jd_tdb[day] Barycentric Dynamical Time (TDB) based Julian date
bodyNOVAS_EARTH (3) or NOVAS_SUN (10) only.
originNOVAS_BARYCENTER (0) or NOVAS_HELIOCENTER (1) relative to which to return positions and velocities. (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
[out]position[AU] Position vector of 'body' at 'tjd'; equatorial rectangular coordinates in AU referred to the mean equator and equinox of J2000.0.
[out]velocity[AU/day] Velocity vector of 'body' at 'tjd'; equatorial rectangular system referred to the mean equator and equinox of J2000.0, in AU/Day.
Returns
0 if successful, -1 if there is a required function is not provided (errno set to ENOSYS) or if one of the output pointer arguments is NULL (errno set to EINVAL). 1 if the input Julian date ('tjd') is out of range, 2 if 'body' is invalid.
See also
earth_sun_calc_hp()
set_planet_provider()
solarsystem()
novas_planet_provider

References NOVAS_BARYCENTER, NOVAS_EARTH, NOVAS_PLANETS, NOVAS_SSB, NOVAS_SUN, precession(), radec2vector(), sun_eph(), T0, and TWOPI.

◆ earth_sun_calc_hp()

short earth_sun_calc_hp ( const double  jd_tdb[2],
enum novas_planet  body,
enum novas_origin  origin,
double *  position,
double *  velocity 
)

It may provide the position and velocity of the Earth and Sun, the same as solarsystem_earth_sun(), if enable_earth_sun_hp() is set to true (non-zero). Otherwise, it will return with an error code of 3, indicating that high-precision calculations are not provided by this implementation.

NOTES:

  1. This implementation will always propulate the output position and velocity vectors with the low-precision result, regardless of the return error code, in order to reduce the chance of unpredictable behavior, even if the user does not check the returned error status (which of course they should).
Parameters
jd_tdb[day] Barycentric Dynamical Time (TDB) based Julian date
bodyNOVAS_EARTH (3) or NOVAS_SUN (10) only.
originNOVAS_BARYCENTER (0) or NOVAS_HELIOCENTER (1) relative to which to return positions and velocities. (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
[out]position[AU] Position vector of 'body' at 'tjd'; equatorial rectangular coordinates in AU referred to the mean equator and equinox of J2000.0.
[out]velocity[AU/day] Velocity vector of 'body' at 'tjd'; equatorial rectangular system referred to the mean equator and equinox of J2000.0, in AU/Day.
Returns
0 if successful, -1 if there is a required function is not provided (errno set to ENOSYS), or if one of the output pointer arguments is NULL (errno set to EINVAL). 1 if the input Julian date ('tjd') is out of range, 2 if 'body' is invalid, or 3 if the high-precision orbital data cannot be produced (default return value).
See also
enable_earth_sun_hp()
earth_sun_calc()
set_planet_provider()
solarsystem_hp()
novas_planet_provider_hp

References earth_sun_calc().

◆ enable_earth_sun_hp()

void enable_earth_sun_hp ( int  value)

Specify whether the high-precision call is allowed to return a low-precision result. If set to 0 (false) solarsystem_earth_sun_hp() will return with an error code 3 indicating that a high-precision calculation is not possible. Otherise, a non-zero value (true) will let the function to be used without errors, returning the low-precison result of solarsystem_earth_sun() instead.

Parameters
value(boolean) A non-zero value enables the error-free use of the earth_sun_calc_hp() by allowing to return the low-precision result. Otherwise, earth_sun_calc_hp() will return an error code 3 indicating that the high-precision result is not available (this latter is the default behavior).
See also
earth_sun_calc_hp()

◆ solarsystem()

short solarsystem ( double  jd_tdb,
short  body,
short  origin,
double *  position,
double *  velocity 
)

A default implementation for regular (reduced) precision handling of major planets, Sun, Moon and the Solar-system barycenter. See DEFAULT_SOLSYS in Makefile to choose the implementation that is built into with the library as a default. Applications can define their own preferred implementations at runtime via set_planet_provider().

Since this is a function that may be provided by existing custom user implementations, we keep the original argument types for compatibility, hence 'short' instead of the more informative enums).

Parameters
jd_tdb[day] Barycentric Dynamical Time (TDB) based Julian date
bodyMajor planet number (or that for the Sun, Moon, or Solar-system Barycenter position), as defined by enum novas_planet, e.g. NOVAS_MARS (4), NOVAS_SUN (10) or NOVAS_SSB (0). (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
originNOVAS_BARYCENTER (0) or NOVAS_HELIOCENTER (1) relative to which to return positions and velocities. (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
[out]position[AU] Position vector of 'body' at 'tjd'; equatorial rectangular coordinates in AU referred to the mean equator and equinox of J2000.0.
[out]velocity[AU/day] Velocity vector of 'body' at 'tjd'; equatorial rectangular system referred to the mean equator and equinox of J2000.0, in AU/Day.
Returns
0 if successful, -1 if there is a required function is not provided (errno set to ENOSYS), 1 if the input Julian date ('tjd') is out of range, 2 if 'body' is invalid, or 3 if the ephemeris data cannot be produced for other reasons.
See also
novas_planet
solarsystem_hp()
set_planet_provider()
place()
ephemeris()

References earth_sun_calc().

◆ solarsystem_hp()

short solarsystem_hp ( const double  jd_tdb[2],
short  body,
short  origin,
double *  position,
double *  velocity 
)

A default implementation for high precision handling of major planets, Sun, Moon and the Solar-system barycenter. See DEFAULT_SOLSYS in Makefile to choose the implementation that is built into the library as a default. Applications can define their own preferred implementations at runtime via set_planet_provider_hp().

Since this is a function that may be provided by existing custom user implementations, we keep the original argument types for compatibility, hence 'short' instead of the more informative enums).

Parameters
jd_tdb[day] Barycentric Dynamical Time (TDB) based Julian date, broken into high and low order components, respectively. Typically, as the integer and fractional parts for the highest precision.
bodyMajor planet number (or that for the Sun, Moon, or Solar-system Barycenter position), as defined by enum novas_planet, e.g. NOVAS_MARS (4), NOVAS_SUN (10) or NOVAS_SSB (0). (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
originNOVAS_BARYCENTER (0) or NOVAS_HELIOCENTER (1) relative to which to return positions and velocities. (For compatibility with existing NOVAS C compatible user implementations, we keep the original NOVAS C argument type here).
[out]position[AU] Position vector of 'body' at 'tjd'; equatorial rectangular coordinates in AU referred to the mean equator and equinox of J2000.0.
[out]velocity[AU/day] Velocity vector of 'body' at 'tjd'; equatorial rectangular system referred to the mean equator and equinox of J2000.0, in AU/Day.
Returns
0 if successful, -1 if there is a required function is not provided (errno set to ENOSYS), or some other error code (NOVAS C was not very consistent here...)
See also
solarsystem()
set_planet_provider_hp()
place()
ephemeris()

References earth_sun_calc_hp().

◆ sun_eph()

int sun_eph ( double  jd,
double *  ra,
double *  dec,
double *  dis 
)

Computes equatorial spherical coordinates of Sun referred to the mean equator and equinox of date.

Quoted accuracy is 2.0 + 0.03 * T2 arcsec, where T is measured in units of 1000 years from J2000.0. See reference.

The obliquity equation is updated to equation 5.12 of the second reference.

The linear fit to DE405 primarily corrects for the difference between "old" (Lieske) and "new" (IAU 2006) precession. The difference, new - old, is -0.3004 arcsec/cy.

REFERENCES:

  1. Bretagnon, P. and Simon, J.L. (1986). Planetary Programs and Tables from -4000 to + 2800. (Richmond, VA: Willmann-Bell).
  2. Kaplan, G.H. (2005). US Naval Observatory Circular 179.
Parameters
jd[day] jd (double) Julian date on TDT or ET time scale.
[out]ra[h] Right ascension referred to mean equator and equinox of date (hours).
[out]dec[deg] Declination referred to mean equator and equinox of date (degrees).
[out]dis[AU] Geocentric distance (AU).
Returns
0 if successful, or else -1 if any of the pointer arguments are NULL.
See also
earth_sun_calc()

References ASEC2RAD, RAD2DEG, T0, and TWOPI.