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_spkw17

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


Abstract


   CSPICE_SPKW17 writes an SPK segment of type 17 given a type 17 data
   record.

I/O


   Given:

      handle   the scalar integer file handle of an SPK file that has been
               opened for writing.

               help, handle
                  LONG = Scalar

      body     the scalar integer NAIF ID for the body whose states are to be
               recorded in the SPK file.

               help, body
                  LONG = Scalar

      center   the scalar integer NAIF ID for the center of motion associated
               with body.

               help, center
                  LONG = Scalar

      frame    the scalar string reference frame name that states are
               referenced to, for example 'J2000'.

               help, frame
                  STRING = Scalar

      first,
      last     the scalar double precision bounds on the ephemeris times,
               expressed as seconds past J2000.

               help, first
                  DOUBLE = Scalar
               help, last
                  DOUBLE = Scalar

      segid    the scalar string segment identifier.

               help, segid
                  STRING = Scalar

               An SPK segment identifier may contain up to 40 characters.

      epoch    the scalar double precision epoch of equinoctial elements in
               seconds past the J2000 epoch.

               help, epoch
                  DOUBLE = Scalar

      eqel     an array of 9 double precision numbers that are the equinoctial
               elements for some orbit relative to the equatorial frame of a
               central body.

               help, eqel
                  DOUBLE = Array[9]

                  Note: The Z-axis of the equatorial frame is the
                  direction of the pole of the central body relative
                  to `frame'. The X-axis is given by the cross product of
                  the Z-axis of `frame' with the direction of the pole of
                  the central body. The Y-axis completes a right handed
                  frame.

               The specific arrangement of the elements is spelled
               out below. The following terms are used in the
               discussion of elements of `eqel':

                  inc  --- inclination of the orbit
                  argp --- argument of periapse
                  node --- longitude of the ascending node
                  e    --- eccentricity of the orbit
                  m0   --- mean anomaly

               eqel[0]   is the semi-major axis (A) of the orbit in km.

               eqel[1]   is the value of H at the specified epoch:

                            H =  e * sin( argp + node )

               eqel[2]   is the value of K at the specified epoch:

                            K =  e * cos( argp + node )

               eqel[3]   is the mean longitude at the epoch of the
                         elements measured in radians:

                            ( m0 + argp + node )

               eqel[4]   is the value of P at the specified epoch:

                            P =  tan( inc/1 ) * sin( node )

               eqel[5]   is the value of Q at the specified epoch:

                            Q =  tan( inc/1 ) * cos( node );

               eqel[6]   is the rate of the longitude of periapse
                         at the epoch of the elements.

                            ( dargp/dt + dnode/dt )

                         This rate is assumed to hold for all time. The
                         rate is measured in radians per second.

               eqel[7]   is the derivative of the mean longitude:

                            ( dm0/dt + dargp/dt + dnode/dt )

                         This rate is assumed to be constant and is
                         measured in radians/second.

               eqel[8]   is the rate of the longitude of the ascending
                         node:

                            ( dnode/dt )

                         This rate is measured in radians per second.

      rapol    the Right Ascension of the pole of the reference plane relative
               to `frame' measured in radians.

               help, rapol
                  DOUBLE = Scalar

      decpol   the declination of the pole of the reference plane relative to
               `frame' measured in radians.

               help, decpol
                  DOUBLE = Scalar

   the call:

      cspice_spkw17, handle, body,  center, frame, first, last,              $
                     segid,  epoch, eqel,   rapol, decpol

   writes an SPK type 17 segment to the file attached to `handle'.

Parameters


   None.

Examples


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

   1) Suppose that at a given time you have the classical elements
      of Daphnis relative to the equatorial frame of Saturn. These
      can be converted to equinoctial elements and stored in an SPK
      file as a type 17 segment so that Daphnis can be used within
      the SPK subsystem of the SPICE system.

      The example code shown below creates an SPK type 17 kernel
      with a single segment using such data.


      Example code begins here.


      PRO spkw17_ex1

         ;;
         ;; Local parameters.
         ;;
         SPK17   =   'spkw17_ex1.bsp'

         ;;
         ;; The SPK type 17 segment will contain data for Daphnis
         ;; (ID 635) with respect to Saturn (ID 699) in the J2000
         ;; reference frame.
         ;;
         BODY    =   635L
         CENTER  =   699L
         FRMNAM  =   'J2000'

         ;;
         ;; This is the list of parameters used to represent the
         ;; classical elements:
         ;;
         ;;    Variable     Meaning
         ;;    --------     ---------------------------------------
         ;;    A            Semi-major axis in km.
         ;;    ECC          Eccentricity of orbit.
         ;;    INC          Inclination of orbit.
         ;;    NODE         Longitude of the ascending node at
         ;;                 epoch.
         ;;    OMEGA        Argument of periapse at epoch.
         ;;    M            Mean anomaly at epoch.
         ;;    DMDT         Mean anomaly rate in radians/second.
         ;;    DNODE        Rate of change of longitude of
         ;;                 ascending node in radians/second.
         ;;    DOMEGA       Rate of change of argument of periapse
         ;;                 in radians/second.
         ;;    EPOCH        The epoch of the elements in seconds
         ;;                 past the J2000 epoch.
         ;;
         A       =   1.36505608D+05
         ECC     =   -2.105898062D-05
         INC     =   -3.489710429D-05
         NODE    =   -3.349237456D-02
         OMEGA   =   1.52080206722D0
         M       =   1.21177109734D0
         DMDT    =   1.218114014D-04
         DNODE   =   -5.96845468D-07
         DOMEGA  =   1.196601093D-06
         EPOCH   =   0.D0

         ;;
         ;; In addition, the cspice_spkw17 routine requires the Right
         ;; Ascension and Declination of the pole of the
         ;; reference plane relative to the J2000 frame, in radians.
         ;;
         RAPOL   =   7.08332284D-01
         DECPOL  =   1.45800286D0

         ;;
         ;; Set the start and end times of interval covered by
         ;; segment.
         ;;
         first   =  504878400.D0
         last    = 1578657600.D0

         ;;
         ;; `ncomch' is the number of characters to reserve for the
         ;; kernel's comment area. This example doesn't write
         ;; comments, so set to zero.
         ;;
         ncomch  = 0L

         ;;
         ;; Internal file name and segment ID.
         ;;
         ifname  = 'Test for type 17 SPK internal file name'
         segid   = 'SPK type 17 test segment'

         ;;
         ;; Open a new SPK file.
         ;;
         cspice_spkopn, SPK17, ifname, ncomch, handle

         ;;
         ;; Convert the classical elements to equinoctial elements
         ;; (in the order compatible with type 17).
         ;;
         eqel    = [ A,                                                      $
                     ECC * sin ( OMEGA + NODE ),                             $
                     ECC * cos ( OMEGA + NODE ),                             $
                     M + OMEGA + NODE,                                       $
                     tan( INC/2.D0 ) * sin( NODE ),                          $
                     tan( INC/2.D0 ) * cos( NODE ),                          $
                     DOMEGA + DNODE,                                         $
                     DMDT + DOMEGA + DNODE,                                  $
                     DNODE                         ]

         ;;
         ;; Now add the segment.
         ;;
         cspice_spkw17, handle, BODY,  CENTER, FRMNAM, first, last,          $
                        segid,  EPOCH, eqel,   RAPOL,  DECPOL

         ;;
         ;; Close the SPK file.
         ;;
         cspice_spkcls, handle

      END


      When this program is executed, no output is presented on
      screen. After run completion, a new SPK type 17 exists in
      the output directory.

Particulars


   This routine writes an SPK type 17 data segment to the open SPK
   file according to the format described in the type 17 section of
   the SPK Required Reading. The SPK file must have been opened with
   write access.

Exceptions


   1)  If the semi-major axis is less than or equal to zero, the
       error SPICE(BADSEMIAXIS) is signaled by a routine in the call
       tree of this routine.

   2)  If the eccentricity of the orbit corresponding to the values
       of H and K ( eqel[1] and eqel[2] ) is greater than 0.9, the
       error SPICE(ECCOUTOFRANGE) is signaled by a routine in the
       call tree of this routine.

   3)  If the segment identifier has more than 40 non-blank
       characters, the error SPICE(SEGIDTOOLONG) is signaled by a
       routine in the call tree of this routine.

   4)  If the segment identifier contains non-printing characters,
       the error SPICE(NONPRINTABLECHARS) is signaled by a routine in
       the call tree of this routine.

   5)  If there are inconsistencies in the `body', `center', `frame' or
       `first' and `last' times, an error is signaled by a routine in
       the call tree of this routine.

   6)  If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `epoch', `eqel', `rapol' or
       `decpol', is undefined, an error is signaled by the IDL error
       handling system.

   7)  If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `epoch', `eqel', `rapol' or
       `decpol', is not of the expected type, or it does not have the
       expected dimensions and size, an error is signaled by the Icy
       interface.

Files


   A new type 17 SPK segment is written to the SPK file attached
   to `handle'.

Restrictions


   None.

Required_Reading


   ICY.REQ
   SPK.REQ

Literature_References


   None.

Author_and_Institution


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

Version


   -Icy Version 1.0.1, 01-JUN-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code examples based on existing example, with modified input data.

       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.0.0, 07-NOV-2011 (EDW)

Index_Entries


   Write a type 17 SPK segment



Fri Dec 31 18:43:07 2021