Loading...
Searching...
No Matches
solsys3.c File Reference

Planet calculator functions for the Earth and Sun only, with an orbital model fitted to the DE405 ephemerides by JPL. More...

## Functions

short | earth_sun_calc (double jd_tdb, enum novas_planet body, enum novas_origin origin, double *restrict position, double *restrict 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.
short | earth_sun_calc_hp (const double jd_tdb[restrict 2], enum novas_planet body, enum novas_origin origin, double *restrict position, double *restrict velocity)
| It may provide the position and velocity of the Earth and Sun, the same as earth_sun_calc(), if enable_earth_sun_hp() is set to true (non-zero).
void | enable_earth_sun_hp (int value)
| Specify whether the high-precision call is allowed to return a low-precision result.
int | sun_eph (double jd, double *restrict ra, double *restrict dec, double *restrict dis)
| Computes equatorial spherical coordinates of Sun referred to the mean equator and equinox of date.

## Detailed Description

Planet calculator functions for the Earth and Sun only, with an orbital model fitted to the DE405 ephemerides by JPL.

This function is suitable for calculating the positions of Earth and the Sun around the Solar-system Barycenter (SSB) with a typical accutacy of around 10 arcseconds within a few centuries of J2000.

It is inherently similar, at least in accuracy, to the planetary orbital models provided by planets.c, except that it can be used more widely in SuperNOVAS internally by the various functions, which need Earth and/or Sun positions for their calculations.

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

Author
  G. Kaplan and Attila Kovacs

See also
  ephemeris.c, planets.c, 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 *restrict | position,
|  | double *restrict | 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
  | body | NOVAS_EARTH (3) or NOVAS_SUN (10) only.
  | origin | NOVAS_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(), novas_planet_provider

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

Referenced by earth_sun_calc_hp().

## earth_sun_calc_hp()

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

It may provide the position and velocity of the Earth and Sun, the same as earth_sun_calc(), 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
  | body | NOVAS_EARTH (3) or NOVAS_SUN (10) only.
  | origin | NOVAS_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_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-precision 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()

## sun_eph()

int sun_eph | ( | double | jd,
|  | double *restrict | ra,
|  | double *restrict | dec,
|  | double *restrict | 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 TWOPI.

Referenced by earth_sun_calc().