[Spice_discussion] how accurate is conics?
Trent Waddington
trent.waddington at gmail.com
Wed Sep 1 20:00:06 PDT 2010
I'm trying to get a feel for how much ephemeris generated by the
HORIZONS system differs from the mathematical ideal. I've been
looking at asteroids but, as a bit of a sanity check, I decided to
write some code to compare the output of conics with the precalculated
ephemeris of the Moon. The kernels I'm using are:
\begindata
KERNELS_TO_LOAD = ( 'naif0009.tls',
'pck00009.tpc',
'de421.bsp',
'earth_000101_101105_100814.bpc',
)
\begintext
and when stepping just 30 days I get a difference in position of
24891km using the following code. Substituting another satellite
gives similar results. Any hints on what I'm doing wrong here - or
even just whether my expectations are wrong - would be much
appreciated.
#include <stdlib.h>
#include <stdio.h>
#include "SpiceUsr.h"
#include <math.h>
#include <string.h>
#define sun_mu 1.3271244001798698E+11
#define earth_mu 3.9860043289693922E+05
int main(int argc, char **argv)
{
SpiceInt code = 301;
SpiceDouble step = 30*24*60*60;
furnsh_c("metakernel");
// just an arbitrary start time
SpiceDouble tdb;
str2et_c("2000-JAN-01", &tdb);
// grab current position of the Moon
SpiceDouble gst[6];
SpiceDouble light_time;
spkez_c(code, tdb, "J2000", "NONE", 399, gst, &light_time);
// convert to elements
SpiceDouble elts[8];
oscelt_c(gst, tdb, earth_mu, elts);
// get the state after some step
SpiceDouble st[6];
conics_c(elts, tdb + step, st);
// get the ephemeris at that step
SpiceDouble ost[6];
spkez_c(code, tdb + step, "J2000", "NONE", 399, ost, &light_time);
// calculate the difference
SpiceDouble diff[3];
vsub_c(st, ost, diff);
printf("change %f\n", vnorm_c(diff));
return 0;
}
More information about the Spice_discussion
mailing list