Class FieldSpacecraftState<T extends org.hipparchus.RealFieldElement<T>>
- java.lang.Object
-
- org.orekit.propagation.FieldSpacecraftState<T>
-
- All Implemented Interfaces:
FieldTimeInterpolable<FieldSpacecraftState<T>,T>
,FieldTimeShiftable<FieldSpacecraftState<T>,T>
,FieldTimeStamped<T>
public class FieldSpacecraftState<T extends org.hipparchus.RealFieldElement<T>> extends Object implements FieldTimeStamped<T>, FieldTimeShiftable<FieldSpacecraftState<T>,T>, FieldTimeInterpolable<FieldSpacecraftState<T>,T>
This class is the representation of a complete state holding orbit, attitude and mass information at a given date.It contains an
orbital state
at a currentFieldAbsoluteDate
both handled by anFieldOrbit
, plus the current mass and attitude. FieldOrbitand 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 user-defined 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
FieldSpacecraftState
is guaranteed to be immutable.- Author:
- Fabien Maussion, Véronique Pommier-Maurussane, Luc Maisonobe
- See Also:
NumericalPropagator
-
-
Constructor Summary
Constructors Constructor Description FieldSpacecraftState(org.hipparchus.Field<T> field, SpacecraftState state)
Convert aSpacecraftState
.FieldSpacecraftState(FieldOrbit<T> orbit)
Build a spacecraft state from orbit only.FieldSpacecraftState(FieldOrbit<T> orbit, Map<String,T[]> additional)
Build a spacecraft state from orbit only.FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude)
Build a spacecraft state from orbit and attitude provider.FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, Map<String,T[]> additional)
Build a spacecraft state from orbit and attitude provider.FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, T mass)
Build a spacecraft state from orbit, attitude provider and mass.FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, T mass, Map<String,T[]> additional)
Build a spacecraft state from orbit, attitude provider and mass.FieldSpacecraftState(FieldOrbit<T> orbit, T mass)
Create a new instance from orbit and mass.FieldSpacecraftState(FieldOrbit<T> orbit, T mass, Map<String,T[]> additional)
Create a new instance from orbit and mass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldSpacecraftState<T>
addAdditionalState(String name, T... value)
Add an additional state.void
ensureCompatibleAdditionalStates(FieldSpacecraftState<T> state)
Check if two instances have the same set of additional states available.T
getA()
Get the semi-major axis.T[]
getAdditionalState(String name)
Get an additional state.Map<String,T[]>
getAdditionalStates()
Get an unmodifiable map of additional states.FieldAttitude<T>
getAttitude()
Get the attitude.FieldAbsoluteDate<T>
getDate()
Get the date.T
getE()
Get the eccentricity.T
getEquinoctialEx()
Get the first component of the eccentricity vector (as per equinoctial parameters).T
getEquinoctialEy()
Get the second component of the eccentricity vector (as per equinoctial parameters).Frame
getFrame()
Get the inertial frame.T
getHx()
Get the first component of the inclination vector (as per equinoctial parameters).T
getHy()
Get the second component of the inclination vector (as per equinoctial parameters).T
getI()
Get the inclination.T
getKeplerianMeanMotion()
Get the Keplerian mean motion.T
getKeplerianPeriod()
Get the Keplerian period.T
getLE()
Get the eccentric latitude argument (as per equinoctial parameters).T
getLM()
Get the mean latitude argument (as per equinoctial parameters).T
getLv()
Get the true latitude argument (as per equinoctial parameters).T
getMass()
Gets the current mass.double
getMu()
Get the central attraction coefficient.FieldOrbit<T>
getOrbit()
Gets the current orbit.TimeStampedFieldPVCoordinates<T>
getPVCoordinates()
Get theTimeStampedFieldPVCoordinates
in orbit definition frame.TimeStampedFieldPVCoordinates<T>
getPVCoordinates(Frame outputFrame)
Get theTimeStampedFieldPVCoordinates
in given output frame.boolean
hasAdditionalState(String name)
Check if an additional state is available.FieldSpacecraftState<T>
interpolate(FieldAbsoluteDate<T> date, Stream<FieldSpacecraftState<T>> sample)
Get an interpolated instance.FieldSpacecraftState<T>
shiftedBy(double dt)
Get a time-shifted state.FieldSpacecraftState<T>
shiftedBy(T dt)
Get a time-shifted state.SpacecraftState
toSpacecraftState()
To convert a FieldSpacecraftState instance into a SpacecraftState instance.FieldTransform<T>
toTransform()
Compute the transform from orbite/attitude reference frame to spacecraft frame.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.orekit.time.FieldTimeInterpolable
interpolate
-
-
-
-
Constructor Detail
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit)
Build a spacecraft state from orbit only.FieldAttitude
and mass are set to unspecified non-null arbitrary values. - Parameters:
orbit
- the orbit
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude) throws IllegalArgumentException
Build a spacecraft state from orbit and attitude provider.Mass is set to an unspecified non-null arbitrary value.
- Parameters:
orbit
- the orbitattitude
- attitude- Throws:
IllegalArgumentException
- if orbit and attitude dates or frames are not equal
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, T mass)
Create a new instance from orbit and mass.FieldAttitude
law is set to an unspecified default attitude. - Parameters:
orbit
- the orbitmass
- the mass (kg)
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, T mass) throws IllegalArgumentException
Build a spacecraft state from orbit, attitude provider and mass.- Parameters:
orbit
- the orbitattitude
- attitudemass
- the mass (kg)- Throws:
IllegalArgumentException
- if orbit and attitude dates or frames are not equal
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, Map<String,T[]> additional)
Build a spacecraft state from orbit only.FieldAttitude
and mass are set to unspecified non-null arbitrary values. - Parameters:
orbit
- the orbitadditional
- additional states
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, Map<String,T[]> additional) throws IllegalArgumentException
Build a spacecraft state from orbit and attitude provider.Mass is set to an unspecified non-null arbitrary value.
- Parameters:
orbit
- the orbitattitude
- attitudeadditional
- additional states- Throws:
IllegalArgumentException
- if orbit and attitude dates or frames are not equal
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, T mass, Map<String,T[]> additional)
Create a new instance from orbit and mass.FieldAttitude
law is set to an unspecified default attitude. - Parameters:
orbit
- the orbitmass
- the mass (kg)additional
- additional states
-
FieldSpacecraftState
public FieldSpacecraftState(FieldOrbit<T> orbit, FieldAttitude<T> attitude, T mass, Map<String,T[]> additional) throws IllegalArgumentException
Build a spacecraft state from orbit, attitude provider and mass.- Parameters:
orbit
- the orbitattitude
- attitudemass
- the mass (kg)additional
- additional states (may be null if no additional states are available)- Throws:
IllegalArgumentException
- if orbit and attitude dates or frames are not equal
-
FieldSpacecraftState
public FieldSpacecraftState(org.hipparchus.Field<T> field, SpacecraftState state)
Convert aSpacecraftState
.- Parameters:
field
- field to which the elements belongstate
- state to convert
-
-
Method Detail
-
addAdditionalState
@SafeVarargs public final FieldSpacecraftState<T> addAdditionalState(String name, T... value)
Add an additional state.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.- Parameters:
name
- name of the additional statevalue
- value of the additional state- Returns:
- a new instance, with the additional state added
- See Also:
hasAdditionalState(String)
,getAdditionalState(String)
,getAdditionalStates()
-
shiftedBy
public FieldSpacecraftState<T> shiftedBy(double dt)
Get a time-shifted state.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 neither mass nor additional states changes. It 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.Extrapolation Error 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 - Specified by:
shiftedBy
in interfaceFieldTimeShiftable<FieldSpacecraftState<T extends org.hipparchus.RealFieldElement<T>>,T extends org.hipparchus.RealFieldElement<T>>
- Parameters:
dt
- time shift in seconds- Returns:
- a new state, shifted with respect to the instance (which is immutable) except for the mass which stay unchanged
-
shiftedBy
public FieldSpacecraftState<T> shiftedBy(T dt)
Get a time-shifted state.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 neither mass nor additional states changes. It 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.Extrapolation Error 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 - Specified by:
shiftedBy
in interfaceFieldTimeShiftable<FieldSpacecraftState<T extends org.hipparchus.RealFieldElement<T>>,T extends org.hipparchus.RealFieldElement<T>>
- Parameters:
dt
- time shift in seconds- Returns:
- a new state, shifted with respect to the instance (which is immutable) except for the mass which stay unchanged
-
interpolate
public FieldSpacecraftState<T> interpolate(FieldAbsoluteDate<T> date, Stream<FieldSpacecraftState<T>> sample)
Get an interpolated instance.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.
As this implementation of interpolation is polynomial, it should be used only with small samples (about 10-20 points) in order to avoid Runge's phenomenon and numerical problems (including NaN appearing).
- Specified by:
interpolate
in interfaceFieldTimeInterpolable<FieldSpacecraftState<T extends org.hipparchus.RealFieldElement<T>>,T extends org.hipparchus.RealFieldElement<T>>
- Parameters:
date
- interpolation datesample
- sample points on which interpolation should be done- Returns:
- a new instance, interpolated at specified date
-
getOrbit
public FieldOrbit<T> getOrbit()
Gets the current orbit.- Returns:
- the orbit
-
getDate
public FieldAbsoluteDate<T> getDate()
Get the date.- Specified by:
getDate
in interfaceFieldTimeStamped<T extends org.hipparchus.RealFieldElement<T>>
- Returns:
- date
-
getFrame
public Frame getFrame()
Get the inertial frame.- Returns:
- the frame
-
hasAdditionalState
public boolean hasAdditionalState(String name)
Check if an additional state is available.- Parameters:
name
- name of the additional state- Returns:
- true if the additional state is available
- See Also:
addAdditionalState(String, RealFieldElement...)
,getAdditionalState(String)
,getAdditionalStates()
-
ensureCompatibleAdditionalStates
public void ensureCompatibleAdditionalStates(FieldSpacecraftState<T> state) throws org.hipparchus.exception.MathIllegalArgumentException
Check if two instances have the same set of additional states available.Only the names and dimensions of the additional states are compared, not their values.
- Parameters:
state
- state to compare to instance- Throws:
org.hipparchus.exception.MathIllegalArgumentException
- if an additional state does not have the same dimension in both states
-
getAdditionalState
public T[] getAdditionalState(String name)
Get an additional state.- Parameters:
name
- name of the additional state- Returns:
- value of the additional state
- See Also:
addAdditionalState(String, RealFieldElement...)
,hasAdditionalState(String)
,getAdditionalStates()
-
getAdditionalStates
public Map<String,T[]> getAdditionalStates()
Get an unmodifiable map of additional states.- Returns:
- unmodifiable map of additional states
- See Also:
addAdditionalState(String, RealFieldElement...)
,hasAdditionalState(String)
,getAdditionalState(String)
-
toTransform
public FieldTransform<T> toTransform()
Compute the transform from orbite/attitude reference frame to spacecraft frame.The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
- Returns:
- transform from specified frame to current spacecraft frame
-
getMu
public double getMu()
Get the central attraction coefficient.- Returns:
- mu central attraction coefficient (m^3/s^2)
-
getKeplerianPeriod
public T getKeplerianPeriod()
Get the Keplerian period.The Keplerian period is computed directly from semi major axis and central acceleration constant.
- Returns:
- Keplerian period in seconds
-
getKeplerianMeanMotion
public T getKeplerianMeanMotion()
Get the Keplerian mean motion.The Keplerian mean motion is computed directly from semi major axis and central acceleration constant.
- Returns:
- Keplerian mean motion in radians per second
-
getA
public T getA()
Get the semi-major axis.- Returns:
- semi-major axis (m)
-
getEquinoctialEx
public T getEquinoctialEx()
Get the first component of the eccentricity vector (as per equinoctial parameters).- Returns:
- e cos(ω + Ω), first component of eccentricity vector
- See Also:
getE()
-
getEquinoctialEy
public T getEquinoctialEy()
Get the second component of the eccentricity vector (as per equinoctial parameters).- Returns:
- e sin(ω + Ω), second component of the eccentricity vector
- See Also:
getE()
-
getHx
public T getHx()
Get the first component of the inclination vector (as per equinoctial parameters).- Returns:
- tan(i/2) cos(Ω), first component of the inclination vector
- See Also:
getI()
-
getHy
public T getHy()
Get the second component of the inclination vector (as per equinoctial parameters).- Returns:
- tan(i/2) sin(Ω), second component of the inclination vector
- See Also:
getI()
-
getLv
public T getLv()
Get the true latitude argument (as per equinoctial parameters).
-
getLE
public T getLE()
Get the eccentric latitude argument (as per equinoctial parameters).
-
getLM
public T getLM()
Get the mean latitude argument (as per equinoctial parameters).
-
getE
public T getE()
Get the eccentricity.- Returns:
- eccentricity
- See Also:
getEquinoctialEx()
,getEquinoctialEy()
-
getPVCoordinates
public TimeStampedFieldPVCoordinates<T> getPVCoordinates()
Get theTimeStampedFieldPVCoordinates
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 cachedTimeStampedFieldPVCoordinates
, so the caller is responsible to copy it in a separateTimeStampedFieldPVCoordinates
if it needs to keep the value for a while.- Returns:
- pvCoordinates in orbit definition frame
-
getPVCoordinates
public TimeStampedFieldPVCoordinates<T> getPVCoordinates(Frame outputFrame)
Get theTimeStampedFieldPVCoordinates
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 cachedTimeStampedFieldPVCoordinates
, so the caller is responsible to copy it in a separateTimeStampedFieldPVCoordinates
if it needs to keep the value for a while.- Parameters:
outputFrame
- frame in which coordinates should be defined- Returns:
- pvCoordinates in orbit definition frame
-
getAttitude
public FieldAttitude<T> getAttitude()
Get the attitude.- Returns:
- the attitude.
-
getMass
public T getMass()
Gets the current mass.- Returns:
- the mass (kg)
-
toSpacecraftState
public SpacecraftState toSpacecraftState()
To convert a FieldSpacecraftState instance into a SpacecraftState instance.- Returns:
- SpacecraftState instance with the same properties
-
-