Table of contents
CSPICE_SPKSSB returns the geometric state (position and
velocity) of a target body relative to the solar system
barycenter.
Given:
targ the standard NAIF ID code for a target body.
help, targ
LONG = Scalar
et the epoch (ephemeris time) at which the state of the target body
is to be computed.
help, et
DOUBLE = Scalar
ref the name of the reference frame relative to which the output
state vector should be expressed.
help, ref
STRING = Scalar
This may be any frame supported by the Icy frame system,
including dynamic and other non-inertial frames.
the call:
cspice_spkssb, targ, et, ref, starg
returns:
starg a Cartesian state vector representing the position and velocity
of the target body, relative to the solar system barycenter, at
epoch `et'.
help, starg
DOUBLE = Array[6]
This vector is rotated into the specified reference frame.
Units are always km and km/sec.
None.
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) Look-up the geometric state vector of Mars (499) and Earth (399)
with respect to the Solar System Barycenter in the J2000 frame
and compute the absolute distance between the two bodies at
epoch July 4, 2003 11:00 AM PST.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File: spkssb_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
--------- --------
de430.bsp Planetary ephemeris
mar097.bsp Mars satellite ephemeris
naif0011.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de430.bsp',
'mar097.bsp',
'naif0011.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO spkssb_ex1
;;
;; Load a set of kernels: an SPK file, a PCK
;; file and a leapseconds file. Use a meta
;; kernel for convenience.
;;
cspice_furnsh, 'spkssb_ex1.tm'
;;
;; Define parameters for a state lookup:
;;
targ1 = 499
epoch = 'July 4, 2003 11:00 AM PST'
frame = 'J2000'
targ2 = 399
;;
;; Convert the epoch to ephemeris time.
;;
cspice_str2et, epoch, et
;;
;; Look-up the states for the defined parameters.
;;
cspice_spkssb, targ1, et, frame, state1
cspice_spkssb, targ2, et, frame, state2
;;
;; What measure of distance separates the two bodies
;; at epoch.
;;
dist = cspice_vdist( state1[0:2], state2[0:2] )
print, 'The absolute distance (KM) : ', dist
print, 'between Mars and Earth at epoch : ', epoch
;;
;; 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:
The absolute distance (KM) : 80854820.
between Mars and Earth at epoch : July 4, 2003 11:00 AM PST
Note, an cspice_spkgeo call equivalent to the two cspice_spkssb
calls present in the code example:
cspice_spkgeo, targ1, et, frame, targ2, state, ltime
dist = norm( state[0:2] )
In order to compute the state of one body relative to another,
the states of the two bodies must be known relative to a third
body. One simple solution is to use the solar system barycenter
as the third body.
Ephemeris data from more than one segment may be required
to determine the state of a body relative to the barycenter.
cspice_spkssb reads as many segments as necessary, from as many
files as necessary, using files that have been loaded by
previous calls to cspice_furnsh or cspice_spklef (load ephemeris file).
1) If sufficient information has not been "loaded" via the routine
cspice_furnsh, cspice_spklef or the PCK kernel loaders, an error is
signaled by a routine in the call tree of this routine.
2) If any of the input arguments, `targ', `et' or `ref', is
undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `targ', `et' or `ref', is not
of the expected type, or it does not have the expected
dimensions and size, an error is signaled by the Icy
interface.
4) If the output argument `starg' is not a named variable, an
error is signaled by the Icy interface.
See -Restrictions.
1) The ephemeris files to be used by cspice_spkssb must be loaded
by cspice_furnsh or cspice_spklef before cspice_spkssb is called.
ICY.REQ
SPK.REQ
FRAMES.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.1, 01-JUN-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement and meta-kernel. Added cspice_kclear call to
example code.
Added -Parameters, -Exceptions, -Files, -Restrictions, -Particulars,
-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, 16-JUN-2003 (EDW)
state relative to solar system barycenter
|