| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaPlanel ( double date, int jform, double epoch, double orbinc, | 
|---|
| 4 | double anode, double perih, double aorq, double e, | 
|---|
| 5 | double aorl, double dm, double pv[6], int* jstat ) | 
|---|
| 6 | /* | 
|---|
| 7 | **  - - - - - - - - - - | 
|---|
| 8 | **   s l a P l a n e l | 
|---|
| 9 | **  - - - - - - - - - - | 
|---|
| 10 | ** | 
|---|
| 11 | **  Heliocentric position and velocity of a planet, asteroid or comet, | 
|---|
| 12 | **  starting from orbital elements. | 
|---|
| 13 | ** | 
|---|
| 14 | **  Given: | 
|---|
| 15 | **     date    double     date, Modified Julian Date (JD - 2400000.5) | 
|---|
| 16 | **     jform   int        choice of element set (1-3; Note 3) | 
|---|
| 17 | **     epoch   double     epoch of elements (TT MJD) | 
|---|
| 18 | **     orbinc  double     inclination (radians) | 
|---|
| 19 | **     anode   double     longitude of the ascending node (radians) | 
|---|
| 20 | **     perih   double     longitude or argument of perihelion (radians) | 
|---|
| 21 | **     aorq    double     mean distance or perihelion distance (AU) | 
|---|
| 22 | **     e       double     eccentricity | 
|---|
| 23 | **     aorl    double     mean anomaly or longitude (radians, jform=1,2 only) | 
|---|
| 24 | **     dm      double     daily motion (radians, jform=1 only) | 
|---|
| 25 | ** | 
|---|
| 26 | **  Returned: | 
|---|
| 27 | **     pv      double[6]  heliocentric x,y,z,xdot,ydot,zdot of date, | 
|---|
| 28 | **                         J2000 equatorial triad (AU,AU/s) | 
|---|
| 29 | **     jstat   int*       status:  0 = OK | 
|---|
| 30 | **                                -1 = illegal jform | 
|---|
| 31 | **                                -2 = illegal e | 
|---|
| 32 | **                                -3 = illegal aorq | 
|---|
| 33 | **                                -4 = illegal dm | 
|---|
| 34 | **                                -5 = numerical error | 
|---|
| 35 | ** | 
|---|
| 36 | **  Called:  slaEl2ue, slaUe2pv | 
|---|
| 37 | ** | 
|---|
| 38 | **  Notes | 
|---|
| 39 | ** | 
|---|
| 40 | **  1  DATE is the instant for which the prediction is required.  It is | 
|---|
| 41 | **     in the TT timescale (formerly Ephemeris Time, ET) and is a | 
|---|
| 42 | **     Modified Julian Date (JD-2400000.5). | 
|---|
| 43 | ** | 
|---|
| 44 | **  2  The elements are with respect to the J2000 ecliptic and equinox. | 
|---|
| 45 | ** | 
|---|
| 46 | **  3  Three different element-format options are available: | 
|---|
| 47 | ** | 
|---|
| 48 | **     Option jform=1, suitable for the major planets: | 
|---|
| 49 | ** | 
|---|
| 50 | **     epoch  = epoch of elements (TT MJD) | 
|---|
| 51 | **     orbinc = inclination i (radians) | 
|---|
| 52 | **     anode  = longitude of the ascending node, big omega (radians) | 
|---|
| 53 | **     perih  = longitude of perihelion, curly pi (radians) | 
|---|
| 54 | **     aorq   = mean distance, a (AU) | 
|---|
| 55 | **     e      = eccentricity, e (range 0 to <1) | 
|---|
| 56 | **     aorl   = mean longitude L (radians) | 
|---|
| 57 | **     dm     = daily motion (radians) | 
|---|
| 58 | ** | 
|---|
| 59 | **     Option jform=2, suitable for minor planets: | 
|---|
| 60 | ** | 
|---|
| 61 | **     epoch  = epoch of elements (TT MJD) | 
|---|
| 62 | **     orbinc = inclination i (radians) | 
|---|
| 63 | **     anode  = longitude of the ascending node, big omega (radians) | 
|---|
| 64 | **     perih  = argument of perihelion, little omega (radians) | 
|---|
| 65 | **     aorq   = mean distance, a (AU) | 
|---|
| 66 | **     e      = eccentricity, e (range 0 to <1) | 
|---|
| 67 | **     aorl   = mean anomaly M (radians) | 
|---|
| 68 | ** | 
|---|
| 69 | **     Option jform=3, suitable for comets: | 
|---|
| 70 | ** | 
|---|
| 71 | **     epoch  = epoch of perihelion (TT MJD) | 
|---|
| 72 | **     orbinc = inclination i (radians) | 
|---|
| 73 | **     anode  = longitude of the ascending node, big omega (radians) | 
|---|
| 74 | **     perih  = argument of perihelion, little omega (radians) | 
|---|
| 75 | **     aorq   = perihelion distance, q (AU) | 
|---|
| 76 | **     e      = eccentricity, e (range 0 to 10) | 
|---|
| 77 | ** | 
|---|
| 78 | **  4  Unused elements (DM for jform=2, aorl and dm for jform=3) are | 
|---|
| 79 | **     not accessed. | 
|---|
| 80 | ** | 
|---|
| 81 | **  5  The reference frame for the result is with respect to the mean | 
|---|
| 82 | **     equator and equinox of epoch J2000. | 
|---|
| 83 | ** | 
|---|
| 84 | **  6  The algorithm was originally adapted from the EPHSLA program | 
|---|
| 85 | **     of D.H.P.Jones (private communication, 1996).  The method is | 
|---|
| 86 | **     based on Stumpff's Universal Variables. | 
|---|
| 87 | ** | 
|---|
| 88 | **  Reference:  Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. | 
|---|
| 89 | ** | 
|---|
| 90 | **  Last revision:   18 March 1999 | 
|---|
| 91 | ** | 
|---|
| 92 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 93 | */ | 
|---|
| 94 | { | 
|---|
| 95 | double u[13]; | 
|---|
| 96 | int j; | 
|---|
| 97 |  | 
|---|
| 98 |  | 
|---|
| 99 |  | 
|---|
| 100 | /* Validate elements and convert to "universal variables" parameters. */ | 
|---|
| 101 | slaEl2ue ( date, jform, | 
|---|
| 102 | epoch, orbinc, anode, perih, aorq, e, aorl, dm, u, &j ); | 
|---|
| 103 |  | 
|---|
| 104 | /* Determine the position and velocity. */ | 
|---|
| 105 | if ( !j ) { | 
|---|
| 106 | slaUe2pv ( date, u, pv, &j ); | 
|---|
| 107 | if ( j ) j = -5; | 
|---|
| 108 | } | 
|---|
| 109 |  | 
|---|
| 110 | /* Wrap up. */ | 
|---|
| 111 | *jstat = j; | 
|---|
| 112 |  | 
|---|
| 113 | } | 
|---|