CSPICE_CONICS determines the state (position, velocity) of an orbiting
body from a set of elliptic, hyperbolic, or parabolic orbital elements.
For important details concerning this module's function, please refer to
the CSPICE routine conics_c.
elts a double precision 8-vector containing the conic osculating
elements describing the orbit of a body around a primary.
The elements are, in order:
RP Perifocal distance.
LNODE Longitude of the ascending node.
ARGP Argument of periapse.
M0 Mean anomaly at epoch.
MU Gravitational parameter.
Units are km, rad, rad/sec, km**3/sec**2.
The epoch T0 is given in ephemeris seconds past J2000.
T0 is the instant at which the state of the body is
specified by the elements.
et the scalar double precision time in ephemeris seconds past
J2000 at which the state of the orbiting body is to be
cspice_conics, elts, et, state
state a double precision Cartesian 6-vector representing the state
(position and velocity) of the body at time 'et'
in kilometers and kilometers-per-second (the first
three components of 'state' represent the x-, y- and
z-components of the body's position; the last three
components form the corresponding velocity vector)
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.
;; 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.
;; Load the meta kernel listing the needed SPK, PCK, LSK
;; 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
;; cspice_oscelt requires body mass information, so load a
;; mass PCK kernel that contains gravitation constants.
;; 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'.
cspice_oscelt, state, et, mu, 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
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
print, "Perturbation in y: ", pert
print, "Perturbation in z: ", pert
print, "Perturbation in dx/dt: ", pert
print, "Perturbation in dy/dt: ", pert
print, "Perturbation in dz/dt: ", pert
Perturbation in x: -7488.8162
Perturbation in y: 397.60470
Perturbation in z: 195.74585
Perturbation in dx/dt: -0.036152592
Perturbation in dy/dt: -0.0012792366
Perturbation in dz/dt: -0.0020145613
-Icy Version 1.1.0, 16-MAY-2005, EDW (JPL)
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 (JPL)
state from conic elements