- java.lang.Object
-
- spice.basic.Vector6
-
- spice.basic.StateVector
-
- spice.basic.StateRecord
-
public class StateRecord extends StateVector
Class StateRecord represents the states (positions and velocities) of ephemeris objects relative to other objects; state records carry along with them one-way light time between target and observer.Code Examples
The numerical results shown for these examples may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation.
1) Find the apparent state of the Moon as seen from the Earth, expressed in the J2000 reference frame, at the observation epoch 2009 JUL 09 00:00:00 TDB. Use light time and stellar aberration corrections.
Use the meta-kernel shown below to load the required SPICE kernels.
KPL/MK This meta-kernel is intended to support operation of SPICE example programs. The kernels shown here should not be assumed to contain adequate or correct versions of data required by SPICE-based user applications. In order for an application to use this meta-kernel, the kernels referenced here must be present in the user's current working directory. The names and contents of the kernels referenced by this meta-kernel are as follows: File name Contents --------- -------- de421.bsp Planetary ephemeris pck00008.tpc Planet orientation and radii naif0009.tls Leapseconds \begindata KERNELS_TO_LOAD = ( '/kernels/gen/lsk/naif0009.tls' '/kernels/gen/spk/de421.bsp' '/kernels/gen/pck/pck00008.tpc' )
Example code begins here.
import spice.basic.*; class StateRecordEx1 { // // Load the JNISpice shared object library // at initialization time. // static { System.loadLibrary( "JNISpice" ); } public static void main ( String[] args ) { try { // // Load kernels. // KernelDatabase.load ( "standard.tm" ); // // Create input objects required to specify the // StateRecord. // String timstr = "2009 JUL 09 00:00:00 TDB"; Body target = new Body ( "Moon" ); TDBTime et = new TDBTime ( timstr ); ReferenceFrame ref = new ReferenceFrame( "J2000" ); AberrationCorrection abcorr = new AberrationCorrection( "LT+S" ); Body observer = new Body ( 399 ); // // Create a StateRecord and display it. // StateRecord s = new StateRecord ( target, et, ref, abcorr, observer ); System.out.println ( s ); } catch ( SpiceException exc ) { exc.printStackTrace(); } } }
When run on a PC/Linux/java 1.6.0_14/gcc platform, the output from this program was:
State vector = X: 2.283960670189394e+05 (km) Y: -3.088436590471006e+05 (km) Z: -1.308849289940148e+05 (km) VX: 7.946652340856368e-01 (km/s) VY: 4.715096134721694e-01 (km/s) VZ: 3.015826664840431e-01 (km/s) Distance = 4.058078779436026e+05 (km) Speed = 9.719908716570748e-01 (km/s) One way light time = 1.353629376305400e+00 (s)
Version 2.0.0 25-JAN-2017 (NJB)
Added constructors corresponding to CSPICE methods CSPICE.spkcpo CSPICE.spkcpt CSPICE.spkcvo CSPICE.spkcvt
Version 1.0.0 30-DEC-2009 (NJB)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) TDBDuration
lightTime
-
Constructor Summary
Constructors Constructor Description StateRecord(Body target, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Vector3 obspos, Body obsctr, ReferenceFrame obsref)
Construct aberration-corrected StateRecord from ephemeris data and an observer position vector.This method provides functionality analogous to that of the CSPICE routine spkcpo_c.StateRecord(Body target, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Vector6 obssta, Time obsepc, Body obsctr, ReferenceFrame obsref)
Construct aberration-corrected StateRecord from ephemeris data and an observer state vector.This method provides functionality analogous to that of the CSPICE routine spkcvo_c.StateRecord(Body target, Time t, ReferenceFrame ref, AberrationCorrection abcorr, Body observer)
Construct aberration-corrected StateRecord from ephemeris data.StateRecord(StateRecord sr)
Copy constructor.StateRecord(Vector3 trgpos, Body trgctr, ReferenceFrame trgref, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Body obsrvr)
Construct aberration-corrected StateRecord from ephemeris data and a target position vector.This method provides functionality analogous to that of the CSPICE routine spkcpt_c.StateRecord(Vector6 trgsta, Time trgepc, Body trgctr, ReferenceFrame trgref, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Body obsrvr)
Construct aberration-corrected StateRecord from ephemeris data and a target state vector.This method provides functionality analogous to that of the CSPICE routine spkcvt_c.
-
Method Summary
Modifier and Type Method Description TDBDuration
getLightTime()
Get one way light time between target and observer.StateVector
getStateVector()
Get the state vector.java.lang.String
toString()
Create a String representation of this StateRecord.-
Methods inherited from class spice.basic.StateVector
correctStelab, correctStelabXmit, getPosition, getVelocity
-
-
-
-
Field Detail
-
lightTime
TDBDuration lightTime
-
-
Constructor Detail
-
StateRecord
public StateRecord(StateRecord sr) throws SpiceException
Copy constructor.This constructor creates a deep copy.
- Parameters:
sr
-- Throws:
SpiceException
- exception
-
StateRecord
public StateRecord(Body target, Time t, ReferenceFrame ref, AberrationCorrection abcorr, Body observer) throws SpiceException
Construct aberration-corrected StateRecord from ephemeris data.- Parameters:
target
-observer
-t
-abcorr
-ref
-- Throws:
SpiceException
- exception
-
StateRecord
public StateRecord(Body target, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Vector3 obspos, Body obsctr, ReferenceFrame obsref) throws SpiceException
Construct aberration-corrected StateRecord from ephemeris data and an observer position vector.This method provides functionality analogous to that of the CSPICE routine spkcpo_c.- Parameters:
target
-obsref
-t
-obsctr
-outref
-obspos
-refloc
-abcorr
-- Throws:
SpiceException
- exception
-
StateRecord
public StateRecord(Body target, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Vector6 obssta, Time obsepc, Body obsctr, ReferenceFrame obsref) throws SpiceException
Construct aberration-corrected StateRecord from ephemeris data and an observer state vector.This method provides functionality analogous to that of the CSPICE routine spkcvo_c.- Parameters:
target
-obsref
-t
-obsctr
-outref
-obsepc
-refloc
-obssta
-abcorr
-- Throws:
SpiceException
- exception
-
StateRecord
public StateRecord(Vector3 trgpos, Body trgctr, ReferenceFrame trgref, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Body obsrvr) throws SpiceException
Construct aberration-corrected StateRecord from ephemeris data and a target position vector.This method provides functionality analogous to that of the CSPICE routine spkcpt_c.- Parameters:
trgpos
-obsrvr
-trgctr
-abcorr
-trgref
-refloc
-t
-outref
-- Throws:
SpiceException
- exception
-
StateRecord
public StateRecord(Vector6 trgsta, Time trgepc, Body trgctr, ReferenceFrame trgref, Time t, ReferenceFrame outref, java.lang.String refloc, AberrationCorrection abcorr, Body obsrvr) throws SpiceException
Construct aberration-corrected StateRecord from ephemeris data and a target state vector.This method provides functionality analogous to that of the CSPICE routine spkcvt_c.- Parameters:
trgsta
-obsrvr
-trgepc
-abcorr
-trgctr
-refloc
-trgref
-outref
-t
-- Throws:
SpiceException
- exception
-
-
Method Detail
-
toString
public java.lang.String toString()
Create a String representation of this StateRecord.- Overrides:
toString
in classStateVector
- Returns:
- String
-
getStateVector
public StateVector getStateVector() throws SpiceException
Get the state vector.- Returns:
- StateVector
- Throws:
SpiceException
- exception
-
getLightTime
public TDBDuration getLightTime()
Get one way light time between target and observer.- Returns:
- TDBDuration
-
-