Module: spice_interface¶
The SPICE interface class gets time and planetary body information from the JPL ephemeris library
The module
PDF Description
contains further information on this module’s function,
how to run it, as well as testing.
-
class
SpiceInterface
: public SysModel¶ Public Functions
-
SpiceInterface
()¶ This constructor initializes the variables that spice uses. Most of them are not intended to be changed, but a couple are user configurable.
-
~SpiceInterface
()¶ The only needed activity in the destructor is to delete the spice I/O buffer that was allocated in the constructor
-
void
UpdateState
(uint64_t CurrentSimNanos)¶ This method is the interface point between the upper level simulation and the SPICE interface at runtime. It calls all of the necessary lower level methods.
- Return
void
- Parameters
CurrentSimNanos
: The current clock time for the simulation
-
int
loadSpiceKernel
(char *kernelName, const char *dataPath)¶ This method loads a requested SPICE kernel into the system memory. It is its own method because we have to load several SPICE kernels in for our application. Note that they are stored in the SPICE library and are not held locally in this object.
- Return
int Zero for success one for failure
- Parameters
kernelName
: The name of the kernel we are loadingdataPath
: The path to the data area on the filesystem
-
int
unloadSpiceKernel
(char *kernelName, const char *dataPath)¶ This method unloads a requested SPICE kernel into the system memory. It is its own method because we have to load several SPICE kernels in for our application. Note that they are stored in the SPICE library and are not held locally in this object.
- Return
int Zero for success one for failure
- Parameters
kernelName
: The name of the kernel we are unloadingdataPath
: The path to the data area on the filesystem
-
std::string
getCurrentTimeString
()¶
-
void
SelfInit
()¶ This method initializes the object. It creates the output messages, initializes the SPICE kernels, and initializes the planet/time data that gets used at run.
- Return
void
-
void
CrossInit
()¶ Should subscribe to module input messages. However, the epoch message is subscribed to in the SelfInit() routine due to how Spice is being loaded and setup.
- Return
void
-
void
Reset
(uint64_t CurrentSimNanos)¶ Reset the module to origina configuration values.
- Return
void
-
void
initTimeData
()¶ This method is used to initialize the zero-time that will be used to calculate all system time values in the Update method. It also creates the output message for time data
- Return
void
-
void
computeGPSData
()¶ This method computes the GPS time data for the current elapsed time. It uses the total elapsed times at both the GPS epoch time and the current time to compute the GPS time (week, seconds, rollovers)
- Return
void
-
void
computePlanetData
()¶ This method gets the state of each planet that has been added to the model and saves the information off into the planet array.
- Return
void
-
void
writeOutputMessages
(uint64_t CurrentClock)¶ This method takes the values computed in the model and outputs them. It packages up the internal variables into the output structure definitions and puts them out on the messaging system
- Return
void
- Parameters
CurrentClock
: The current simulation time (used for time stamping)
-
void
clearKeeper
()¶
Public Members
-
std::string
SPICEDataPath
¶ Path on file to SPICE data
-
std::string
referenceBase
¶ Base reference frame to use
-
std::string
zeroBase
¶ Base zero point to use for states
-
std::string
timeOutPicture
¶ Optional parameter used to extract time strings
-
bool
SPICELoaded
¶ Boolean indicating to reload spice
-
int
charBufferSize
¶ avert your eyes we’re getting SPICE
-
uint8_t *
spiceBuffer
¶ General buffer to pass down to spice
-
std::string
UTCCalInit
¶ UTC time string for init time
-
std::string
outputTimePort
¶ Output time sampling port name to use
-
uint64_t
outputBufferCount
¶ Number of output buffers to use
-
std::vector<std::string>
planetNames
¶ Names of planets we want to track
-
bool
timeDataInit
¶ Flag indicating whether time has been init
-
double
J2000ETInit
¶ s Seconds elapsed since J2000 at init
-
double
J2000Current
¶ s Current J2000 elapsed time
-
double
julianDateCurrent
¶ s Current JulianDate
-
double
GPSSeconds
¶ s Current GPS seconds
-
uint16_t
GPSWeek
¶ Current GPS week value
-
uint64_t
GPSRollovers
¶ Count on the number of GPS rollovers
-
std::string
epochInMsgName
¶ Message name of the epoch message (optional)
-
int64_t
epochInMsgId
¶ ID of the epoch message.
Private Members
-
std::string
GPSEpochTime
¶ String for the GPS epoch
-
double
JDGPSEpoch
¶ s Epoch for GPS time. Saved for efficiency
-
int64_t
timeOutMsgID
¶ Output time message ID
-
std::map<uint32_t, SpicePlanetStateSimMsg>
planetData
¶ Internal vector of planets
-