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_spkw10

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


Abstract


   CSPICE_SPKW10 writes an SPK type to the file specified by
   the input `handle'.

I/O


   Given:

      handle   the scalar integer handle of an SPK file opened with write
               access.

               help, handle
                  LONG = Scalar

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

               help, body
                  LONG = Scalar

      center   the NAIF ID for the center of motion associated with `body'.

               help, center
                  LONG = Scalar

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

               help, frame
                  STRING = Scalar

      first,
      last     the bounds on the ephemeris times, expressed as seconds past
               J2000, for which the states can be used to interpolate a state
               for `body'.

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

      segid    the scalar string holding to the segment identifier.

               help, segid
                  STRING = Scalar

               An SPK segment identifier may contain up to 40 printing ASCII
               characters.

      consts   an 8-vector of double precision geophysical constants needed for
               evaluation of the two line elements sets.

               help, consts
                  DOUBLE = Array[8]

               The order of these constants must be:

                  consts[0] = J1 gravitational harmonic for Earth.
                  consts[1] = J2 gravitational harmonic for Earth.
                  consts[2] = J3 gravitational harmonic for Earth.

               These first three constants are dimensionless.

                  consts[3] = KE: Square root of the GM for Earth where
                              GM is expressed in Earth radii cubed per
                              minutes squared.

                  consts[4] = QO: High altitude bound for atmospheric
                              model in km.

                  consts[5] = SO: Low altitude bound for atmospheric
                              model in km.

                  consts[6] = RE: Equatorial radius of the earth in km.

                  consts[7] = AE: Distance units/earth radius
                              (normally 1)

               Below are currently recommended values for these
               items:

                  J1 =    1.082616D-3
                  J2 =   -2.53881D-6
                  J3 =   -1.65597D-6

               The next item is the square root of GM for the Earth
               given in units of earth-radii**1.5/Minute

                  KE =    7.43669161D-2

               The next two items define the top and bottom of the
               atmospheric drag model used by the type 10 ephemeris
               type. Don't adjust these unless you understand the full
               implications of such changes.

                  QO =  120.0D0
                  SO =   78.0D0

               The ER value is the equatorial radius in km of the Earth
               as used by NORAD.

                  ER = 6378.135D0

               The value of AE is the number of distance units per
               Earth radii used by the NORAD state propagation
               software. The value should be 1 unless you've got a very
               good understanding of the NORAD routine SGP4 and the
               affect of changing this value.

                  AE =    1.0D0

      n        the scalar integer number of "two-line" element sets and epochs
               to be stored in the segment.

               help, n
                  LONG = Scalar

      elems    a double precision 10*n-vector of time-ordered two-line elements
               as supplied in NORAD two-line element files.

               help, elems
                  DOUBLE = Array[10*n]

               The i'th set of elements should be stored as shown here:

                  base = i*10

                  elems[ base + 0 ] = NDT20 in radians/minute**2
                  elems[ base + 1 ] = NDD60 in radians/minute**3
                  elems[ base + 2 ] = BSTAR
                  elems[ base + 3 ] = INCL  in radians
                  elems[ base + 4 ] = NODE0 in radians
                  elems[ base + 5 ] = ECC
                  elems[ base + 6 ] = OMEGA in radians
                  elems[ base + 7 ] = M0    in radians
                  elems[ base + 8 ] = N0    in radians/minutes
                  elems[ base + 9 ] = EPOCH of the elements in seconds
                                      past ephemeris epoch J2000.

               The meaning of these variables is defined by the
               format of the two-line element files available from
               NORAD.

      epochs   a double precision n-vector of epochs (ephemeris seconds past
               J2000) corresponding to the elements in `elems'.

               help, epochs
                  DOUBLE = Array[n]

               The i'th epoch must equal the epoch of the i'th element set.
               `epochs' must form a strictly increasing sequence.

   the call:

      cspice_spkw10, handle, body,   center, frame, first, last,             $
                     segid,  consts, n,      elems, epochs

   writes to the SPK file referred to by `handle' a type 10 SPK
   segment containing the data listed in `elems'.

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 you have collected the two-line element data
      for a spacecraft with NORAD ID 18123. The following example
      code demonstrates how you could go about creating a type 10
      SPK segment.

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


         KPL/MK

         File name: spkw10_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
            ---------           ------------------------------------
            naif0012.tls        Leapseconds
            geophysical.ker     geophysical constants for evaluation
                                of two-line element sets.

         The geophysical.ker is a PCK file that is provided with the
         SPICE toolkit under the "/data" directory.

         \begindata

            KERNELS_TO_LOAD = ( 'naif0012.tls',
                                'geophysical.ker'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO spkw10_ex1

         ;;
         ;; Local parameters.
         ;;
         SPK10  =   'spkw10_ex1.bsp'

         ;;
         ;; The SPK type 10 segment will contain 18 two-line
         ;; elements sets for the `norad' spacecraft 18123 with
         ;; respect to the Earth (ID 399) in the J2000 reference
         ;; frame.
         ;;
         ;; As stated in the naif_ids required reading, for Earth
         ;; orbiting spacecraft lacking a DSN identification code,
         ;; the NAIF ID is derived from the tracking ID assigned to
         ;; it by `norad' via:
         ;;
         ;;    NAIF ID = -100000 - norad ID code
         ;;
         TLESSZ =   9L
         BODY   =   -118123L
         CENTER =   399L
         FRMNAM =   'J2000'

         ;;
         ;; Local variables
         ;;
         consts = dblarr( 8           )
         epochs = dblarr(      TLESSZ )
         elems  = dblarr( 10 * TLESSZ )

         ;;
         ;; These are the variables that will hold the constants
         ;; required by SPK type 10. These constants are available
         ;; from the loaded PCK file, which provides the actual
         ;; values and units as used by NORAD propagation model.
         ;;
         ;;    Constant   Meaning
         ;;    --------   ------------------------------------------
         ;;    J2         J2 gravitational harmonic for Earth.
         ;;    J3         J3 gravitational harmonic for Earth.
         ;;    J4         J4 gravitational harmonic for Earth.
         ;;    KE         Square root of the GM for Earth.
         ;;    QO         High altitude bound for atmospheric model.
         ;;    SO         Low altitude bound for atmospheric model.
         ;;    ER         Equatorial radius of the Earth.
         ;;    AE         Distance units/earth radius.
         ;;
         noadpn = [ 'J2', 'J3', 'J4', 'KE', 'QO', 'SO', 'ER', 'AE' ]

         ;;
         ;; Define the Two-Line Element sets.
         ;;
         tle    = [ '1 18123U 87 53  A 87324.61041692 -.00000023  ' +         $
                                         '00000-0 -75103-5 0 00675',          $
                      '2 18123  98.8296 152.0074 0014950 168.7820 ' +         $
                                       '191.3688 14.12912554 21686',          $
                    '1 18123U 87 53  A 87326.73487726  .00000045  ' +         $
                                         '00000-0  28709-4 0 00684',          $
                      '2 18123  98.8335 154.1103 0015643 163.5445 ' +         $
                                       '196.6235 14.12912902 21988',          $
                    '1 18123U 87 53  A 87331.40868801  .00000104  ' +         $
                                         '00000-0  60183-4 0 00690',          $
                      '2 18123  98.8311 158.7160 0015481 149.9848 ' +         $
                                       '210.2220 14.12914624 22644',          $
                    '1 18123U 87 53  A 87334.24129978  .00000086  ' +         $
                                         '00000-0  51111-4 0 00702',          $
                      '2 18123  98.8296 161.5054 0015372 142.4159 ' +         $
                                       '217.8089 14.12914879 23045',          $
                    '1 18123U 87 53  A 87336.93227900 -.00000107  ' +         $
                                         '00000-0 -52860-4 0 00713',          $
                      '2 18123  98.8317 164.1627 0014570 135.9191 ' +         $
                                       '224.2321 14.12910572 23425',          $
                    '1 18123U 87 53  A 87337.28635487  .00000173  ' +         $
                                         '00000-0  10226-3 0 00726',          $
                      '2 18123  98.8284 164.5113 0015289 133.5979 ' +         $
                                       '226.6438 14.12916140 23475',          $
                    '1 18123U 87 53  A 87339.05673569  .00000079  ' +         $
                                         '00000-0  47069-4 0 00738',          $
                      '2 18123  98.8288 166.2585 0015281 127.9985 ' +         $
                                       '232.2567 14.12916010 24908',          $
                    '1 18123U 87 53  A 87345.43010859  .00000022  ' +         $
                                         '00000-0  16481-4 0 00758',          $
                      '2 18123  98.8241 172.5226 0015362 109.1515 ' +         $
                                       '251.1323 14.12915487 24626',          $
                    '1 18123U 87 53  A 87349.04167543  .00000042  ' +         $
                                         '00000-0  27370-4 0 00764',          $
                      '2 18123  98.8301 176.1010 0015565 100.0881 ' +         $
                                       '260.2047 14.12916361 25138' ]

         ;;
         ;; Load the PCK file that provides the geophysical
         ;; constants required for the evaluation of the two-line
         ;; elements sets. Load also an LSK, as it is required by
         ;; cspice_getelm to perform time conversions. Use a metakernel for
         ;; convenience.
         ;;
         cspice_furnsh, 'spkw10_ex1.tm'

         ;;
         ;; Retrieve the data from the kernel, and place it on
         ;; the `consts' array.
         ;;
         for i=0L, 7L do begin

            cspice_bodvcd, CENTER, noadpn[i], 1L, tmpConsts
            consts[i] = tmpConsts

         endfor

         ;;
         ;; Convert the Two Line Elements lines to the
         ;; element sets.
         ;;
         for i=0L, TLESSZ-1L do begin

            cspice_getelm, 1950L, tle[i*2:i*2+1], tmpEpochs, tmpElems

            epochs[i]           = tmpEpochs
            elems [i*10:i*10+9] = tmpElems

         endfor

         ;;
         ;; Define the beginning and end of the segment to be
         ;; -/+ 12 hours from the first and last epochs,
         ;; respectively.
         ;;
         first  = epochs[0]        - 0.5D0 * cspice_spd()
         last   = epochs[TLESSZ-1] + 0.5D0 * cspice_spd()

         ;;
         ;; `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 10 SPK internal file name'
         segid  = 'SPK type 10 test segment'

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

         ;;
         ;; Now add the segment.
         ;;
         cspice_spkw10, handle, BODY,   CENTER, FRMNAM, first, last,         $
                        segid,  consts, TLESSZ, elems,  epochs

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

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

      END


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

Particulars


   This routine writes a type 10 SPK segment to the SPK file open
   for writing that is attached to `handle'.

   The routine cspice_getelm reads two-line element sets, as those
   distributed by NORAD, and converts them to the elements in units
   suitable for use in this routine.

Exceptions


   1)  If the structure or content of the inputs are invalid, an
       error is signaled by a routine in the call tree of this
       routine.

   2)  If any file access error occurs, the error is signaled by a
       routine in the call tree of this routine.

   3)  If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `consts', `n', `elems' or
       `epochs', is undefined, an error is signaled by the IDL error
       handling system.

   4)  If any of the input arguments, `handle', `body', `center',
       `frame', `first', `last', `segid', `consts', `n', `elems' or
       `epochs', 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


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ
   NAIF_IDS.REQ
   SPK.REQ

Literature_References


   [1]  F. Hoots and R. Roehrich, "Spacetrack Report #3: Models
        for Propagation of the NORAD Element Sets," U.S. Air
        Force Aerospace Defense Command, Colorado Springs, CO,
        1980.

   [2]  F. Hoots, "Spacetrack Report #6: Models for Propagation
        of Space Command Element Sets,"  U.S. Air Force
        Aerospace Defense Command, Colorado Springs, CO, 1986.

   [3]  F. Hoots, P. Schumacher and R. Glover, "History of
        Analytical Orbit Modeling in the U. S. Space
        Surveillance System," Journal of Guidance, Control, and
        Dynamics. 27(2):174-185, 2004.

   [4]  D. Vallado, P. Crawford, R. Hujsak and T. Kelso,
        "Revisiting Spacetrack Report #3," paper AIAA 2006-6753
        presented at the AIAA/AAS Astrodynamics Specialist
        Conference, Keystone, CO., August 21-24, 2006. >>>>>>>
        master

Author_and_Institution


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

Version


   -Icy Version 1.0.1, 05-NOV-2021 (JDR) (MCS)

       Edited the header to comply with NAIF standard. Updated existing
       code example to add comments and formatting according to the
       standard.

       Added -Parameters and -Particulars sections, and naif_ids.req to
       the list of required readings.

       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, 16-NOV-2007 (EDW)

Index_Entries


   Write a type_10 SPK segment



Fri Dec 31 18:43:07 2021