The GalSat routines

Keithth G

New member
Joined
Nov 20, 2014
Messages
272
Reaction score
0
Points
0
Attached is a C code version of the GalSat (Galilean Satellite) routines.

The GalSat routines are used by Orbiter 2010 to calculate the position of the Galilean moons - Io, Europa, Ganymede and Callisto. As part of the development of my own 'offline' numerical integrator, I have transcribed the original Fortran versions of this code to C. For any given MJD, these routines return positions of the Galilean moons that are with a few tens of metres of those reported by Orbiter. For those without access to 'Celbody' routines (or wishing to develop their own offline mission planning tools), these routines may help.


The GalSat routines
The GalSat routines were developed by a researcher, Jay Lieske, in the mid 1970s and upgraded from the B1950 reference frame to the more modern J2000 reference frame in around 1997. Until relatively recently, these routines provided the backbone of NASA's mission planning to the Jupiter system. Now, they provide the backbone of mission planning within Orbiter.

The original routines were written in Fortran. The source files can be found here:
http://cococubed.asu.edu/code_pages/ephemeris.shtml
along with a number of other planetary system ephemerides - Mars, Saturn and Uranus. The Fortran code is not easy to read or understand, and I spent many frustrating hours trying to make the translation to C. It seems something of a kindness to offer these routines so that others don't have to experience the same pain.

The C code versios
The attached zip file contains a number of '.c' and '.h' files. The ones containing the GalSat routines are in the ingloriously labelled 'test.c' and 'test.h'. There are a number of other routines prefixed by 'Sun' and 'Jupiter'. These contain the full VSOP87 series to convert the output of the 'test' (GalSat) routines to Orbiter's global co-ordinate system.

In addition, I have included the VSOP87 series for Saturn and Uranus because these systems exert a weak gravitational influence on a body close to the Jupiter system. For the purpose of my calculations, I have generally ignored gravitational perturbations due to the inner planets.

I have also included a control routine - 'Orbiter.c' that brings all of these routines together and returns the position of the Sun, Jupiter, the four Galilean moons, Saturn and Uranus for any given MJD. For all intents and purposes, the values that are returned are the same as those that would be returned by Orbiter.

I intended to use these routines as a plug-in to a program called 'Mathematica' and so there is some reference in Orbiter.c to things that are needed to interface with Mathematica. These include a 'math link.h' header file and a series of MLPut commands. Any reasonably competent C programmer an, I think, simply strip out those few lines of Mathematica specific code and replace with their own interface.

The package of routines produces planetary positions in this fashion with a view to using this information as input to an n-body numerical integrator. The positions are needed to work out the force on a spacecraft at any time; and the force is needed to work out the trajectory. Others may find other uses for these routines.

Commenting
C aficionados may complain that the level of commenting in the files is low and that they are poorly structured. Perhaps. The VSOP87 code was obtained from an online automatic code generator for the VSOP87 series; and the C version of the GalSat routines are based on a direct transcription of some very ugly and poorly commented Fortran code. All I can say here is that I did my best.
 
Last edited:
Top