Spacecraft Control Framework 1.0
Spacecraft Control Library
|
Time and data conversions and planetary movement, position, and eclipse computations. More...
Go to the source code of this file.
Functions | |
Time/Date functions | |
double | date_to_jd (const ml_matrix &dateTime) |
Converts date to jd. More... | |
double | jd_to_utc_secs (double jd) |
Converts Julian date to seconds since 00:00:00 January 1, 1970 (UTC) More... | |
double | utc_secs_to_jd (double secs) |
Converts seconds since 00:00:00 January 1, 1970 (UTC) to Julian date. More... | |
double | jd_to_jcent (double jd) |
Convert Julian date to Julian century. More... | |
double | jcent_to_jd (double jcent) |
Convert Julian century to Julian date. More... | |
double | jd_to_midnight (double jd) |
Round a Julian date value to the most recent midnight (0 hours) value. More... | |
double | gms_time (double jd) |
Get Greenwich Mean Sidereal time. More... | |
double | ms_day (double jd) |
Compute a mean sidereal (solar) day. More... | |
double | local_sidereal_time (double jd, double lon) |
Compute the local sidereal time for a given Julian date and longitude. More... | |
double | mean_sidereal_day (double jd) |
Mean sidereal day | |
ml_matrix | jd_to_date (double jd) |
Convert Julian date to date. More... | |
double | jd_to_day_number (double jd) |
Convert Julian date to day number More... | |
Star functions | |
ml_matrix | stellar_reduction (const ml_matrix &rA0, const ml_matrix &dec0, const ml_matrix &pMRA, const ml_matrix &pMDec, const ml_matrix ¶llax, const ml_matrix &rV, const ml_matrix &vSc, double jD) |
Stellar reduction. More... | |
void | earth_barycenter (const ml_matrix &jD, ml_matrix eB, ml_matrix eB_dot) |
Earth barycenter. More... | |
void | earth_barycenter (double jD, ml_matrix eB, ml_matrix eB_dot) |
ml_matrix | light_deflection (const ml_matrix &p, const ml_matrix &e) |
Light deflection. More... | |
ml_matrix | stellar_aberration (const ml_matrix &u, const ml_matrix &v) |
Stellar aberration. More... | |
Planetary functions | |
ml_matrix | meci_to_planet (double alpha0, double delta0, double w) |
Generate the ECI to Planet transformation matrix. More... | |
ml_matrix | meci_to_earth (double jD) |
Generate the ECI to eart transformation matrix. More... | |
ml_matrix | sun_vector (double jd, double &r) |
Generate the sun vector in the earth-centered inertial frame. More... | |
ml_matrix | sun_vector (double jd) |
ml_matrix | moon_vector (double jd, double &r) |
Generate the moon vector in the earth-centered inertial frame. More... | |
ml_matrix | true_earth (double jcent) |
Computes the matrix from mean of Aries 2000 to earth fixed frame. More... | |
ml_matrix | earth_pre (double jcent) |
Computes the earth precession matrix. More... | |
ml_matrix | earth_rot (double jcent) |
Computes the earth Greenwich matrix using GMST, that transforms from ECI to Earth-fixed. More... | |
ml_matrix | earth_rot_eq (double jcent) |
Computes the earth Greenwich matrix using apparent sidereal time. More... | |
ml_matrix | earth_nut (double jcent) |
The matrix that rotates from the mean axes to the true axes. More... | |
double | nut_delta (double j_cent, double &delta_eps) |
The changes in longitude and obliquity due to earth nutation. More... | |
double | ob_of_ecliptic (double jcent) |
Computes the mean obliquity of the ecliptic of date. More... | |
ml_matrix | c_ecl_to_eq (double jD) |
Transformation from eclipic to equatorial. More... | |
double | eq_of_equinoxes (double jcent) |
Computes the equation of the equinoxes. More... | |
double | eclipse_spice (const ml_matrix &pos, const ml_matrix &planet_radius, const ml_matrix &planet_position, const ml_matrix &planet_index, int observer) |
Compute eclipses using Spice data. More... | |
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. More... | |
double | earth_rate (double jd) |
Earth rotation rate. | |
ml_matrix | local_star_position (double jd, double lY) |
Local star positions. More... | |
ml_matrix | planet_ecliptic_to_orbit (int naif_code, double jd=JD_2000) |
Planet orbit rotation frame. More... | |
ml_matrix | planet_ecliptic_to_orbit (char *planet_name, double jd=JD_2000) |
Generates planet rotation frame. More... | |
Time and data conversions and planetary movement, position, and eclipse computations.
double date_to_jd | ( | const ml_matrix & | d | ) |
Converts date to jd.
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]);
d | Date vector (1x6) to be converted to Julian date. |
Referenced by jd_to_day_number().
double jd_to_utc_secs | ( | double | jd | ) |
Converts Julian date to seconds since 00:00:00 January 1, 1970 (UTC)
Converts Julian date to seconds since 00:00:00 January 1, 1970 (UTC)
jd | Julian date value to be converted to UTC seconds. |
References DAYS_TO_SECS, and JD_EPOCH.
double utc_secs_to_jd | ( | double | secs | ) |
Converts seconds since 00:00:00 January 1, 1970 (UTC) to Julian date.
secs | UTC seconds value to be converted to Julian date. |
References JD_EPOCH, and SECS_TO_DAYS.
double jd_to_jcent | ( | double | jd | ) |
Convert Julian date to Julian century.
Convert Julian date to Julian century.
jd | Julian date to be converted to Julian centuries. |
References DAYS_TO_CENTURIES, and JD_2000.
Referenced by b_dipole(), gravity_earth::compute_accel(), gms_time(), gps_eci_state_from_data(), mag_field(), meci_to_earth(), moon_vector(), ms_day(), orbit_closest_point(), r_ef_from_el(), and stellar_reduction().
double jcent_to_jd | ( | double | jcent | ) |
Convert Julian century to Julian date.
Convert Julian century to Julian date.
jcent | The Julian century value to be converted to Julian date. |
References CENTURIES_TO_DAYS, and JD_2000.
Referenced by earth_rot(), and earth_rot_eq().
double jd_to_midnight | ( | double | jd | ) |
Round a Julian date value to the most recent midnight (0 hours) value.
jd | The Julian date value to be rounded. |
Referenced by gms_time(), and ms_day().
double gms_time | ( | double | jd | ) |
Get Greenwich Mean Sidereal time.
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.
jd | Julian date at which to calculate the Greenwich Mean Sidereal time. |
References jd_to_jcent(), jd_to_midnight(), ms_day(), and SECS_TO_DAYS.
Referenced by earth_rot(), earth_rot_eq(), and local_sidereal_time().
double ms_day | ( | double | jd | ) |
Compute a mean sidereal (solar) day.
Compute a mean sidereal (solar) day.
Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. B6.
jd | Julian date value for which the mean sidereal day should be computed. |
References DAYS_TO_SECS, jd_to_jcent(), and jd_to_midnight().
Referenced by gms_time().
double local_sidereal_time | ( | double | jd, |
double | lon | ||
) |
Compute the local sidereal time for a given Julian date and longitude.
jd | Julian date |
lon | longitude |
References gms_time().
ml_matrix jd_to_date | ( | double | jd | ) |
Convert Julian date to date.
Convert Julian date to date.
jd | The Julian date value to be rounded. |
Referenced by jd_to_day_number().
double jd_to_day_number | ( | double | jd | ) |
Convert Julian date to day number
Convert Julian date to day number
jd | The Julian date value to be rounded. |
References date_to_jd(), and jd_to_date().
Referenced by AtmJ70::Update().
ml_matrix stellar_reduction | ( | const ml_matrix & | rA0, |
const ml_matrix & | dec0, | ||
const ml_matrix & | pMRA, | ||
const ml_matrix & | pMDec, | ||
const ml_matrix & | parallax, | ||
const ml_matrix & | rV, | ||
const ml_matrix & | vSc, | ||
double | jD | ||
) |
Stellar reduction.
Stellar reduction.
Includes corrections for
Astronomical Almanac for 1993, B39-B41
rA0 | Catalog right ascension |
dec0 | Catalog declination |
pMRA | Proper motion in right ascension |
pMDec | Proper motion in declination |
parallax | Stellar parallax |
rV | Radial velocity (km/sec) |
vSc | Spacecraft velocity vector (km/sec) |
jD | Julian date |
References earth_barycenter(), jd_to_jcent(), light_deflection(), ra_dec_to_u(), and stellar_aberration().
void earth_barycenter | ( | const ml_matrix & | jD, |
ml_matrix | eB, | ||
ml_matrix | eB_dot | ||
) |
Earth barycenter.
Earth barycenter.
jD | (1,:) Julian date |
References DEGREES_TO_RADIANS.
Referenced by stellar_reduction().
ml_matrix light_deflection | ( | const ml_matrix & | p, |
const ml_matrix & | e | ||
) |
Light deflection.
Light deflection.
p | (3,:) Vector from observing body to observed body |
e | (3,:) Vector from sun |
Siedelmann, P., (1992). Explanatory Supplement to the Astronomical Almanac, University Science Books, Mill Valley, CA, 136-137.
Referenced by stellar_reduction().
ml_matrix stellar_aberration | ( | const ml_matrix & | u, |
const ml_matrix & | v | ||
) |
Stellar aberration.
Stellar aberration.
u | (3,1) Unit position vector |
v | (3,1) Velocity vector divided by the speed of |
Siedelmann, P., (1992). Explanatory Supplement to the Astronomical Almanac, University Science Books, Mill Valley, CA, 129.
Referenced by stellar_reduction().
ml_matrix meci_to_planet | ( | double | alpha0, |
double | delta0, | ||
double | w | ||
) |
Generate the ECI to Planet transformation matrix.
Ref: Montenbruck, O., Pfleger, T., "Astronomy on the Personal Computer, Second Edition."
alpha0 | The right ascension of the planet's pole, measured in degrees. |
delta0 | The declination of the planet's pole, measured in degrees. |
w | The angle of rotation about the pole, measured in degrees. |
References DEGREES_TO_RADIANS.
Referenced by meci_to_earth().
ml_matrix meci_to_earth | ( | double | jD | ) |
Generate the ECI to eart transformation matrix.
Generate the ECI to eart transformation matrix.
Ref: Montenbruck, O., Pfleger, T., "Astronomy on the Personal Computer, Second Edition."
jD | Juilan date |
References jd_to_jcent(), and meci_to_planet().
ml_matrix sun_vector | ( | double | jd, |
double & | r | ||
) |
Generate the sun vector in the earth-centered inertial frame.
Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. C24.
jd | Julian date at which the sun vector is to be generated. |
r | Returns the distance from origin to sun in kms |
References DEGREES_TO_RADIANS, JD_2000, and REVS_TO_DEGREES.
Referenced by AlignThruster(), gravity_earth::compute_accel(), planetary_accelerations(), and AtmJ70::Update().
ml_matrix moon_vector | ( | double | jd, |
double & | r | ||
) |
Generate the moon vector in the earth-centered inertial frame.
Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. D46.
jd | Julian date at which to compute the moon vector. |
r | Returns the distance from origin to moon in kms |
References DEGREES_TO_RADIANS, jd_to_jcent(), RADIUS_EARTH, and REVS_TO_DEGREES.
Referenced by AlignThruster(), gravity_earth::compute_accel(), and planetary_accelerations().
ml_matrix true_earth | ( | double | jcent | ) |
Computes the matrix from mean of Aries 2000 to earth fixed frame.
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.
jcent | Julian century at which to compute the true earth matrix. |
References earth_nut(), earth_pre(), and earth_rot().
Referenced by gravity_earth::compute_accel(), eci_to_llr(), gps_eci_state_from_data(), orbit_closest_point(), and r_ef_from_el().
ml_matrix earth_pre | ( | double | jcent | ) |
Computes the earth precession matrix.
Ref: Seidelmann, The Explanatory Supplement to the Astronomical Almanac, p. 103.
jcent | The Julian century at which to compute the earth precession matrix. |
References DEGREES_TO_RADIANS.
Referenced by true_earth().
ml_matrix earth_rot | ( | double | jcent | ) |
Computes the earth Greenwich matrix using GMST, that transforms from ECI to Earth-fixed.
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.
jcent | Julian century at which to compute the earth Greenwich matrix. |
References DEGREES_TO_RADIANS, gms_time(), and jcent_to_jd().
Referenced by b_dipole(), mag_field(), and true_earth().
ml_matrix earth_rot_eq | ( | double | jcent | ) |
Computes the earth Greenwich matrix using apparent sidereal time.
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.
jcent | Julian century at which to compute the earth Greenwich matrix. |
References DEGREES_TO_RADIANS, eq_of_equinoxes(), gms_time(), and jcent_to_jd().
ml_matrix earth_nut | ( | double | jcent | ) |
The matrix that rotates from the mean axes to the true axes.
Ref: Seidelmann, P. K., The Explanatory Supplement to the Astronomical Almanac, p. 115.
jcent | The Julian century at which to calculate the matrix. |
References DEGREES_TO_RADIANS, nut_delta(), and ob_of_ecliptic().
Referenced by true_earth().
double nut_delta | ( | double | j_cent, |
double & | delta_eps | ||
) |
The changes in longitude and obliquity due to earth nutation.
Ref: Seidelmann, The Explanatory Supplement to the Astronomical Almanac
j_cent | Julian century from JD 2000 for which to compute the changes in longitude and obliquity. |
delta_eps | Returns the change in obliquity. |
References DEGREES_TO_RADIANS, and SECS_TO_HOURS.
Referenced by earth_nut(), and eq_of_equinoxes().
double ob_of_ecliptic | ( | double | jcent | ) |
Computes the mean obliquity of the ecliptic of date.
Ref: The 1993 Astronomical Almanac, U.S. Government Printing Office, p. B18.
jcent | The Julian century at which to compute the mean obliquity. |
Referenced by earth_nut(), and eq_of_equinoxes().
ml_matrix c_ecl_to_eq | ( | double | jD | ) |
Transformation from eclipic to equatorial.
Transformation from eclipic to equatorial.
If the jd is not input it will use the mean obliquity for J2000.0.
jD | (1,1) Julian date |
References PI.
Referenced by planet_ecliptic_to_orbit().
double eq_of_equinoxes | ( | double | jcent | ) |
Computes the equation of the equinoxes.
Ref: The Astronomical Almanac for the Year 1993, U.S. Government Printing Office, 1993, p. B6.
jcent | The Julian century at which to compute the mean obliquity. |
References DEGREES_TO_RADIANS, nut_delta(), and ob_of_ecliptic().
Referenced by earth_rot_eq().
double eclipse_spice | ( | const ml_matrix & | pos, |
const ml_matrix & | planet_radius, | ||
const ml_matrix & | planet_position, | ||
const ml_matrix & | planet_index, | ||
int | observer | ||
) |
Compute eclipses using Spice data.
Compute eclipses using Spice data.
It automatically determines the center from the observer input.
pos | (3,1) Position vector of the spacecraft |
planet_radius | (3,:) Planet radius |
planet_position | (3,:) Position vector of the planets |
planet_index | (1,:) Spice index for the radius and posiiton vectors |
observer | (1,1) Index of orbit center |
References eclipse().
double eclipse | ( | const ml_matrix & | pos, |
const ml_matrix & | l_pos, | ||
const ml_matrix & | p_pos, | ||
double | p_radius, | ||
double | l_radius | ||
) |
Compute eclipses.
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_radius | Radius of the planet causing the eclipse (default is the earth) |
l_radius | Radius of the light source (default is the sun) |
References PI.
Referenced by eclipse_spice().
ml_matrix local_star_position | ( | double | jd, |
double | lY | ||
) |
Local star positions.
Local star positions.
jd | Julian date |
lY | Light years from the sun |
References ra_dec_to_u().
ml_matrix planet_ecliptic_to_orbit | ( | int | naif_code, |
double | jD | ||
) |
Planet orbit rotation frame.
Planet orbit rotation frame.
naif_code | Code for planetary system |
jD | Julian day number |
References c_ecl_to_eq().
Referenced by planet_ecliptic_to_orbit().
ml_matrix planet_ecliptic_to_orbit | ( | char * | planet_name, |
double | jD | ||
) |
Generates planet rotation frame.
Uses get_naif_code() and planet_ecliptic_to_orbit().
planet_name | string form name |
jD | Julian day number |
References get_naif_code(), and planet_ecliptic_to_orbit().