Wednesday, March 28, 2007

Orbiter for Educators: Using JPL Horizons

JPL's Horizons system is a public-access database with current orbital data on many, many objects in the Solar System (both natural objects and spacecraft). Orbiter is a space flight simulator which includes a "scenario editor" that lets you interactively change the orbital data for any spacecraft in the scenario you are currently running. I was going to write an entry on how to use the web interface for Horizons to get information on (say) the Saturn-orbiting Cassini spacecraft and then transfer it to Orbiter using the Orbiter Scenario Editor. But before I could write this up, I found a better way, thanks to Tony Dunn, author of Gravity Simulator 2.0 (and also an Orbiter user).

First some general information. I won't attempt to explain Horizons itself - the FAQ and web access tutorial can do that. There are two basic types of data you can get, orbital ELEMENTS, and VECTORS (called "state vectors" in Orbiter), which we will use here. These are basically the (x,y,z) position and (Vx,Vy,Vz) velocity of the object relative to some reference body (e.g., Sun, Earth, Saturn, etc.), at a specific date and time. The date and time are encoded as a number called the "Julian Date" (JD), though Orbiter uses a modified version called (logically enough) "Modified Julian Date" (MJD). The idea is to get accurate information on an object of interest from Horizons, convert it if necessary, and enter it into Orbiter, so you can answer a question like "what does Saturn look like from Cassini right now?"

Conceptually this is quite easy (grab the date and vectors and pop them into the scenario editor), but there are a few things to learn, including the right questions to ask Horizons, and how to get the resulting data into Orbiter. Units, dates, coordinates, and reference bodies require a bit of explaining and possibly some conversions (m vs. km etc.). Nothing terrible, mind you, just a few details to keep straight.

Tony Dunn provides an easier way with his simple little utility program cfgData.exe (120 KB .exe file download) and the Horizons "batch" email interface. Download the program to any convenient directory (no installation needed) and run it. You can then enter the desired date/time and choose the object (e.g., Cassini Spacecraft, object -82 for JPL) and "center body" (e.g., Saturn barycenter, object 6 for JPL) from drop down lists of available JPL objects. Choose VECTORS, click [Create E-mail], and copy the resulting block of text to the clipboard with the button that appears. Go to your email program and create a new message. Paste the text into the body of a new email window, enter job as the subject, email to horizons@ssd.jpl.gov, and wait for the reply (usually very quick).

Select ALL the text of the reply and copy to the clipboard (check for error messages first - I just requested Cassini data for March 2009 and it's not available). Back in the cfgData window, click the [next > ] button (a new window appears), paste the return text into the new window, and click the [Create Data] button...

This is where it gets slightly tricky. The MJD and state vector data has to be copied and pasted into the right spot in an Orbiter scenario (.scn) file using a text editor like Notepad. It's easiest if you already have a scenario that is generally doing the right thing (like orbiting Saturn), so you only have to paste in the new MJD, RPOS, and RVEL data over the prior data, save it, then launch Orbiter and run your new scenario.

How do you get that starting scenario? If you've installed the Cassini add-on (shown above on 3-27-07) you will have a scenario (in the Grand Explorations folder) called Cassini Phoebe Flyby.scn which will have Cassini with STATUS Orbiting Saturn. Just copy the new date (MJD) and replace it in this file, copy the RPOS and RVEL lines in place of the old ones, Save As with a new name, and you're ready to run. Or take any Earth-orbiting scenario with a spacecraft (Deltaglider or whatever) with STATUS Orbiting Earth and change Earth to Saturn, paste MJD, RPOS, RVEL data, save, and run.

Note: You can also get orbital elements from Horizons for natural bodies such as asteroids and use this data in configuration files to add these objects to your Orbiter solar system. This has more steps, and you might consider using this utility to easily define minor planets in Orbiter.

No comments: