Spacecraft Models Package 2.0
Spacecraft Models for DSim
|
SPICE library ephemeris interface class. More...
#include <gravity_spice_jupiter.h>
Inherits dsim_model.
Public Member Functions | |
gravity_spice_jupiter (dsim_model_setup *setup) | |
Constructor. | |
~gravity_spice_jupiter () | |
Destructor. | |
void * | describe_setup (void *ds) |
Describe the setup data. | |
bool | parse_setup (const char *command, const char *data) |
Parse input setup commands. More... | |
void | initialize_data () |
Initialize the model data. More... | |
void | initialization_complete () |
Finish initialization. | |
void | initialize_timestep () |
Computations done prior to numerical integration. More... | |
void | rhs (double t, double jd) |
Right hand side. | |
void | complete_timestep () |
Computations done after numerical integration. | |
Protected Attributes | |
dsim_variable | parent_mass |
mass of parent object | |
dsim_variable | parent_pos |
position of parent object | |
dsim_variable | parent_vel |
velocity of parent object | |
SPICE library ephemeris interface class.
Compute gravity for planets specified by using the SPICE ephemeris routines. Maintains an index to the center body and treats the others as perturbations. This model must be a direct child of the object subject to gravity. Makes available ephemeris data including the position, velocity, and radius of the bodies.
As with all PSS gravity models, for the purposes of gravitional acceleration computation the spacecraft position vector is considered to be sum of the spacecraft position vector and the center of mass vector:
In this equation, is the rotation matrix from body coordinates to ECI, produced from the parent quaternion.
This routine loads SPICE ephemeris and uses it to compute the acceleration on the parent object due to gravity.
This provides an interface to load SPK files and get body states using the SPICE library function spkgeo_c. The DSim epoch in Julian Date is assumed to be in Terrestrial DT.
Bodies are referred to by their NAIF integer IDs. The planet barycenters have low IDs, i.e. 0 - solar system, 1 - Mercury, 3 - Earth/Moon, 10 - sun. The planets themselves are the 99th body of the barycenter, i.e. Mercury - 199, Earth - 399, Moon - 301. Spacecraft have negative IDs.
Built-in inertial frames are J2000 (Earth mean equator and equinox of J2000 frame), and ECLIPJ2000 (Mean ecliptic and equinox of J2000).
This model requires access to the leapsecond kernel, naif0008.tls, at the root level. This file is in effect until at least December 31, 2008.
SPICE toolkit from NAIF http://naif.jpl.nasa.gov/naif/
bool gravity_spice_jupiter::parse_setup | ( | const char * | command, |
const char * | data | ||
) |
Parse input setup commands.
Parses AddBody and AddCenter lines and adds planets to the linked list.
The AddBody command is followed by the planet name or ID, for example:
AddBody Sun, or AddBody 10
AddCenter Earth, or AddCenter 399 AddBody Jupiter
A separate line is required for each planet.
Adding a planet causes a set of published variables to be added to the model, including:
A frame may be selected using SetFrame. The available frames are
void gravity_spice_jupiter::initialize_data | ( | ) |
Initialize the model data.
String for SPICE frame, name, i.e. "J2000" or "ECLIPJ2000"
References accel, angularRateVectorBody, distance_from_jupiter_center_change_dsim, muBody_dsim, n_files, observer, planet_index, positionBody, radiusBody, rotationMatrixBody, and velocityBody.
void gravity_spice_jupiter::initialize_timestep | ( | ) |
Computations done prior to numerical integration.
Step the ephemeris at the beginning of the timestep.
SJT: better to update every intermediate step for big timesteps? Loop through the planet IDs and make a call to the SPICE library for each target. Use the current DSim Julian Date as the epoch. If no files have been loaded, output zero.
References planet_index.