#include <SolarSystem.hpp>
The user of this class should not have to read or write new files except either when the class is initially installed on a platform, or when a new ephemeris is obtained from JPL. Then procedure is first to download ASCII files for the desired ephemeris from the JPL ftp site at ftp://ssd.jpl.nasa.gov/pub/eph/planets. This consists of an ASCII header file (e.g. header.403) plus one or more ephemeris data files for the same ephemeris (e.g. ascp1975.403, ascp2000.403 and ascp2025.403 - these files contain the complete "DE403" ephemeris covering years 1975 to 2025). The user should then use a conversion program (such as convertEphemeris in the gpstk) to read these files and write out a single binary file for use in applications. Writing the binary file on the platform on which it is going to be used avoids potential problems with platform dependencies. The gpstk also includes a test program, testEphemeris, which will read a test file (also at the JPL ftp site) and compute several states, comparing them with JPL-generated 'truth' values; this will validate the generated binary file. To make use of this class and the generated binary file, the programmer simply instantiates a SolarSystem object, calls initializeWithBinaryFile(file) once, passing it the name of the binary file, then calling computeState() any number of times, passing it the time and Planet of interest.
Definition at line 67 of file SolarSystem.hpp.
Public Types | ||||
| enum | Planet { None = 0, Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto, Moon, Sun, SolarSystemBarycenter, EarthMoonBarycenter, Nutations, Librations } | |||
| These are indexes used by the caller of computeState(). More... | ||||
Public Member Functions | ||||
| SolarSystem (void) throw () | ||||
| Constructor. | ||||
| void | readASCIIheader (std::string filename) throw (gpstk::Exception) | |||
| Read the header from a JPL ASCII planetary ephemeris file. | ||||
| int | readASCIIdata (std::vector< std::string > &filenames) throw (gpstk::Exception) | |||
| Read one or more ASCII data files. | ||||
| int | readASCIIdata (std::string filename) throw (gpstk::Exception) | |||
| Read only one ASCII data file. | ||||
| int | writeASCIIheader (std::ostream &os) throw (gpstk::Exception) | |||
Write the header (ASCII) to an output stream
| ||||
| int | writeASCIIdata (std::ostream &os) throw (gpstk::Exception) | |||
| Write the stored data (ASCII) to an output stream NB. | ||||
| int | writeBinaryFile (std::string filename) throw (gpstk::Exception) | |||
| Write the header and the stored data to a binary output file. | ||||
| void | clearStorage (void) throw () | |||
| clear the store map containing all the data read by readASCIIdata() or readBinaryData(true). | ||||
| int | readBinaryFile (std::string filename) throw (gpstk::Exception) | |||
| Read header and data from a binary file, storing ALL the data in store. | ||||
| int | initializeWithBinaryFile (std::string filename) throw (gpstk::Exception) | |||
| Open the given binary file, read the header and prepare for reading data records at random using seekToJD() and computing positions and velocities with computeState(). | ||||
| int | computeState (double tt, Planet target, Planet center, double PV[6], bool kilometers=true) throw (gpstk::Exception) | |||
| Compute position and velocity of given 'target' body, relative to the 'center' body, at the given time. | ||||
| double | AU (void) throw () | |||
| Return the value of 1 AU (Astronomical Unit) in km. | ||||
| int | JPLNumber (void) const throw () | |||
| Return the ephemeris number. | ||||
| double | getConstant (std::string name) throw () | |||
| gpstk::DayTime | startTime (void) const throw (gpstk::Exception) | |||
| Return the start time of the data. | ||||
| gpstk::DayTime | endTime (void) const throw (gpstk::Exception) | |||
| Return the end time of the data. | ||||
| gpstk::Position | WGS84Position (Planet body, const gpstk::DayTime time, const gpstk::EarthOrientation &eo) throw (gpstk::Exception) | |||
| Return the geocentric (relative to Earth's center) position of a Solar System body at the input time, in WGS84 coordinates with units meters. | ||||
|
|
These are indexes used by the caller of computeState().
Definition at line 70 of file SolarSystem.hpp. |
|
|
Constructor. Set EphemerisNumber to -1 to indicate that nothing has been read yet. Definition at line 92 of file SolarSystem.hpp. |
|
|
Return the value of 1 AU (Astronomical Unit) in km. If the file header has not been read, return -1.0.
Definition at line 213 of file SolarSystem.hpp. |
|
|
clear the store map containing all the data read by readASCIIdata() or readBinaryData(true).
Definition at line 151 of file SolarSystem.hpp. |
|
||||||||||||||||||||||||
|
Compute position and velocity of given 'target' body, relative to the 'center' body, at the given time. On successful return, PV contains position (in components 0-2) and velocity (components 3-5) (units: see param km) for regular bodies; for nutations and librations the units are radians and radians/day; nutations (components 0-3 only) are longitude or psi (component 0) and obliquity or epsilon (component 1) and their rates (components 2,3); librations (components 0-5) are the 3 euler angles in radians and their rates in radians/day.
Definition at line 597 of file SolarSystem.cpp. References gpstk::StringUtils::center(), GPSTK_RETHROW, and GPSTK_THROW. |
|
|
Return the end time of the data.
Definition at line 235 of file SolarSystem.hpp. References DayTime::setMJD(). |
|
|
Definition at line 224 of file SolarSystem.hpp. |
|
|
Open the given binary file, read the header and prepare for reading data records at random using seekToJD() and computing positions and velocities with computeState(). Does not store the data.
Definition at line 568 of file SolarSystem.cpp. References GPSTK_RETHROW, and GPSTK_THROW. |
|
|
Return the ephemeris number.
Definition at line 219 of file SolarSystem.hpp. |
|
|
Read only one ASCII data file. Also see the documentation for the other version of this routine.
Definition at line 223 of file SolarSystem.cpp. References gpstk::StringUtils::asInt(), gpstk::StringUtils::asString(), gpstk::StringUtils::for2doub(), GPSTK_RETHROW, GPSTK_THROW, gpstk::StringUtils::stripFirstWord(), and gpstk::StringUtils::stripTrailing(). |
|
|
Read one or more ASCII data files. Call only after having read the header, and call only with data files for the same ephemeris as the header (the JPL files are named 'header.NNN' and 'ascSYYYY.NNN' where NNN is the ephemeris number (appears inside the header file, but not inside the data files), S is either 'p' or 'n' as the year is positive or negative (AD or BC), and YYYY is the year of the first record in the file.
Definition at line 182 of file SolarSystem.cpp. References GPSTK_RETHROW, GPSTK_THROW, gpstk::StringUtils::leftJustify(), DayTime::printf(), and DayTime::setMJD(). |
|
|
Read the header from a JPL ASCII planetary ephemeris file. Note that this routine clears the 'store' map and defines the 'constants' hash. It also sets EphemerisNumber to the constant "DENUM" if successful.
Definition at line 37 of file SolarSystem.cpp. References gpstk::StringUtils::asInt(), gpstk::StringUtils::asString(), gpstk::StringUtils::for2doub(), GPSTK_RETHROW, GPSTK_THROW, gpstk::StringUtils::stripFirstWord(), gpstk::StringUtils::stripLeading(), gpstk::StringUtils::stripTrailing(), and gpstk::StringUtils::word(). |
|
|
Read header and data from a binary file, storing ALL the data in store. For use with copying, merging or editing data files. Closes the stream before returning.
Definition at line 550 of file SolarSystem.cpp. References GPSTK_RETHROW, and GPSTK_THROW. |
|
|
Return the start time of the data.
Definition at line 231 of file SolarSystem.hpp. References DayTime::setMJD(). |
|
||||||||||||||||
|
Return the geocentric (relative to Earth's center) position of a Solar System body at the input time, in WGS84 coordinates with units meters.
Definition at line 685 of file SolarSystem.cpp. References GPSTK_RETHROW, GPSTK_THROW, DayTime::MJD(), Position::setECEF(), and gpstk::transpose(). |
|
|
Write the stored data (ASCII) to an output stream NB. This routine does NOT clear the store - use clearStorage()
Definition at line 389 of file SolarSystem.cpp. References gpstk::StringUtils::doub2for(), GPSTK_RETHROW, GPSTK_THROW, and gpstk::StringUtils::leftJustify(). |
|
|
Write the header (ASCII) to an output stream
Definition at line 303 of file SolarSystem.cpp. References gpstk::StringUtils::asString(), gpstk::StringUtils::doub2for(), GPSTK_RETHROW, GPSTK_THROW, gpstk::StringUtils::leftJustify(), and gpstk::StringUtils::rightJustify(). |
|
|
Write the header and the stored data to a binary output file. NB. This routine does NOT clear the store - use clearStorage()
Definition at line 432 of file SolarSystem.cpp. References GPSTK_RETHROW, GPSTK_THROW, and gpstk::StringUtils::leftJustify(). |
1.3.9.1