Using a SPICE Ephemeris
|Top Previous Next|
FreeFlyer also allows the user to propagate a Spacecraft using a SPICE Ephemeris. SPICE Ephemerides are set up differently than the other supported ephemeris formats discussed on the Setting up an Ephemeris page.
SPICE files are ephemerides created and maintained by the Navigation and Ancillary Information Facility (NAIF) Node of the Planetary Data System. SPICE ephemerides can be used to define the motion of Spacecraft or Celestial Objects in FreeFlyer. For more information on SPICE files, including instructions on how to obtain them, see the SPICE Files page of the Ephemerides and AHF section of the Appendix.
Configuring a Spacecraft to use a SPICE Ephemeris
The SpiceEphemeris object is only available via FreeFlyer script. From script, you can either create a Spacecraft using a SpiceEphemeris or override an existing Spacecraft's propagator with a new SpiceEphemeris propagator.
To create a new Spacecraft that uses a SpiceEphemeris Propagator, use the following syntax:
To override an existing Spacecraft's propagator with a new SpiceEphemeris Propagator, use the SetPropagatorType() method:
Once you've changed the propagator to be a SpiceEphemeris, access the properties of the SpiceEphemeris Propagator object using the following syntax:
Setting the Observer and Target
When using a SpiceEphemeris as the Propagator for a Spacecraft, you must set the observer and target to use from the SPICE file. The observer corresponds to the desired Central Body for the Spacecraft, and the Target corresponds to the Spacecraft itself.
There are two ways to set the observer and target:
Once the observer and target have been set, ensure that the Spacecraft's Central Body matches the observer:
Note: NAIF ID numbers for asteroids are equal to 2000000 + JPL asteroid number. For example, the asteroid number for Bennu is 101955, and the NAIF ID is 2101955.
Setting the SPICE Ephemeris File(s)
When working with SPICE Ephemerides, you may need to specify more than one input file. You must provide all SPICE Ephemerides necessary to calculate the position of your desired target with respect to the observer. For example, you may have a SPICE file that contains the position of a satellite with respect to Io, and another that contains the position of Io with respect to Jupiter. Both files must be included in the SpiceEphemeris.SpiceFiles array if you want to use the satellite as the target and Jupiter as the observer. If more than one specified SPICE file contains information for a given object at the same time, data from the most recently loaded file takes precedence over the previously loaded data.
The input files may also include any additional leap second files pertinent to your analysis.
Use the following syntax to add a SPICE file to a SpiceEphemeris:
Additional input files can be specified using array indices: , , etc. A common example of using multiple SPICE files is when the ephemeris for the target object uses the solar system barycenter as the observer. Since the solar system barycenter cannot be a Spacecraft's CentralBody, and the Spacecraft CentralBody must match the SpiceEphemeris target, an additional SPICE file which contains system barycenter data must be included. A database of Development Ephemeris (DE) files in the binary SPICE format (.bsp) is maintained here: ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/, and can be used to make the necessary connections between built-in CelestialObjects and the solar system barycenter. In the example below, the asteroid Apophis is being modeled with a SpiceEphemeris based on the solar system barycenter, and the SPICE format DE file is used to allow the SpiceEphemeris to treat the target and CentralBody as the Sun.
Setting the Step Size
A SPICE file represents the position of celestial objects and spacecraft using polynomials instead of discrete vectors, so there is no option to "Step to Ephemeris Points" when working with SPICE ephemerides. To set the Ephemeris Step Size, simply set the step size via FreeFlyer script using this syntax:
Note: As of FreeFlyer 7.3, the default timing precision mode is nanosecond precision mode. For older Mission Plans that have not yet been converted from millisecond precision mode, the syntax for working with times such as step sizes is different. A sample is shown below; see the timing precision mode page for more information.
Creating SPICE Ephemeris Files
In addition to using existing SPICE ephemerides to define the motion of Spacecraft or Celestial Objects, FreeFlyer can export ephemeris files in the SPICE (.bsp) format.
To generate a SPICE ephemeris, start by configuring the Ephemeris object, including the SPICE-specific properties available through the SPKProperties child object. This includes specifying the observer and target names and NAIF IDs:
Note: When generating a SPICE ephemeris, both the name and NAIF ID for the observer and target must be specified. This is different from importing a SPICE ephemeris to use for Spacecraft propagation, where either the names or the NAIF IDs can be specified, but it is not required to use both.
Add data to the ephemeris using the Put command:
Spacecraft state data can also be added to an Ephemeris object using the Ephemeris.AddVectorData() or Ephemeris.SetVectorData() methods. See the Accessing Data in an Ephemeris page for more information.
Finally, export the Ephemeris object to a SPICE ephemeris file: