Functions

sc_ephemeris.h File Reference

Time and data conversions and planetary movement, position, and eclipse computations. More...

Functions

double date_to_jd (const ml_matrix &dateTime)
 Converts date to jd.
double jd_to_utc_secs (double jd)
 Converts Julian date to seconds since 00:00:00 January 1, 1970 (UTC)
double utc_secs_to_jd (double secs)
 Converts seconds since 00:00:00 January 1, 1970 (UTC) to Julian date.
double jd_to_jcent (double jd)
 Convert Julian date to Julian century.
double jcent_to_jd (double jcent)
 Convert Julian century to Julian date.
double jd_to_midnight (double jd)
 Round a Julian date value to the most recent midnight (0 hours) value.
double gms_time (double jd)
 Get Greenwich Mean Sidereal time.
double ms_day (double jd)
 Compute a mean sidereal (solar) day.
double local_sidereal_time (double jd, double lon)
 Compute the local sidereal time for a given Julian date and longitude.
double mean_sidereal_day (double jd)
 Mean sidereal day.
ml_matrix jd_to_date (double jd)
 Convert Julian date to date.
double jd_to_day_number (double jd)
 Convert Julian date to day number.
ml_matrix meci_to_planet (double alpha0, double delta0, double w)
 Generate the ECI to Planet transformation matrix.
ml_matrix sun_vector (double jd, double &r)
 Generate the sun vector in the earth-centered inertial frame.
ml_matrix sun_vector (double jd)
ml_matrix moon_vector (double jd, double &r)
 Generate the moon vector in the earth-centered inertial frame.
ml_matrix true_earth (double jcent)
 Computes the matrix from mean of Aries 2000 to earth fixed frame.
ml_matrix earth_pre (double jcent)
 Computes the earth precession matrix.
ml_matrix earth_rot (double jcent)
 Computes the earth Greenwich matrix using GMST, that transforms from ECI to Earth-fixed.
ml_matrix earth_rot_eq (double jcent)
 Computes the earth Greenwich matrix using apparent sidereal time.
ml_matrix earth_nut (double jcent)
 The matrix that rotates from the mean axes to the true axes.
double nut_delta (double j_cent, double &delta_eps)
 The changes in longitude and obliquity due to earth nutation.
double ob_of_ecliptic (double jcent)
 Computes the mean obliquity of the ecliptic of date.
ml_matrix c_ecl_to_eq (double jD)
 Transformation from eclipic to equatorial.
double eq_of_equinoxes (double jcent)
 Computes the equation of the equinoxes.
double eclipse (const ml_matrix &pos, const ml_matrix &l_pos, const ml_matrix &p_pos, double p_radius=RADIUS_EARTH, double l_radius=RADIUS_SUN)
 Compute eclipses.
double earth_rate (double jd)
 Earth rotation rate.
ml_matrix local_star_position (double jd, double lY)
 Local star positions.
ml_matrix planet_ecliptic_to_orbit (int naif_code, double jd=JD_2000)
 Planet orbit rotation frame.
ml_matrix planet_ecliptic_to_orbit (char *planet_name, double jd=JD_2000)
 Generates planet rotation frame.

Detailed Description


Function Documentation

double date_to_jd ( const ml_matrix &  d )

Converts date to jd.

The date vector is in the form [year month day hours minutes seconds] where all values should be integers except seconds which may be a double. If any columns of datetime are omitted they will be set to zero, as appropriate, with a default date of Jan 1, 2000 at 00:00.

Examples: jD = date_to_jd([2009]); // assumes January 1 at 0:00 jD = date_to_jd([2009 4 11]); jD = date_to_jd([2009 4 11 13 45]); jD = date_to_jd([2009 4 11 13 45 15.146]);

Parameters:
datetimeDate vector (1x6) to be converted to Julian date.
Returns:
Returns the Julian date equivalent of the given calendar date.
double jd_to_utc_secs ( double  jd )

Converts Julian date to seconds since 00:00:00 January 1, 1970 (UTC)

Parameters:
jdJulian date value to be converted to UTC seconds.
Returns:
Returns the UTC seconds value for a given Julian date.

References DAYS_TO_SECS, and JD_EPOCH.

double utc_secs_to_jd ( double  secs )
Parameters:
secsUTC seconds value to be converted to Julian date.
Returns:
Returns the Julian date equivalent of the given UTC value.

References JD_EPOCH, and SECS_TO_DAYS.

double jd_to_jcent ( double  jd )

Convert Julian date to Julian century.

Parameters:
jdJulian date to be converted to Julian centuries.
Returns:
Returns the Julian century equivalent of the given Julian date.

References DAYS_TO_CENTURIES, and JD_2000.

double jcent_to_jd ( double  jcent )

Convert Julian century to Julian date.

Parameters:
jcentThe Julian century value to be converted to Julian date.
Returns:
Returns the Julian date equivalent of the given Julian century.

References CENTURIES_TO_DAYS, and JD_2000.

double jd_to_midnight ( double  jd )
Parameters:
jdThe Julian date value to be rounded.
Returns:
Returns the most recent midnight Julian date.
double gms_time ( double  jd )

Get Greenwich Mean Sidereal time.

Gives the angle between the Greenwich Meridian and the Vernal Equinox (the x-axis in the ECI frame). This does not account for Earth nutation. Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. B6.

Parameters:
jdJulian date at which to calculate the Greenwich Mean Sidereal time.
Returns:
Returns the Greenwich Mean Sidereal time in degrees

References SECS_TO_DAYS.

double ms_day ( double  jd )

Compute a mean sidereal (solar) day.

Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. B6.

Parameters:
jdJulian date value for which the mean sidereal day should be computed.
Returns:
Returns the mean sidereal day at the given Julian date.

References DAYS_TO_SECS.

double local_sidereal_time ( double  jd,
double  lon 
)
Parameters:
jdJulian date
lonlongitude
Returns:
local sidereal time
ml_matrix jd_to_date ( double  jd )

Convert Julian date to date.

Parameters:
jdThe Julian date value to be rounded.
Returns:
[year month day minutes hours seconds]
double jd_to_day_number ( double  jd )

Convert Julian date to day number.

Parameters:
jdThe Julian date value to be rounded.
Returns:
Day number
ml_matrix meci_to_planet ( double  alpha0,
double  delta0,
double  w 
)

Ref: Montenbruck, O., Pfleger, T., "Astronomy on the Personal Computer, Second Edition."

Parameters:
alpha0The right ascension of the planet's pole, measured in degrees.
delta0The declination of the planet's pole, measured in degrees.
wThe angle of rotation about the pole, measured in degrees.
Returns:
The transformation matrix from the ECI frame to the planet-fixed frame

References DEGREES_TO_RADIANS.

ml_matrix sun_vector ( double  jd,
double &  r 
)

Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. C24.

Parameters:
jdJulian date at which the sun vector is to be generated.
rReturns the distance from origin to sun in kms
Returns:
Returns the sun vector at a given Julian date

References DEGREES_TO_RADIANS, JD_2000, and REVS_TO_DEGREES.

ml_matrix moon_vector ( double  jd,
double &  r 
)

Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. D46.

Parameters:
jdJulian date at which to compute the moon vector.
rReturns the distance from origin to moon in kms
Returns:
Returns the moon vector at the given date.

References DEGREES_TO_RADIANS, RADIUS_EARTH, and REVS_TO_DEGREES.

ml_matrix true_earth ( double  jcent )

Calls earth_rot, earth_nut, and earth_pre in sequence.

B = B_rot*B_nut*B_pre

Ref: Seidelmann, The Explanatory Supplement to the Astronomical Almanac, p. 20.

Parameters:
jcentJulian century at which to compute the true earth matrix.
Returns:
Returns the matrix from mean of Aries 2000 to earth fixed frame.
ml_matrix earth_pre ( double  jcent )

Ref: Seidelmann, The Explanatory Supplement to the Astronomical Almanac, p. 103.

Parameters:
jcentThe Julian century at which to compute the earth precession matrix.
Returns:
Returns the earth precession matrix.

References DEGREES_TO_RADIANS.

ml_matrix earth_rot ( double  jcent )

Computes the earth Greenwich matrix using GMST, that transforms from ECI to Earth-fixed.

Equivalent to a rotation about the Z axis by the Greenwich mean sidereal time (GMST). Ref: Seidelmann, P. K., The Explanatory Supplement to the Astronomical Almanac, p. 20.

Parameters:
jcentJulian century at which to compute the earth Greenwich matrix.
Returns:
Returns the earth Greenwich matrix that transforms from ECI to earth-fixed.

References DEGREES_TO_RADIANS.

ml_matrix earth_rot_eq ( double  jcent )

Computes the earth Greenwich matrix using apparent sidereal time.

Equivalent to a rotation about the Z axis by the Greenwich apparent sidereal time (GAST). Ref: Seidelmann, P. K., The Explanatory Supplement to the Astronomical Almanac, p. 20.

Parameters:
jcentJulian century at which to compute the earth Greenwich matrix.
Returns:
Returns the earth Greenwich matrix that transforms from ECI to earth-fixed.

References DEGREES_TO_RADIANS.

ml_matrix earth_nut ( double  jcent )

Ref: Seidelmann, P. K., The Explanatory Supplement to the Astronomical Almanac, p. 115.

Parameters:
jcentThe Julian century at which to calculate the matrix.
Returns:
Returns the matrix that rotates from the mean axes to the true axes.

References DEGREES_TO_RADIANS.

double nut_delta ( double  j_cent,
double &  delta_eps 
)

Ref: Seidelmann, The Explanatory Supplement to the Astronomical Almanac

Parameters:
j_centJulian century from JD 2000 for which to compute the changes in longitude and obliquity.
delta_epsReturns the change in obliquity.
Returns:
Returns delta_psi, the change in longitude.

References DEGREES_TO_RADIANS, and SECS_TO_HOURS.

double ob_of_ecliptic ( double  jcent )

Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. B18.

Parameters:
jcentThe Julian century at which to compute the mean obliquity.
Returns:
Returns the mean obliquity of the ecliptic of date.
ml_matrix c_ecl_to_eq ( double  jD )

Transformation from eclipic to equatorial.

If the jd is not input it will use the mean obliquity for J2000.0.

Parameters:
jD(1,1) Julian date
Returns:
Transformation matrix from the ecliptic plane

References PI.

double eq_of_equinoxes ( double  jcent )

Ref: The Astronomical Almanac for the Year 1993, U.S. Government Printing Office, 1993, p. B6.

Parameters:
jcentThe Julian century at which to compute the mean obliquity.
Returns:
Returns the mean obliquity of the ecliptic of date.

References DEGREES_TO_RADIANS.

double eclipse ( const ml_matrix &  pos,
const ml_matrix &  l_pos,
const ml_matrix &  p_pos,
double  p_radius,
double  l_radius 
)
Parameters:
pos(3,1) Position vector of the spacecraft
l_pos(3,1) Position vector of the light source
p_pos(3,1) Position vector of the planet causing the eclipse
p_radiusRadius of the planet causing the eclipse (default is the earth)
l_radiusRadius of the light source (default is the sun)
Returns:
Normalized source intensity

References PI.

ml_matrix local_star_position ( double  jd,
double  lY 
)

Local star positions.

Parameters:
jdJulian date
lYLight years from the sun
Returns:
Star matrix in light years
ml_matrix planet_ecliptic_to_orbit ( int  naif_code,
double  jD 
)

Planet orbit rotation frame.

Parameters:
naif_codeCode for planetary system
jdJulian day number
Returns:
Rotation matrix
ml_matrix planet_ecliptic_to_orbit ( char *  planet_name,
double  jD 
)
Parameters:
namestring form name
jdJulian day number
Returns:
Rotation matrix