public class SpacecraftState extends Object implements TimeStamped, TimeShiftable<SpacecraftState>, TimeInterpolable<SpacecraftState>, Serializable
It contains an orbital state
at a current
AbsoluteDate
both handled by an Orbit
, plus the current
mass and attitude. Orbit and state are guaranteed to be consistent in terms
of date and reference frame. The spacecraft state may also contain additional
states, which are simply named double arrays which can hold any userdefined
data.
The state can be slightly shifted to close dates. This shift is based on a simple Keplerian model for orbit, a linear extrapolation for attitude taking the spin rate into account and no mass change. It is not intended as a replacement for proper orbit and attitude propagation but should be sufficient for either small time shifts or coarse accuracy.
The instance SpacecraftState
is guaranteed to be immutable.
NumericalPropagator
,
Serialized FormConstructor and Description 

SpacecraftState(AbsolutePVCoordinates absPva)
Build a spacecraft state from positionvelocityacceleration only.

SpacecraftState(AbsolutePVCoordinates absPva,
Attitude attitude)
Build a spacecraft state from positionvelocityacceleration and attitude.

SpacecraftState(AbsolutePVCoordinates absPva,
Attitude attitude,
double mass)
Build a spacecraft state from positionvelocityacceleration, attitude and mass.

SpacecraftState(AbsolutePVCoordinates absPva,
Attitude attitude,
DoubleArrayDictionary additional)
Build a spacecraft state from positionvelocityacceleration, attitude and additional states.

SpacecraftState(AbsolutePVCoordinates absPva,
Attitude attitude,
double mass,
DoubleArrayDictionary additional)
Build a spacecraft state from positionvelocityacceleration, attitude, mass and additional states.

SpacecraftState(AbsolutePVCoordinates absPva,
Attitude attitude,
double mass,
DoubleArrayDictionary additional,
DoubleArrayDictionary additionalDot)
Build a spacecraft state from positionvelocityacceleration, attitude, mass and additional states and derivatives.

SpacecraftState(AbsolutePVCoordinates absPva,
double mass)
Create a new instance from positionvelocityacceleration and mass.

SpacecraftState(AbsolutePVCoordinates absPva,
DoubleArrayDictionary additional)
Build a spacecraft state from positionvelocityacceleration and additional states.

SpacecraftState(AbsolutePVCoordinates absPva,
double mass,
DoubleArrayDictionary additional)
Create a new instance from positionvelocityacceleration, mass and additional states.

SpacecraftState(Orbit orbit)
Build a spacecraft state from orbit only.

SpacecraftState(Orbit orbit,
Attitude attitude)
Build a spacecraft state from orbit and attitude.

SpacecraftState(Orbit orbit,
Attitude attitude,
double mass)
Build a spacecraft state from orbit, attitude and mass.

SpacecraftState(Orbit orbit,
Attitude attitude,
DoubleArrayDictionary additional)
Build a spacecraft state from orbit, attitude and additional states.

SpacecraftState(Orbit orbit,
Attitude attitude,
double mass,
DoubleArrayDictionary additional)
Build a spacecraft state from orbit, attitude, mass and additional states.

SpacecraftState(Orbit orbit,
Attitude attitude,
double mass,
DoubleArrayDictionary additional,
DoubleArrayDictionary additionalDot)
Build a spacecraft state from orbit, attitude, mass, additional states and derivatives.

SpacecraftState(Orbit orbit,
double mass)
Create a new instance from orbit and mass.

SpacecraftState(Orbit orbit,
DoubleArrayDictionary additional)
Build a spacecraft state from orbit and additional states.

SpacecraftState(Orbit orbit,
double mass,
DoubleArrayDictionary additional)
Create a new instance from orbit, mass and additional states.

Modifier and Type  Method and Description 

SpacecraftState 
addAdditionalState(String name,
double... value)
Add an additional state.

SpacecraftState 
addAdditionalStateDerivative(String name,
double... value)
Add an additional state derivative.

void 
ensureCompatibleAdditionalStates(SpacecraftState state)
Check if two instances have the same set of additional states available.

double 
getA()
Get the semimajor axis.

AbsolutePVCoordinates 
getAbsPVA()
Get the absolute positionvelocityacceleration.

double[] 
getAdditionalState(String name)
Get an additional state.

double[] 
getAdditionalStateDerivative(String name)
Get an additional state derivative.

DoubleArrayDictionary 
getAdditionalStatesDerivatives()
Get an unmodifiable map of additional states derivatives.

DoubleArrayDictionary 
getAdditionalStatesValues()
Get an unmodifiable map of additional states.

Attitude 
getAttitude()
Get the attitude.

AbsoluteDate 
getDate()
Get the date.

double 
getE()
Get the eccentricity.

double 
getEquinoctialEx()
Get the first component of the eccentricity vector (as per equinoctial parameters).

double 
getEquinoctialEy()
Get the second component of the eccentricity vector (as per equinoctial parameters).

Frame 
getFrame()
Get the defining frame.

double 
getHx()
Get the first component of the inclination vector (as per equinoctial parameters).

double 
getHy()
Get the second component of the inclination vector (as per equinoctial parameters).

double 
getI()
Get the inclination.

double 
getKeplerianMeanMotion()
Get the Keplerian mean motion.

double 
getKeplerianPeriod()
Get the Keplerian period.

double 
getLE()
Get the eccentric latitude argument (as per equinoctial parameters).

double 
getLM()
Get the mean longitude argument (as per equinoctial parameters).

double 
getLv()
Get the true latitude argument (as per equinoctial parameters).

double 
getMass()
Gets the current mass.

double 
getMu()
Get the central attraction coefficient.

Orbit 
getOrbit()
Get the current orbit.

Vector3D 
getPosition()
Get the position in orbit definition frame.

Vector3D 
getPosition(Frame outputFrame)
Get the position in given output frame.

TimeStampedPVCoordinates 
getPVCoordinates()
Get the
TimeStampedPVCoordinates in orbit definition frame. 
TimeStampedPVCoordinates 
getPVCoordinates(Frame outputFrame)
Get the
TimeStampedPVCoordinates in given output frame. 
boolean 
hasAdditionalState(String name)
Check if an additional state is available.

boolean 
hasAdditionalStateDerivative(String name)
Check if an additional state derivative is available.

SpacecraftState 
interpolate(AbsoluteDate date,
Stream<SpacecraftState> sample)
Get an interpolated instance.

boolean 
isOrbitDefined()
Check if the state contains an orbit part.

SpacecraftState 
shiftedBy(double dt)
Get a timeshifted state.

String 
toString() 
Transform 
toTransform()
Compute the transform from state defining frame to spacecraft frame.

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
interpolate
public SpacecraftState(Orbit orbit)
Attitude and mass are set to unspecified nonnull arbitrary values.
orbit
 the orbitpublic SpacecraftState(Orbit orbit, Attitude attitude) throws IllegalArgumentException
Mass is set to an unspecified nonnull arbitrary value.
orbit
 the orbitattitude
 attitudeIllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(Orbit orbit, double mass)
Attitude law is set to an unspecified default attitude.
orbit
 the orbitmass
 the mass (kg)public SpacecraftState(Orbit orbit, Attitude attitude, double mass) throws IllegalArgumentException
orbit
 the orbitattitude
 attitudemass
 the mass (kg)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(Orbit orbit, DoubleArrayDictionary additional)
Attitude and mass are set to unspecified nonnull arbitrary values.
orbit
 the orbitadditional
 additional statespublic SpacecraftState(Orbit orbit, Attitude attitude, DoubleArrayDictionary additional) throws IllegalArgumentException
Mass is set to an unspecified nonnull arbitrary value.
orbit
 the orbitattitude
 attitudeadditional
 additional statesIllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(Orbit orbit, double mass, DoubleArrayDictionary additional)
Attitude law is set to an unspecified default attitude.
orbit
 the orbitmass
 the mass (kg)additional
 additional statespublic SpacecraftState(Orbit orbit, Attitude attitude, double mass, DoubleArrayDictionary additional) throws IllegalArgumentException
orbit
 the orbitattitude
 attitudemass
 the mass (kg)additional
 additional states (may be null if no additional states are available)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(Orbit orbit, Attitude attitude, double mass, DoubleArrayDictionary additional, DoubleArrayDictionary additionalDot) throws IllegalArgumentException
orbit
 the orbitattitude
 attitudemass
 the mass (kg)additional
 additional states (may be null if no additional states are available)additionalDot
 additional states derivatives (may be null if no additional states derivatives are available)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(AbsolutePVCoordinates absPva)
Attitude and mass are set to unspecified nonnull arbitrary values.
absPva
 positionvelocityaccelerationpublic SpacecraftState(AbsolutePVCoordinates absPva, Attitude attitude) throws IllegalArgumentException
Mass is set to an unspecified nonnull arbitrary value.
absPva
 positionvelocityaccelerationattitude
 attitudeIllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(AbsolutePVCoordinates absPva, double mass)
Attitude law is set to an unspecified default attitude.
absPva
 positionvelocityaccelerationmass
 the mass (kg)public SpacecraftState(AbsolutePVCoordinates absPva, Attitude attitude, double mass) throws IllegalArgumentException
absPva
 positionvelocityaccelerationattitude
 attitudemass
 the mass (kg)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(AbsolutePVCoordinates absPva, DoubleArrayDictionary additional)
Attitude and mass are set to unspecified nonnull arbitrary values.
absPva
 positionvelocityaccelerationadditional
 additional statespublic SpacecraftState(AbsolutePVCoordinates absPva, Attitude attitude, DoubleArrayDictionary additional) throws IllegalArgumentException
Mass is set to an unspecified nonnull arbitrary value.
absPva
 positionvelocityaccelerationattitude
 attitudeadditional
 additional statesIllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(AbsolutePVCoordinates absPva, double mass, DoubleArrayDictionary additional)
Attitude law is set to an unspecified default attitude.
absPva
 positionvelocityaccelerationmass
 the mass (kg)additional
 additional statespublic SpacecraftState(AbsolutePVCoordinates absPva, Attitude attitude, double mass, DoubleArrayDictionary additional) throws IllegalArgumentException
absPva
 positionvelocityaccelerationattitude
 attitudemass
 the mass (kg)additional
 additional states (may be null if no additional states are available)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState(AbsolutePVCoordinates absPva, Attitude attitude, double mass, DoubleArrayDictionary additional, DoubleArrayDictionary additionalDot) throws IllegalArgumentException
absPva
 positionvelocityaccelerationattitude
 attitudemass
 the mass (kg)additional
 additional states (may be null if no additional states are available)additionalDot
 additional states derivatives(may be null if no additional states derivativesare available)IllegalArgumentException
 if orbit and attitude dates
or frames are not equalpublic SpacecraftState addAdditionalState(String name, double... value)
SpacecraftState
instances are immutable,
so this method does not change the instance, but rather
creates a new instance, which has the same orbit, attitude, mass
and additional states as the original instance, except it also
has the specified state. If the original instance already had an
additional state with the same name, it will be overridden. If it
did not have any additional state with that name, the new instance
will have one more additional state than the original instance.
name
 name of the additional state (names containing "orekit"
with any case are reserved for the library internal use)value
 value of the additional statehasAdditionalState(String)
,
getAdditionalState(String)
,
getAdditionalStatesValues()
public SpacecraftState addAdditionalStateDerivative(String name, double... value)
SpacecraftState
instances are immutable,
so this method does not change the instance, but rather
creates a new instance, which has the same components as the original
instance, except it also has the specified state derivative. If the
original instance already had an additional state derivative with the
same name, it will be overridden. If it did not have any additional
state derivative with that name, the new instance will have one more
additional state derivative than the original instance.
name
 name of the additional state derivative (names containing "orekit"
with any case are reserved for the library internal use)value
 value of the additional state derivativehasAdditionalStateDerivative(String)
,
getAdditionalStateDerivative(String)
,
getAdditionalStatesDerivatives()
public boolean isOrbitDefined()
A state contains either an absolute
positionvelocityacceleration
or an orbit
.
getOrbit()
will not throw an exception), or false if the state contains an
absolut positionvelocityacceleration (in which case getAbsPVA()
will not throw an exception)public SpacecraftState shiftedBy(double dt)
The state can be slightly shifted to close dates. This shift is based on simple models. For orbits, the model is a Keplerian one if no derivatives are available in the orbit, or Keplerian plus quadratic effect of the nonKeplerian acceleration if derivatives are available. For attitude, a polynomial model is used. Neither mass nor additional states change. Shifting is not intended as a replacement for proper orbit and attitude propagation but should be sufficient for small time shifts or coarse accuracy.
As a rough order of magnitude, the following table shows the extrapolation
errors obtained between this simple shift method and an numerical
propagator
for a low Earth Sun Synchronous Orbit, with a 20x20 gravity field,
Sun and Moon third bodies attractions, drag and solar radiation pressure.
Beware that these results will be different for other orbits.
interpolation time (s)  position error without derivatives (m)  position error with derivatives (m) 

60  18  1.1 
120  72  9.1 
300  447  140 
600  1601  1067 
900  3141  3307 
shiftedBy
in interface TimeShiftable<SpacecraftState>
dt
 time shift in secondspublic SpacecraftState interpolate(AbsoluteDate date, Stream<SpacecraftState> sample)
Note that the state of the current instance may not be used in the interpolation process, only its type and non interpolable fields are used (for example central attraction coefficient or frame when interpolating orbits). The interpolable fields taken into account are taken only from the states of the sample points. So if the state of the instance must be used, the instance should be included in the sample points.
Note that this method is designed for small samples only (say up to about 1020 points) so it can be implemented using polynomial interpolation (typically Hermite interpolation). Using too much points may induce Runge's phenomenon and numerical problems (including NaN appearing).
The additional states that are interpolated are the ones already present in the instance. The sample instances must therefore have at least the same additional states has the instance. They may have more additional states, but the extra ones will be ignored.
The instance and all the sample instances must be based on similar
trajectory data, i.e. they must either all be based on orbits or all be based
on absolute positionvelocityacceleration. Any inconsistency will trigger
an OrekitIllegalStateException
.
As this implementation of interpolation is polynomial, it should be used only with small samples (about 1020 points) in order to avoid Runge's phenomenon and numerical problems (including NaN appearing).
interpolate
in interface TimeInterpolable<SpacecraftState>
date
 interpolation datesample
 sample points on which interpolation should be doneOrekitIllegalStateException
 if some instances are not based on
similar trajectory datapublic AbsolutePVCoordinates getAbsPVA() throws OrekitIllegalStateException
A state contains either an absolute
positionvelocityacceleration
or an orbit
. Which
one is present can be checked using isOrbitDefined()
.
OrekitIllegalStateException
 if positionvelocityacceleration is null,
which mean the state rather contains an Orbit
isOrbitDefined()
,
getOrbit()
public Orbit getOrbit() throws OrekitIllegalStateException
A state contains either an absolute
positionvelocityacceleration
or an orbit
. Which
one is present can be checked using isOrbitDefined()
.
OrekitIllegalStateException
 if orbit is null,
which means the state rather contains an absolute
positionvelocityacceleration
isOrbitDefined()
,
getAbsPVA()
public AbsoluteDate getDate()
getDate
in interface TimeStamped
public Frame getFrame()
public boolean hasAdditionalState(String name)
name
 name of the additional stateaddAdditionalState(String, double[])
,
getAdditionalState(String)
,
getAdditionalStatesValues()
public boolean hasAdditionalStateDerivative(String name)
name
 name of the additional state derivativeaddAdditionalStateDerivative(String, double[])
,
getAdditionalStateDerivative(String)
,
getAdditionalStatesDerivatives()
public void ensureCompatibleAdditionalStates(SpacecraftState state) throws MathIllegalStateException
Only the names and dimensions of the additional states are compared, not their values.
state
 state to compare to instanceMathIllegalStateException
 if an additional state does not have
the same dimension in both statespublic double[] getAdditionalState(String name)
name
 name of the additional stateaddAdditionalState(String, double[])
,
hasAdditionalState(String)
,
getAdditionalStatesValues()
public double[] getAdditionalStateDerivative(String name)
name
 name of the additional state derivativeaddAdditionalStateDerivative(String, double[])
,
hasAdditionalStateDerivative(String)
,
getAdditionalStatesDerivatives()
public DoubleArrayDictionary getAdditionalStatesValues()
addAdditionalState(String, double[])
,
hasAdditionalState(String)
,
getAdditionalState(String)
public DoubleArrayDictionary getAdditionalStatesDerivatives()
addAdditionalStateDerivative(String, double[])
,
hasAdditionalStateDerivative(String)
,
getAdditionalStateDerivative(String)
public Transform toTransform()
The spacecraft frame origin is at the point defined by the orbit (or absolute positionvelocityacceleration), and its orientation is defined by the attitude.
public double getMu()
public double getKeplerianPeriod()
The Keplerian period is computed directly from semi major axis and central acceleration constant.
public double getKeplerianMeanMotion()
The Keplerian mean motion is computed directly from semi major axis and central acceleration constant.
public double getA()
public double getEquinoctialEx()
getE()
public double getEquinoctialEy()
getE()
public double getHx()
getI()
public double getHy()
getI()
public double getLv()
public double getLE()
public double getLM()
public double getE()
getEquinoctialEx()
,
getEquinoctialEy()
public double getI()
public Vector3D getPosition()
getPVCoordinates()
public TimeStampedPVCoordinates getPVCoordinates()
TimeStampedPVCoordinates
in orbit definition frame.
Compute the position and velocity of the satellite. This method caches its
results, and recompute them only when the method is called with a new value
for mu. The result is provided as a reference to the internally cached
TimeStampedPVCoordinates
, so the caller is responsible to copy it in a separate
TimeStampedPVCoordinates
if it needs to keep the value for a while.
public Vector3D getPosition(Frame outputFrame)
outputFrame
 frame in which position should be definedgetPVCoordinates(Frame)
public TimeStampedPVCoordinates getPVCoordinates(Frame outputFrame)
TimeStampedPVCoordinates
in given output frame.
Compute the position and velocity of the satellite. This method caches its
results, and recompute them only when the method is called with a new value
for mu. The result is provided as a reference to the internally cached
TimeStampedPVCoordinates
, so the caller is responsible to copy it in a separate
TimeStampedPVCoordinates
if it needs to keep the value for a while.
outputFrame
 frame in which coordinates should be definedpublic Attitude getAttitude()
public double getMass()
Copyright © 20022023 CS GROUP. All rights reserved.