jueves, 1 de octubre de 2015

JPL Spice in Python


Dealing with Deep Space Spacecrafts orbits: JPL Spice



In this blog entry I am going to talk about the JPL Spice toolkit and how to use it for calculating signal parameters for a real Deep Space Spacecraft.


The JPL Spice toolkit is cool tool that allows us to calculate positions and velocities (the complete state vector) between two objects in the Solar System. It also allows us to see whether a particular FOV (Field of View) of a spacecraft instrument is going to cross the surface of a planet, a moon or any other thing, and when that is going to happen. In Spice there are two well differentiated things: one is the observer and the other one is the target. Nonetheless they are intercambiable, an object can act as the observer or as the target.

JPL uses this tool for mission planification or while using the data obtained by a particular instrument (there is also a standard for archives that takes into account this info, the ancillary data).

In order to provide the Spice library with the necessary data we should load in its pool the files with data about the spacecraft, satellites, receiving station... whatever we need to sort out our problem... These files with data are called Kernels. We have Binary kernels and ASCII kernels. Kernel formats are well documented in the NAIF webpage (NAIF is the department in charge of SPICE in JPL).

There is a very nice training in the NAIF webpage that could be of interest for you if you want to develop your own application. As for now (October 2015) JPL Spice supports Matlab, C, Fortran and IDL.There is a non-official version of Spice for Python, called SpiceyPy, this is the one we are going to use in our examples.

The problem we want to sort out





Extracted form NAIF tutorials

In order to extract details on how we are going to receive the spacecraft signal on Earth we need first to properly understand the Solar System geometry and some timing considerations we have to take into account.
  • Geometrical Considerations: The first thing we should take into account is that we need to know what is the reference frame of interest for each object. Say that you know where your Ground Station is located, for instance the NASA Madrid Deep Space Communication Complex, particularly the DSS-63 antenna, which is 70 meters in diameter. We know that this antenna is located, assuming the Earth is an sphere - if you need more accuracy you should use  kernels with the necessary data about the DSN stations in a topocentric reference frame. You can check here what these kernels look like-, at (4º 14' 53'' 40º 25' 54'') [Don't use these values as I think it points to the middle of the MDSCC not the accurate position of DSS-63].  In this case you have the position of the antenna referenced to the Earth, and you need to know where is the Earth referenced to the Solar System Barycenter (SSB), and also where is your spacecraft... and your spacecraft will probably be referenced to the body it is orbiting (or not) so you will need to know where that body is located referenced to the SSB... all this data should be provided to Spice by means of Kernels. It is not clear in the latter figure but the center of the J2000 reference frame should be located at the SSB.
  • Timing considerations: Once we have sorted out the geometrical problem, we should address the following and very connected problem: time. We need to know the position of all these objects in the same time span or we will not be able to determine a single thing. In fact this is one of the most typical problems you will face: you are loading kernels that are not covering the same time span. Check the kernels headers to ensure proper timing alignment. Now, once we said that, you will need to provide following kernels to relate a UTC time on Earth to time in a spacecraft: Leap Second Kernels (LSK) and Spacecraft Clock Kernels (SCK). Leap Seconds Kernels will provide us with the Leap seconds added or substracted during the last few years and future planned Leap Seconds (allowing converting time from UTC to Ephemeris Time (ET)) and SCK Kernels will provide us with data about the Spacecraft atomic clock (a spacecraft could have more than one clock), providing us with details about the clock status and performance. This will allow us to convert from Ephemeris Time to Clock Time ("Ticks" which is the smallest increment of time that a spacecraft clock measures).



Kernels:

Let's review some of the Kernels we have available to perform our calculations.

  • SPK : This Binary Kernels will provide us with data about the orbit of an object relative to something (eg: Cassini relative to Saturn Barycenter). The way orbits are described in these files is important depending on the problem you want to sort out. Positions and/or Speed could be described in different ways in the SPK Kernels: as modified divided difference arrays, Chebyshev polynomials, weighted two-body extrapolation, Lagrange interpolation... If you want further details on SPK types please check this pdf.
  • TLS: As mentioned before this ASCII Kernels provides us with a yearly tabulated list of added or subtracted leap seconds. Past or programmed for coming years.
  • CK: Known as Orientation or Attitude Kernels. These Kernels will provide us with details on the orientation of an entire spacecraft or parts of the Spacecraft structure. It contains information about rotations referenced to a Reference Frame. We can use these Kernels to learn the orientation of a spacecraft instrument that will help us to know, once we know where our Spacecraft is located, whether our instrument is going to point to an interesting object or not for a particular instant. As in the case of SPKs there are different ways of detailing this data. For further information on CK types please check this pdf out.
  • IK:  Instrument Kernels. In the latter type of kernel we were talking about knowing when our instrument will be able to "see" an object depending on Spacecraft position, object position (maybe even object orientation) and instrument orientation. But one point was missing: We need to know and to model the Spacecraft field of view (FOV). Without that information we would not be able to accurately model what our instrument is going to be able to see. Therefore specifications for FOV size, shape, and orientation are contained in these files, it could also contain internal instrument timing and calibration data.
  • FK: Reference Frame Kernel. Spice Supports inertial (fixed) and non-inertial (non-fixed) reference frames. Some of them are built-in, like the J2000 (Z normal to the mean Earth equator at J2000 epoch, please also note that in SPICE ICRF=J2000 Reference Frame) and some others could be loaded using these Kernels.  
  • PCK: Planetary Constants Kernels. These Kernels could contain binary or ASCII data. These Kernels contain generic details on SS bodies like orientation or shape. In some cases polynomials are used to model the pole position. Bodies high accuracy orientation is stored in binary PCKs.
  • Meta Kernels: These Kernels could be defined as similar to headers files in C. It just allows you to import a large list of kernels just by asking in your code to load a single. You can find these Kernels syntax in the Spice tutorials. If you are planning to use a large number of kernels you should use them.
  • Transaction Kernels: These ASCII Kernels are just ASCII representation of binary kernels. The extension is the same of the binary one but the first letter is changed by a "x": .x*. By the way: be careful with ASCII Kernels and the editor you use while editing them as some invisible ASCII characters may be included in the document that may make Spice to not being able to process the Kernel. For binary Kernels make sure you have a clear idea about endianess and so on.




Example 1: Cassini Orbit around Saturn. In this easy example we are going to see the orbit of Cassini Spacecraft around Saturn Barycenter using Python. This is a classical example.


You can find the code in Github.





Example 2: Doppler influence due to movement between Earth and Cassini. We are going to calculate the Doppler influence due to the relative movement between Cassini and a Earth Ground Station at the Madrid Deep Space Communication Complex.




You can find the code in Github.
You will need the meta kernel and also to download the necessary extra kernels.


Web Geo Calc (WGC):


You can check that your program is performing well by using the WebGeoCalc tool of JPL.


It is very easy to use compared to coding your own application. Nonetheless there is also a tutorial on this.


No hay comentarios:

Publicar un comentario