Sun position
Sun position algorithm
|
star.h - Astronomical conversion routines for stars and other objects beyond the Solar System More...
Go to the source code of this file.
Data Structures | |
struct | Star_CatalogPosn |
Catalogue position of a celestial object. More... | |
Enumerations | |
enum | Star_CoordSys { APPARENT, INTERMEDIATE, FK4, FK5, ICRS } |
Coordinate system equator and origin. More... | |
enum | Star_CoordErrors { STAR_NORMAL, STAR_IVEPOCH, STAR_ERRINOBJ, STAR_NORA, STAR_ERRINRA, STAR_RARANERR, STAR_NODEC, STAR_ERRINDEC, STAR_DECRANERR, STAR_ERRINMURA, STAR_ERRINMUDEC, STAR_NOMUDEC, STAR_NOMURA, STAR_ERRINPARAL, STAR_PINEEDSPM, STAR_ERRINVR, STAR_VRNEEDSPM } |
Errors detected when decoding a text coordinate string or when filling a block of type Star_CatalogPosn with numerical data. More... | |
Functions | |
void | star_setCurrentObject (const Star_CatalogPosn *c) |
Copies the catalogue information in c to internal storage for later use by star_getApparent() More... | |
void | star_catalogToApp (const Star_CatalogPosn *c, double j2kTT_cy, const Sky1_Nut1980 *nut, V3D_Vector *appV, double *dist_au) |
Convert the catalogue coordinates for a star (or other object outside the Solar System) to apparent coordinates at time j2kTT_cy. More... | |
void | star_getApparent (double j2kTT_cy, Sky_TrueEquatorial *pos) |
Calculate the position of the currently selected star (or other object outside the solar system) as a unit vector and a distance, in apparent coordinates. More... | |
void | star_getTopocentric (double j2kUtc_d, const Sky_DeltaTs *deltas, const Sky_SiteProp *site, Sky_SiteHorizon *topo) |
Calls star_getApparent() to calculate the star's position in apparent coordinates, and then converts this to topocentric horizon coordinates at the specified site. More... | |
int | star_setCatalogPosn (const char objectName[], double ra_h, double dec_deg, Star_CoordSys coordSys, double equinoxYear, double epochYear, double muRaSplat_maspa, double muDec_maspa, double annParallax_as, double radVel_kmps, Star_CatalogPosn *coordBlock) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn. More... | |
int | star_setCatalogOldStyle (const char objectName[], double ra_h, double dec_deg, Star_CoordSys coordSys, double equinoxYear, double epochYear, double muRa_spcy, double muDec_aspcy, double annParallax_as, double radVel_kmps, Star_CatalogPosn *coordBlock) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn. More... | |
int | star_parseCoordString (const char inStr[], Star_CatalogPosn *coordBlock) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn. More... | |
void | star_catalogToVectors (const Star_CatalogPosn *c, V3D_Vector *pV, V3D_Vector *vV_radpcy) |
This routine takes the mean equatorial polar coordinate of an object and its proper motions, annual parallax (distance) and radial velocity, and computes the rectangular position and velocity vectors with respect to the same coordinate system. More... | |
void | star_earth (double t1_cy, const V3D_Matrix *npM, V3D_Vector *ebV_au, V3D_Vector *ebdotV_aupd, V3D_Vector *sbV_au) |
Calculate the position and velocity of the Earth, for use in making annual parallax and aberration corrections. More... | |
void | star_annAberr (const V3D_Vector *p1V, const V3D_Vector *earthVelV_aupd, V3D_Vector *p2V) |
Apply the annual aberration correction, to convert an object's coordinates from geocentric geometric direction to "proper" direction (still geocentric) More... | |
char * | star_equinoxToStr (const Star_CatalogPosn *coordBlock, char equinoxStr[], size_t eqnxStrSize) |
Write the coordinate system and equinox out in a standard form. More... | |
char * | star_epochToStr (const Star_CatalogPosn *coordBlock, char epochStr[], size_t epochStrSize) |
Write the epoch used for proper motion calculations out in a standard form. More... | |
star.h - Astronomical conversion routines for stars and other objects beyond the Solar System
Routines to convert a celestial object's catalogue position (as seen from the Solar System Barycentre) to a geocentric apparent position (as seen from the centre of the Earth). This means
The geocentric position calculated is then converted from the coordinate system of the catalogue position to apparent coordinates. (Exception: if the catalogue position is already in Celestial Intermediate coordinates, then the resulting vector will still be in Celestial Intermediate coordinates.)
Definition in file star.h.
enum Star_CoordSys |
enum Star_CoordErrors |
Errors detected when decoding a text coordinate string or when filling a block of type Star_CatalogPosn with numerical data.
void star_setCurrentObject | ( | const Star_CatalogPosn * | c | ) |
Copies the catalogue information in c to internal storage for later use by star_getApparent()
[in] | c | The catalogue information for the star, as set by one of the three functions star_parseCoordString(), star_setCatalogPosn() or star_setCatalogOldStyle(). |
void star_catalogToApp | ( | const Star_CatalogPosn * | c, |
double | j2kTT_cy, | ||
const Sky1_Nut1980 * | nut, | ||
V3D_Vector * | appV, | ||
double * | dist_au | ||
) |
Convert the catalogue coordinates for a star (or other object outside the Solar System) to apparent coordinates at time j2kTT_cy.
[in] | c | Catalogue position and motion of object, as set by one of the three functions star_parseCoordString(), star_setCatalogPosn() or star_setCatalogOldStyle(). |
[in] | j2kTT_cy | Julian centuries since J2000.0, TT timescale |
[in] | nut | Nutation angles and obliquity of the ecliptic at time j2kTT_cy, as returned by functions sky1_nutationIAU1980() and sky1_epsilon1980() |
[out] | appV | Unit vector of geocentric apparent direction of object, referred to the true equator and equinox at time (j2kTT_cy) |
[out] | dist_au | Distance to object (AU) as derived from c->parallax_rad. |
This routine is simplified, in that:
void star_getApparent | ( | double | j2kTT_cy, |
Sky_TrueEquatorial * | pos | ||
) |
Calculate the position of the currently selected star (or other object outside the solar system) as a unit vector and a distance, in apparent coordinates.
It calls star_catalogToApp() to obtain the star's position, after having called sky1_nutationIAU1980() and sky1_epsilon1980() to obtain the necessary nutation terms.
The star whose coordinates are obtained with this function is the star most recently specified with star_setCurrentObject()
[in] | j2kTT_cy | Julian centuries since J2000.0, TT timescale |
[out] | pos | Timestamped structure containing position data in apparent coordinates and the equation of the equinoxes. |
This function is designed to be callable by the skyfast_init() and skyfast_backgroundUpdate() functions in a tracking application.
void star_getTopocentric | ( | double | j2kUtc_d, |
const Sky_DeltaTs * | deltas, | ||
const Sky_SiteProp * | site, | ||
Sky_SiteHorizon * | topo | ||
) |
Calls star_getApparent() to calculate the star's position in apparent coordinates, and then converts this to topocentric horizon coordinates at the specified site.
The star whose coordinates are obtained with this function is the star most recently specified with star_setCurrentObject()
[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 |
int star_setCatalogPosn | ( | const char | objectName[], |
double | ra_h, | ||
double | dec_deg, | ||
Star_CoordSys | coordSys, | ||
double | equinoxYear, | ||
double | epochYear, | ||
double | muRaSplat_maspa, | ||
double | muDec_maspa, | ||
double | annParallax_as, | ||
double | radVel_kmps, | ||
Star_CatalogPosn * | coordBlock | ||
) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn.
(The other two routines are star_setCatalogOldStyle() and star_parseCoordString().)
[in] | objectName | Name of the object (optional) |
[in] | ra_h | Right ascension (hours) |
[in] | dec_deg | Declination (degrees) |
[in] | coordSys | Coordinate system for RA and Dec |
[in] | equinoxYear | Year of epoch of the mean equinox (if coordSys is FK4 or FK5) |
[in] | epochYear | Year of epoch for proper motion (if coordSys is ICRS, FK4 or FK5) |
[in] | muRaSplat_maspa | μα* - proper motion in RA, including the cos(δ) factor (milliarcseconds/year) |
[in] | muDec_maspa | μδ - proper motion in declination (milliarcseconds/year) |
[in] | annParallax_as | π - annual parallax (arcseconds) |
[in] | radVel_kmps | ν - radial velocity (km/s), positive away from the Earth |
[out] | coordBlock | The block containing the data from all the input parameters, basically scaled into radians |
The difference between this routine and star_setCatalogOldStyle() is in the way the proper motions in RA and Dec are specified. In this routine, μα* is specified in milliarcseconds per year, after scaling to absolute displacement on the sky by multiplying by cos(δ). μδ is also specified in milliarcseconds per year.
int star_setCatalogOldStyle | ( | const char | objectName[], |
double | ra_h, | ||
double | dec_deg, | ||
Star_CoordSys | coordSys, | ||
double | equinoxYear, | ||
double | epochYear, | ||
double | muRa_spcy, | ||
double | muDec_aspcy, | ||
double | annParallax_as, | ||
double | radVel_kmps, | ||
Star_CatalogPosn * | coordBlock | ||
) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn.
(The other two routines are star_setCatalogPosn() and star_parseCoordString().)
[in] | objectName | Name of the object (optional) |
[in] | ra_h | Right ascension (hours) |
[in] | dec_deg | Declination (degrees) |
[in] | coordSys | Coordinate system for RA and Dec |
[in] | equinoxYear | Year of epoch of the mean equinox (if coordSys is FK4 or FK5) |
[in] | epochYear | Year of epoch for proper motion (if coordSys is ICRS, FK4 or FK5) |
[in] | muRa_spcy | μα - proper motion in RA, not including the cos(δ) factor (seconds/century) |
[in] | muDec_aspcy | μδ - proper motion in declination (arcseconds/century) |
[in] | annParallax_as | π - annual parallax (arcseconds) |
[in] | radVel_kmps | ν - radial velocity (km/s), positive away from the Earth |
[out] | coordBlock | The block containing the data from all the input parameters, basically scaled into radians |
The difference between this routine and star_setCatalogPosn() is in the way the proper motions in RA and Dec are specified. In this routine, μα is specified in seconds (of time) per century, and is not scaled to absolute displacement on the sky. μδ is specified in arcseconds per century.
int star_parseCoordString | ( | const char | inStr[], |
Star_CatalogPosn * | coordBlock | ||
) |
This is one of three alternative routines for loading the information for a celestial object into a block of form Star_CatalogPosn.
(The other two routines are star_setCatalogPosn() and star_setCatalogOldStyle().)
[in] | inStr | The input string. |
[out] | coordBlock | The block containing the data from the input string, basically scaled into radians |
This routine decodes an input string which is of the form
[name], RA, DEC[, Coords,[Epoch][, Mu_ra*, Mu_dec[, Pi[, Vr]]]]
where the items shown inside square brackets are optional. This is basically a comma separated value (CSV) format. The text fields are as follows:
In both of the above cases, the subfields may be separated by spaces, colons, degree, minute and seconds symbols, single and double quotes, or anything really. The parser is not fussy, and does not check.
The string format is fairly flexible. For example, fields may be separated with spaces rather than commas, so long as any omitted fields are at the end of the string. But if any fields not at the end are omitted, commas must be used to indicate the empty fields.
Dummy, 12:34:56.789, +89°56′43.210″, J2000.0,, 23.455, 12.766 Barnard's star, 17 57 48.500 +04 41 36.111 ICRS,, -802.803, 10362.542, 0.5474506, -110.353
void star_catalogToVectors | ( | const Star_CatalogPosn * | c, |
V3D_Vector * | pV, | ||
V3D_Vector * | vV_radpcy | ||
) |
This routine takes the mean equatorial polar coordinate of an object and its proper motions, annual parallax (distance) and radial velocity, and computes the rectangular position and velocity vectors with respect to the same coordinate system.
[in] | c | Catalog position and motion of object |
[out] | pV | Unit position vector (direction cosines) |
[out] | vV_radpcy | Space velocity vector (radian/Julian century) |
void star_earth | ( | double | t1_cy, |
const V3D_Matrix * | npM, | ||
V3D_Vector * | ebV_au, | ||
V3D_Vector * | ebdotV_aupd, | ||
V3D_Vector * | sbV_au | ||
) |
Calculate the position and velocity of the Earth, for use in making annual parallax and aberration corrections.
[in] | t1_cy | Epoch of time of observation (Julian centuries since J2000.0, TT timescale) |
[in] | npM | Combined precession and nutation matrix NP that will be used to convert the coordinates of the star of interest from its catalogue mean place to apparent coordinates. It will be used in this routine to do the reverse - convert the apparent coordinates of the Earth's position back into mean coordinates at the catalogue epoch of the star. |
[out] | ebV_au | Barycentric position of the Earth (AU) (vector Eb in Astronomical Almanac) |
[out] | ebdotV_aupd | Velocity of the Earth (AU/day) (vector Ėb in Astronomical Almanac) |
[out] | sbV_au | Barycentric position of the Sun (AU) (vector Sb in Astronomical Almanac) |
In theory, this is the barycentric position, and the values are referred to the same system as is used for the catalogue position of the star (such as J2000, or the Barycentric Celestial Reference System/ICRS). This can be obtained from the IAU SOFA routine iauEpv00()
, calculated in fabulously complicated detail. But the parallax and aberration corrections are small, which means that the accuracy required of this routine is not actually that high.
So to save on computing resources in a tracking application, this routine uses instead the simple algorithm in the Astronomical Almanac for the Sun's position, entitled "Low-precision formulas for the Sun's coordinates..." It differentiates the position vector to obtain the Earth's velocity. So there are a few approximations here:
But nonetheless, the effect on the final star position is very small. For example, the Almanac gives an example of stellar reduction calculations for a fictitious star, (which appears to be very close to Alpha Centauri). This star has about as much parallax as one is ever likely to see.
In the 2007 Almanac, page B68, the apparent position of this star at 2007 January 1, 0h TT , after performing a rigorous reduction, is
The position obtained by using the approximations of star_catalogToApp() (which calls this routine) and converts to apparent coordinates is
which is clearly good enough for tracking.
In the 1987 Almanac, page B41, the apparent position of a (very slightly different) fictitious star at 1987 January 1, 0h TT is
The position obtained using the routines here (as above) is
For a more detailed look at this, see Stellar reduction accuracy
void star_annAberr | ( | const V3D_Vector * | p1V, |
const V3D_Vector * | earthVelV_aupd, | ||
V3D_Vector * | p2V | ||
) |
Apply the annual aberration correction, to convert an object's coordinates from geocentric geometric direction to "proper" direction (still geocentric)
[in] | p1V | Unit vector pointing to object's geometric direction as viewed from the centre of the earth. |
[in] | earthVelV_aupd | Earth velocity vector, referred to the J2000 mean equator and equinox, as returned by routine star_earth() (AU/day - not a unit vector) |
[out] | p2V | Unit vector pointing to object's proper direction |
char* star_equinoxToStr | ( | const Star_CatalogPosn * | coordBlock, |
char | equinoxStr[], | ||
size_t | eqnxStrSize | ||
) |
Write the coordinate system and equinox out in a standard form.
[in] | coordBlock | Coordinate block describing the celestial object |
[out] | equinoxStr | String to contain the coordinate system and equinox |
[in] | eqnxStrSize | Size of equinoxStr (i.e. maximum number of characters available for the output |
The output form depends upon the value of coordBlock->cSys:
coordBlock->cSys | Output |
---|---|
APPARENT | Apparent |
INTERMEDIATE | Intermediate |
FK4 | Bnnnn.n (n is numeric) |
FK5 | Jnnnn.n (n is numeric) |
ICRS | ICRS |
char* star_epochToStr | ( | const Star_CatalogPosn * | coordBlock, |
char | epochStr[], | ||
size_t | epochStrSize | ||
) |
Write the epoch used for proper motion calculations out in a standard form.
[in] | coordBlock | Coordinate block describing the celestial object |
[out] | epochStr | String to contain the coordinate system and epoch |
[in] | epochStrSize | Size of epochStr (i.e. maximum number of characters available for the output |
The output form depends upon the value of coordBlock->cSys:
coordBlock->cSys | Output |
---|---|
APPARENT | (empty string - epoch is irrelevant) |
INTERMEDIATE | (empty string - epoch is irrelevant) |
FK4 | Bnnnn.n (n is numeric) |
FK5 | Jnnnn.n (n is numeric) |
ICRS | Jnnnn.n (n is numeric) |