Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_oscelt

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_OSCELT calculates the set of osculating conic
   orbital elements corresponding to the state 6-vector
   (position, velocity) of a body at an epoch.

I/O


   Given:

      state    a double precision 6-vector or 6xN array for conversion to
               osculating elements.

               help, state
                  DOUBLE = Array[6]   or   DOUBLE = Array[6,N]

      et       the double precision scalar or N-vector of ephemeris time epochs
               corresponding to each `state'.

               help, et
                  DOUBLE = Scalar   or   DOUBLE = Array[N]

               Note the relation between the elements of `et' and `state'
               is one-to-one and onto.

      mu       the gravitational parameter of the reference body for `state'.

               help, mu
                  DOUBLE = Scalar

   the call:

      cspice_oscelt, state, et, mu, elts

   returns:

      elts     equivalent conic elements describing the orbit of the body
               around its primary.

               help, elts
                  DOUBLE = Array[8]   or   DOUBLE = Array[8,N]

               The elements are, in order:

                  RP      Perifocal distance.
                  ECC     Eccentricity.
                  INC     Inclination.
                  LNODE   Longitude of the ascending node.
                  ARGP    Argument of periapsis.
                  M0      Mean anomaly at epoch.
                  T0      Epoch.
                  MU      Gravitational parameter.

               The epoch of the elements is the epoch of the input
               state. Units are km, rad, rad/sec. The same elements
               are used to describe all three types (elliptic,
               hyperbolic, and parabolic) of conic orbit.

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Determine the osculating elements of Phobos with respect to
      Mars at some arbitrary time in the J2000 inertial reference
      frame.

      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: oscelt_ex1.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name                     Contents
            ---------                     --------
            mar097.bsp                    Mars satellite ephemeris
            gm_de431.tpc                  Gravitational constants
            naif0012.tls                  Leapseconds


         \begindata

            KERNELS_TO_LOAD = ( 'mar097.bsp',
                                'gm_de431.tpc',
                                'naif0012.tls'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO oscelt_ex1

         ;;
         ;; Load the meta kernel listing the needed SPK, LSK and
         ;; PCK with gravitational parameters kernels.
         ;;
         cspice_furnsh, 'oscelt_ex1.tm'

         ;;
         ;; Convert the time string to ephemeris time
         ;;
         cspice_str2et, 'Dec 25, 2007', et

         ;;
         ;; Retrieve the state of Phobos with respect to Mars in J2000.
         ;;
         cspice_spkezr, 'PHOBOS', et, 'J2000', 'NONE', 'MARS', $
                         state,   ltime

         ;;
         ;; Read the gravitational parameter for Mars.
         ;;
         cspice_bodvrd, 'MARS', 'GM', 1, mu

         ;;
         ;; Convert the state 6-vector to the elts 8-vector. Note:
         ;; cspice_bodvrd returns data as arrays, so to access the
         ;; gravitational parameter (the only value in the array),
         ;; we use mu[0].
         ;;
         cspice_oscelt, state, et, mu[0], elts

         ;;
         ;; Output the elts vector.
         ;;
         print, format='("Perifocal distance          (km): ",F21.10)', $
                elts[0]
         print, format='("Eccentricity                    : ",F21.10)', $
                elts[1]
         print, format='("Inclination                (deg): ",F21.10)', $
                elts[2] * cspice_dpr( )
         print, format='("Lon of ascending node      (deg): ",F21.10)', $
                elts[3] * cspice_dpr( )
         print, format='("Argument of periapsis      (deg): ",F21.10)', $
                elts[4] * cspice_dpr( )
         print, format='("Mean anomaly at epoch      (deg): ",F21.10)', $
                elts[5] * cspice_dpr( )
         print, format='("Epoch                        (s): ",F21.10)', $
                elts[6]
         print, format='("Gravitational parameter (km3/s2): ",F21.10)', $
                elts[7]

         ;;
         ;; It's always good form to unload kernels after use,
         ;; particularly in IDL due to data persistence.
         ;;
         cspice_kclear

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Perifocal distance          (km):       9232.5746716211
      Eccentricity                    :          0.0156113904
      Inclination                (deg):         38.1225231660
      Lon of ascending node      (deg):         47.0384055902
      Argument of periapsis      (deg):        214.1546430017
      Mean anomaly at epoch      (deg):        340.5048466068
      Epoch                        (s):  251812865.1837092042
      Gravitational parameter (km3/s2):      42828.3736206991


   2) Calculate the history of Phobos's orbit plane inclination
      with respect to Mars in the J2000 frame at intervals of six
      months for a time interval of 10 years.

      Use the meta-kernel from the first example.


      Example code begins here.


      PRO oscelt_ex2

         ;;
         ;; Load the meta kernel listing the needed SPK, LSK and
         ;; PCK with gravitational parameters kernels.
         ;;
         cspice_furnsh, 'oscelt_ex1.tm'

         ;;
         ;; Read the gravitational parameter for Mars.
         ;;
         cspice_bodvrd, 'MARS', 'GM', 1, mu

         ;;
         ;; Convert the time string to ephemeris time
         ;;
         cspice_str2et, 'Jan 1, 2000 12:00:00', et0

         ;;
         ;; A step of six months - in seconds.
         ;;
         step = 180.0 * cspice_spd( )

         ;;
         ;; Define an array of ephemeris times, covering,
         ;; 10 years in steps of six months starting
         ;; approximately Jan 1, 2000.
         ;;
         et = dindgen(20)*step + et0

         ;;
         ;; Retrieve the state; convert to osculating elements.
         ;;
         cspice_spkezr, 'PHOBOS', et, 'J2000', 'NONE', 'MARS', $
                         state,   ltime
         cspice_oscelt, state, et, mu[0], elts

         ;;
         ;; Convert the angular measures to degrees.
         ;;
         elts[2,*] = elts[2,*]*cspice_dpr()

         ;;
         ;; Convert the ephemeris time of the state lookup to
         ;; calendar UTC, then print the calendar string and the
         ;; inclination in degrees of Phobos wrt Mars at the
         ;; time.
         ;;
         cspice_et2utc, et, 'C', 3, utcstr

         print, '        UCT Time          Inclination'
         print, '------------------------  -----------'

         for i=0, 19 do begin

            print, format='(A,X,F12.6)', utcstr[i],  elts[2,i]

         endfor

         ;;
         ;; It's always good form to unload kernels after use,
         ;; particularly in IDL due to data persistence.
         ;;
         cspice_kclear

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


              UCT Time          Inclination
      ------------------------  -----------
      2000 JAN 01 12:00:00.000    36.055248
      2000 JUN 29 12:00:00.000    37.112144
      2000 DEC 26 12:00:00.000    38.152129
      2001 JUN 24 12:00:00.000    37.552071
      2001 DEC 21 12:00:00.000    36.242049
      2002 JUN 19 11:59:59.999    36.330470
      2002 DEC 16 12:00:00.000    37.674595
      2003 JUN 14 11:59:59.999    38.121191
      2003 DEC 11 12:00:00.001    36.973204
      2004 JUN 08 11:59:59.999    36.033732
      2004 DEC 05 12:00:00.001    36.844542
      2005 JUN 03 11:59:59.999    38.077365
      2005 NOV 30 12:00:00.001    37.786106
      2006 MAY 29 11:59:58.999    36.413540
      2006 NOV 25 11:59:59.001    36.171050
      2007 MAY 24 11:59:58.999    37.448015
      2007 NOV 20 11:59:59.001    38.189118
      2008 MAY 18 11:59:58.999    37.223573
      2008 NOV 14 11:59:59.001    36.084745
      2009 MAY 13 11:59:57.999    36.608971


Particulars


   When called in a vectorized fashion, the order of `state' (6xN)
   must equal that of `et' (N-vector).

   Extract the element 8-vector corresponding to the ith `et' (et[i])
   with the expression:

      elts_i = elts[*,i]

Exceptions


   1)  If `mu' is not positive, the error SPICE(NONPOSITIVEMASS)
       is signaled by a routine in the call tree of this routine.

   2)  If the specific angular momentum vector derived from `state'
       is the zero vector, the error SPICE(DEGENERATECASE)
       is signaled by a routine in the call tree of this routine.

   3)  If the position or velocity vectors derived from `state'
       is the zero vector, the error SPICE(DEGENERATECASE)
       is signaled by a routine in the call tree of this routine.

   4)  If the inclination is determined to be zero or 180 degrees,
       the longitude of the ascending node is set to zero.

   5)  If the eccentricity is determined to be zero, the argument of
       periapse is set to zero.

   6)  If the eccentricity of the orbit is very close to but not
       equal to zero, the argument of periapse may not be accurately
       determined.

   7)  For inclinations near but not equal to 0 or 180 degrees,
       the longitude of the ascending node may not be determined
       accurately. The argument of periapse and mean anomaly may
       also be inaccurate.

   8)  For eccentricities very close to but not equal to 1, the
       results of this routine are unreliable.

   9)  If the specific angular momentum vector is non-zero but
       "close" to zero, the results of this routine are unreliable.

   10) If `state' is expressed relative to a non-inertial reference
       frame, the resulting elements are invalid. No error checking
       is done to detect this problem.

   11) If any of the input arguments, `state', `et' or `mu', is
       undefined, an error is signaled by the IDL error handling
       system.

   12) If any of the input arguments, `state', `et' or `mu', is not
       of the expected type, or it does not have the expected
       dimensions and size, an error is signaled by the Icy
       interface.

   13) If the input vectorizable arguments `state' and `et' do not
       have the same measure of vectorization (N), an error is
       signaled by the Icy interface.

   14) If the output argument `elts' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  The input state vector must be expressed relative to an
       inertial reference frame.

   2)  Osculating elements are generally not useful for
       high-accuracy work.

   3)  Accurate osculating elements may be difficult to derive for
       near-circular or near-equatorial orbits. Osculating elements
       for such orbits should be used with caution.

   4)  Extracting osculating elements from a state vector is a
       mathematically simple but numerically challenging task. The
       mapping from a state vector to equivalent elements is
       undefined for certain state vectors, and the mapping is
       difficult to implement with finite precision arithmetic for
       states near the subsets of R6 where singularities occur.

       In general, the elements found by this routine can have
       two kinds of problems:

       -  The elements are not accurate but still represent
          the input state accurately. The can happen in
          cases where the inclination is near zero or 180
          degrees, or for near-circular orbits.

       -  The elements are garbage. This can occur when
          the eccentricity of the orbit is close to but
          not equal to 1. In general, any inputs that cause
          great loss of precision in the computation of the
          specific angular momentum vector or the eccentricity
          vector will result in invalid outputs.

       For further details, see the -Exceptions section.

       Users of this routine should carefully consider whether
       it is suitable for their applications. One recommended
       "sanity check" on the outputs is to supply them to the
       Icy routine cspice_conics and compare the resulting state
       vector with the one supplied to this routine.

Required_Reading


   ICY.REQ

Literature_References


   [1]  R. Bate, D. Mueller, and J. White, "Fundamentals of
        Astrodynamics," Dover Publications Inc., 1971.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.1, 17-JUN-2021 (JDR)

       Edited the header to comply with NAIF standard.

       Reformatted code examples' output and changed input data. Reduced
       the interval time and steps to compute the solution in example #2.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.1.0, 16-MAY-2005 (EDW)

       Added capability to process 6xN array `state' and
       N-vector `et' input returning a 8xN `elts' array.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   conic elements from state
   osculating elements from state
   convert state to osculating elements



Fri Dec 31 18:43:06 2021