Table of contents
CSPICE_CONICS determines the state (position, velocity) of an orbiting
body from a set of elliptic, hyperbolic, or parabolic orbital elements.
Given:
elts conic elements describing the orbit of a body around a 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 periapse.
M0 Mean anomaly at epoch.
T0 Epoch.
MU Gravitational parameter.
Units are km, rad, rad/sec, km**3/sec**2. The epoch
is given in ephemeris seconds past J2000. The same
elements are used to describe all three types
(elliptic, hyperbolic, and parabolic) of conic orbit.
et the time at which the state of the orbiting body is to be
determined, in ephemeris seconds J2000.
help, et
DOUBLE = Scalar or DOUBLE = Array[N]
the call:
cspice_conics, elts, et, state
returns:
state the state (position and velocity) of the body at time `et', in
km and km/sec.
help, state
DOUBLE = Array[6] or DOUBLE = Array[6,N]
Components are x, y, z, dx/dt, dy/dt, dz/dt.
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) Calculate the difference between the
state elements of the Moon at some time as determined
from SPK data and the corresponding state elements
determined from propagation of osculating elements.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: conics_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
--------- --------
de421.bsp Planetary ephemeris
pck00010.tpc Planet orientation and
radii
gm_de431.tpc Gravitational constants
naif0012.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'pck00010.tpc',
'gm_de431.tpc',
'naif0012.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO conics_ex1
;;
;; Load the meta kernel listing the needed SPK, PCK, LSK
;; kernels.
;;
cspice_furnsh, 'conics_ex1.tm'
;;
;; Convert the time of interest, provides as a string, to ephemeris
;; time.
;;
cspice_str2et, 'Dec 25, 2007', et
;;
;; Make the cspice_spkezr call to retrieve the state of the
;; Moon w.r.t. the Earth in J2000. Use 'NONE' as aberration
;; correction since we are comparing geometric states.
;;
cspice_spkezr, 'Moon', et, 'J2000', 'NONE', 'EARTH', state, ltime
;;
;; Read the gravitational parameter for Earth.
;;
cspice_bodvrd, 'EARTH', 'GM', 1, mu
;;
;; Execute the cspice_oscelt call to convert the state 6-vector
;; to the osculating elements 8-vector, 'elts', at 'et'. The
;; osculating elements are relative to the same frame as 'state'.
;;
;; The elements describe the nominal orbit the Moon would follow
;; in the absence of all other bodies in the solar system and
;; and all non-gravitational forces.
;;
;; Note: the cspice_bodvrd call 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
;;
;; Now, select a time one week from the initial epoch.
;;
later = et + 7.d * cspice_spd()
;;
;; Use the osculating elements to calculate the state vector
;; of the Moon at the 'later' epoch.
;;
cspice_conics, elts, later, later_state
;;
;; Now retrieve the Moon's state at time 'later' from SPK
;; data.
;;
cspice_spkezr, 'Moon', later, 'J2000', 'NONE', 'EARTH', state, ltime
;;
;; Display the absolute diff between the vector output by
;; cspice_conics and the state vector returned by cspice_spkezr.
;;
pert = later_state - state
print, "Perturbation in x: ", pert[0]
print, "Perturbation in y: ", pert[1]
print, "Perturbation in z: ", pert[2]
print, "Perturbation in dx/dt: ", pert[3]
print, "Perturbation in dy/dt: ", pert[4]
print, "Perturbation in dz/dt: ", pert[5]
;;
;; 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:
Perturbation in x: -7488.8598
Perturbation in y: 397.61008
Perturbation in z: 195.74558
Perturbation in dx/dt: -0.036152760
Perturbation in dy/dt: -0.0012792667
Perturbation in dz/dt: -0.0020145887
None.
1) If the eccentricity supplied is less than 0, the error
SPICE(BADECCENTRICITY) is signaled by a routine in the call
tree of this routine.
2) If a non-positive periapse distance is supplied, the error
SPICE(BADPERIAPSEVALUE) is signaled by a routine in the call
tree of this routine.
3) If a non-positive value for the attracting mass is supplied,
the error SPICE(BADGM) is signaled by a routine in the call
tree of this routine.
4) If `elts' is such that the resulting orbit at periapsis has
either its position or velocity equal to zero, or the square
of the resulting specific angular momentum's magnitude is
zero, an error is signaled by a routine in the call tree of
this routine. This is an indication of invalid `elts' elements.
5) If `et' is such that the offset in time from periapsis, at which
the state is to be determined, is so large that there is a
danger of floating point overflow during computation, an error
is signaled by a routine in the call tree of this routine.
6) If any of the input arguments, `elts' or `et', is undefined,
an error is signaled by the IDL error handling system.
7) If any of the input arguments, `elts' or `et', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
8) If the input vectorizable arguments `elts' and `et' do not
have the same measure of vectorization (N), an error is
signaled by the Icy interface.
9) If the output argument `state' is not a named variable, an
error is signaled by the Icy interface.
None.
None.
ICY.REQ
[1] R. Bate, D. Mueller, and J. White, "Fundamentals of
Astrodynamics," Dover Publications Inc., 1971.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.1, 31-MAY-2021 (JDR)
Edited the header to comply with NAIF standard. Added cspice_kclear
and meta-kernel to the example.
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 8xN array 'elts' and
N-vector 'et' input returning a 6xN 'state' array.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
state from conic elements
|