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

Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

 SPKPVN ( S/P Kernel, position and velocity in native frame )
 
      SUBROUTINE SPKPVN ( HANDLE, DESCR, ET, REF, STATE, CENTER )
 

Abstract

     Return the state (position and velocity) of a target body
     relative to some center of motion.

Required_Reading

     SPK

Keywords

     EPHEMERIS

Declarations


      INTEGER               HANDLE
      DOUBLE PRECISION      DESCR    ( 5 )
      DOUBLE PRECISION      ET
      INTEGER               REF
      DOUBLE PRECISION      STATE    ( 6 )
      INTEGER               CENTER
 
 

Brief_I/O

     Variable  I/O  Description
     --------  ---  --------------------------------------------------
     HANDLE     I   File handle.
     DESCR      I   Segment descriptor.
     ET         I   Target epoch.
     REF        O   Target reference frame.
     STATE      O   Position, velocity.
     CENTER     O   Center of state.
     MAXREC     P   Maximum length of records returned by SPKRnn.

Detailed_Input

     HANDLE,
     DESCR       are the file handle assigned to a SPK file, and the
                 descriptor for a segment within the file. Together
                 they determine the ephemeris data from which the
                 state of the body is to be computed.

     ET          is the epoch (ephemeris time) at which the state
                 is to be computed.

Detailed_Output

     REF         is the id-code of the reference frame to
                 which the vectors returned by the routine belong.

     STATE       contains the position and velocity, at epoch ET,
                 for whatever body is covered by the specified segment.
                 STATE has six elements:  the first three contain the
                 body's position; the last three contain the body's
                 velocity.  These vectors are rotated into the
                 specified  reference frame, the origin of
                 which is located at the center of motion for the
                 body (see CENTER, below).  Units are always km and
                 km/sec.

     CENTER      is the integer ID code of the center of motion for
                 the state.

Parameters

     MAXREC      is the maximum length of a record returned by any of
                 data type-specific routines SPKRnn, which are called
                 by SPKPVN (see Particulars).

Exceptions

     1) If the segment type is not supported by the current
        version of SPKPVN, the error 'SPICE(SPKTYPENOTSUPP)'
        is signalled.

Files

     See argument HANDLE.

Particulars

     SPKPVN is the most basic of the SPK readers, the reader upon
     which SPKPV and SPKGEO, etc. are built. It should not normally
     be called directly except in cases where some optimization is
     required. (That is, where the calling program has prior knowledge
     of the center-barycenter shifts to be performed, or a non-standard
     method of determining the files and segments to be used when
     computing states.)

     This is the only reader which makes distinctions between the
     various segment types in the SPK format. The complete list
     of types currently supported is shown below.

        Type   Description
        ----   -----------------------
           1   Difference Lines
           2   Chebyshev (P)
           3   Chebyshev (P,V)
           4   Weighted elements ( not yet implemented )
           5   Two body propagation between discrete states
           8   Lagrange interpolation, equally spaced discrete states
           9   Lagrange interpolation, unequally spaced discrete states
          12   Hermite interpolation, equally spaced discrete states
          13   Hermite interpolation, unequally spaced discrete states
          14   Chebyshev Unequally spaced
          15   Precessing Ellipse
          17   Equinoctial Elements

     SPKPVN is the only reader that needs to be changed in order to
     add a new segment type to the SPK format.  If a new data type is
     added, the following steps should be taken:

     1) Write two new routines, SPKRnn and SPKEnn, to read and
        evaluate, respectively, a record from a data type nn segment.

     2) Insert a new case into the body of SPKPVN to accommodate the
        new type.

     3) If necessary, adjust the parameter MAXREC, above, so that it
        is large enough to encompass the maximum size of a record
        returned by SPKRnn and passed to SPKEnn.

        The maximum record lengths for each data type currently
        supported are as follows:

                  Data type       Maximum record length
                  ---------       ---------------------
                      1                    71
                      2                    66
                      3                   129
                      5                    15
                      8                    99
                      9                   113
                     12                    51
                     13                    57
                     14                 Variable
                     15                    16
                     17                    12
                     18                   114

Examples

     In the following code fragment, an entire SPK file is searched
     for segments containing a particular epoch. For each one found,
     the body, center, segment identifier, and range at the epoch
     are printed out.

        CALL DAFOPR ( 'TEST.SPK', HANDLE )
        CALL DAFBFS (             HANDLE )

        CALL DAFFNA ( FOUND  )

        DO WHILE ( FOUND )
           CALL DAFGS ( DESCR )
           CALL DAFUS ( DESCR, 2, 6, DC, IC )

           IF ( DC(1) .LE. ET  .AND.  ET .LE. DC(2) ) THEN
              CALL SPKPVN ( HANDLE, DESCR, ET, REF, STATE, CENTER )
              CALL DAFGN  ( IDENT )
              CALL FRMNAM ( REF, FRAME )
              WRITE (*,*)
              WRITE (*,*) 'Body   = ', IC(1)
              WRITE (*,*) 'Center = ', CENTER,
              WRITE (*,*) 'ID     = ', IDENT
              WRITE (*,*) 'Frame  = ', FRAME
              WRITE (*,*) 'Range  = ', VNORM ( STATE )
           END IF

           CALL DAFFNA ( FOUND )
        END DO

Restrictions

     None.

Literature_References

     None.

Author_and_Institution

     N.J. Bachman    (JPL)
     W.L. Taber      (JPL)

Version

    SPICELIB Version 3.0.0,  16-AUG-2002 (NJB)

        Added support for type 18.  This routine now uses the
        include file spkrec.inc to declare the record size.

        Corrected header comments giving record sizes for types
        8, 9, 12, 13.

    SPICELIB Version 2.0.0,  06-NOV-1999 (NJB)

        Added support for types 12 and 13.

    SPICELIB Version 1.1.0,  7-JAN-1997 (WLT)

        Added support for type 17.

    SPICELIB Version 1.0.0, 19-SEP-1995 (WLT)
Tue Mar  4 09:41:51 2008