public class SpacecraftState extends Object implements TimeStamped, TimeShiftable<SpacecraftState>, TimeInterpolable<SpacecraftState>, Serializable
It contains an Orbit
, plus two attitudes (for forces and events computation) and a map of additional states
at a current AbsoluteDate
. Orbit and attitudes are guaranteed to be consistent in terms of date and reference
frame. The attitudes objects can be copied in the map of additional states with the additional state name
"ATTITUDE_FORCES", "ATTITUDE_EVENTS" or "ATTITUDE" (in numerical propagation only). The stored Attitude and the
additional state representing the attitude are guaranteed to be equal.
The user can declare a SpacecraftState with an input MassProvider
. The masses from each part of the mass
model are automatically added to the map of additional states with a name in the form "MASS_
The state can be slightly shifted to close dates. This shift is based on a simple keplerian model for orbit, a linear extrapolation for both attitudes taking the spin rate into account, no additional states changes. 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 FormModifier and Type | Field and Description |
---|---|
static String |
MASS
Default prefix for additional state representing a mass.
|
static int |
ORBIT_DIMENSION
First index of the additional states.
|
Constructor and Description |
---|
SpacecraftState(double[] y,
OrbitType orbitType,
PositionAngle angleType,
AbsoluteDate date,
double mu,
Frame frame,
Map<String,AdditionalStateInfo> addStatesInfo,
Attitude attForces,
Attitude attEvents)
Build a spacecraft from an array (a state vector) and an additional states informations map.
|
SpacecraftState(double[] y,
OrbitType orbitType,
PositionAngle angleType,
AbsoluteDate date,
double mu,
Frame frame,
Map<String,AdditionalStateInfo> addStatesInfo,
AttitudeProvider attProviderForces,
AttitudeProvider attProviderEvents)
Build a spacecraft from an array (a state vector) and an additional states informations map.
|
SpacecraftState(Orbit orbitIn)
Build a spacecraft state from orbit only.
|
SpacecraftState(Orbit orbitIn,
Attitude attitudeIn)
Build a spacecraft state from orbit and a single attitude.
|
SpacecraftState(Orbit orbitIn,
Attitude attForces,
Attitude attEvents)
Build a spacecraft state from orbit, attitude for forces and events computation.
|
SpacecraftState(Orbit orbitIn,
Attitude attForces,
Attitude attEvents,
Map<String,double[]> addStates)
Build a spacecraft state from orbit, attitude for forces and events computation and additional states map.
|
SpacecraftState(Orbit orbitIn,
Attitude attForces,
Attitude attEvents,
MassProvider massProvider)
Build a spacecraft state from orbit, attitude for forces and events computation and mass provider.
|
SpacecraftState(Orbit orbitIn,
Attitude attForces,
Attitude attEvents,
MassProvider massProvider,
Map<String,double[]> additionalStatesIn)
Build a spacecraft state from orbit, attitude for forces and events computation, mass provider and additional
states map.
|
SpacecraftState(Orbit orbitIn,
Attitude attitudeIn,
MassProvider massProvider)
Build a spacecraft state from orbit, attitude and mass provider.
|
SpacecraftState(Orbit orbitIn,
MassProvider massProvider)
Create a new instance from orbit and mass provider.
|
Modifier and Type | Method and Description |
---|---|
SpacecraftState |
addAdditionalState(String name,
double[] state)
Add an additional state to the additional states map.
|
SpacecraftState |
addAttitude(Attitude newAttitude,
AttitudeEquation.AttitudeType type)
Add attitude to the additional states map.
|
SpacecraftState |
addAttitudeToAdditionalStates(AttitudeEquation.AttitudeType attitudeType)
Add attitude to the additional states map.
|
SpacecraftState |
addMassProvider(MassProvider massProvider)
Add the values of mass parts from MassProvider to additional states map.
|
static boolean |
equalsAddStates(Map<String,double[]> addStates1,
Map<String,double[]> addStates2)
Compares additional states.
|
double |
getA()
Get the semi-major axis.
|
double[] |
getAdditionalState(String name)
Get one additional state.
|
Map<String,double[]> |
getAdditionalStates()
Get additional states.
|
Map<String,AdditionalStateInfo> |
getAdditionalStatesInfos()
Get the additional states informations map.
|
Map<String,double[]> |
getAdditionalStatesMass()
Get additional states with the prefix "MASS_".
|
Attitude |
getAttitude()
Get the default attitude : the attitude for forces computation.
|
Attitude |
getAttitude(Frame outputFrame)
Get the default attitude : the attitude for forces computation in given output frame.
|
Attitude |
getAttitude(LOFType lofType)
Get the default attitude : the attitude for forces computation in given local
orbital frame.
|
Attitude |
getAttitudeEvents()
Get the attitude for events computation.
|
Attitude |
getAttitudeEvents(Frame outputFrame)
Get the attitude for events computation in given output frame.
|
Attitude |
getAttitudeEvents(LOFType lofType)
Get the attitude for events computation in given local orbital frame.
|
Attitude |
getAttitudeForces()
Get the attitude for forces computation.
|
Attitude |
getAttitudeForces(Frame outputFrame)
Get the attitude for forces computation in given output frame.
|
Attitude |
getAttitudeForces(LOFType lofType)
Get the attitude for forces computation in given local orbital frame.
|
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 inertial 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 longitude argument (as per equinoctial parameters).
|
double |
getLM()
Get the mean longitude argument (as per equinoctial parameters).
|
double |
getLv()
Get the true longitude argument (as per equinoctial parameters).
|
double |
getMass(String partName)
Get the mass of the given part.
|
double |
getMu()
Get the central attraction coefficient.
|
Orbit |
getOrbit()
Gets the current orbit.
|
PVCoordinates |
getPVCoordinates()
Get the
PVCoordinates in orbit definition frame. |
PVCoordinates |
getPVCoordinates(Frame outputFrame)
Get the
PVCoordinates in given output frame. |
int |
getStateVectorSize()
Get the state vector size.
|
SpacecraftState |
interpolate(AbsoluteDate date,
Collection<SpacecraftState> sample)
Get an interpolated instance.
|
void |
mapStateToArray(OrbitType orbitType,
PositionAngle angleType,
double[] stateVector)
Convert SpacecraftState to state vector.
|
SpacecraftState |
shiftedBy(double dt)
Get a time-shifted state.
|
Transform |
toTransform()
Compute the transform from orbit/attitude reference frame to spacecraft frame.
|
Transform |
toTransform(Frame frame)
Compute the transform from specified frame to spacecraft frame.
|
Transform |
toTransform(Frame frame,
LOFType lofType)
Compute the transform from specified frame to local orbital frame.
|
Transform |
toTransform(LOFType lofType)
Compute the transform from orbit/attitude reference frame to local orbital frame.
|
Transform |
toTransformEvents()
Compute the transform from orbit/attitude (for events computation) reference frame to spacecraft frame.
|
Transform |
toTransformEvents(Frame frame)
Compute the transform from specified reference frame to spacecraft frame.
|
Transform |
toTransformForces()
Compute the transform from orbit/attitude (for forces computation) reference frame to spacecraft frame.
|
Transform |
toTransformForces(Frame frame)
Compute the transform from specified frame to spacecraft frame.
|
SpacecraftState |
updateMass(String partName,
double newMass)
Update the mass of the given part.
|
SpacecraftState |
updateOrbit(Orbit newOrbit)
Update the orbit.
|
public static final String MASS
public static final int ORBIT_DIMENSION
public SpacecraftState(Orbit orbitIn)
Attitude (for forces and events computation) are set to null values. No mass informations are added.
orbitIn
- the orbitpublic SpacecraftState(Orbit orbitIn, Attitude attitudeIn)
Attitude for forces computation is set to the input attitude. Attitude for events computation is set to null value. No mass informations are added.
orbitIn
- the orbitattitudeIn
- the default attitudeIllegalArgumentException
- if orbit and attitude dates or frames are not equalpublic SpacecraftState(Orbit orbitIn, MassProvider massProvider)
Attitude (for forces and events computation) are set to null values.
The mass states informations contained in the mass provider are added to the additional states map with the name
in the form "MASS_
orbitIn
- the orbitmassProvider
- the mass providerpublic SpacecraftState(Orbit orbitIn, Attitude attitudeIn, MassProvider massProvider)
Attitude for forces computation is set to the input attitude. Attitude for events computation is set to null value.
The mass states informations contained in the mass provider are added to the additional states list with the name
in the form "MASS_
orbitIn
- the orbitattitudeIn
- the default attitudemassProvider
- the mass providerIllegalArgumentException
- if orbit and attitude dates or frames are not equalpublic SpacecraftState(Orbit orbitIn, Attitude attForces, Attitude attEvents)
No mass informations are added.
orbitIn
- the orbitattForces
- the attitude for forces computationattEvents
- the attitude for events computationIllegalArgumentException
- if attitudeForces == null and attitudeEvents!= null
if orbit and attitude dates or frames are not equalpublic SpacecraftState(Orbit orbitIn, Attitude attForces, Attitude attEvents, Map<String,double[]> addStates)
No mass informations are added.
orbitIn
- the orbitattForces
- the attitude for forces computationattEvents
- the attitude for events computationaddStates
- the additional states mapIllegalArgumentException
- if attitudeForces == null and attitudeEvents!= null
if orbit and attitude dates or frames are not equal
if attitude object and attitude in the additional states list map are not equalpublic SpacecraftState(Orbit orbitIn, Attitude attForces, Attitude attEvents, MassProvider massProvider)
The mass states informations contained in the mass provider are added to the additional states list with the name
in the form "MASS_
orbitIn
- the orbitattForces
- the attitude for forces computationattEvents
- the attitude for events computationmassProvider
- the mass providerIllegalArgumentException
- if attitudeForces == null and attitudeEvents!= null
if orbit and attitude dates or frames are not equalpublic SpacecraftState(Orbit orbitIn, Attitude attForces, Attitude attEvents, MassProvider massProvider, Map<String,double[]> additionalStatesIn)
The mass states informations contained in the mass provider are added to the additional states list with the name
in the form "MASS_
orbitIn
- the orbitattForces
- the attitude for forces computationattEvents
- the attitude for events computationmassProvider
- the mass provideradditionalStatesIn
- the additional statesIllegalArgumentException
- if attitudeForces == null and attitudeEvents!= null
if orbit and attitude dates or frames are not equal
if attitude object and attitude in the additional states list map are not equalpublic SpacecraftState(double[] y, OrbitType orbitType, PositionAngle angleType, AbsoluteDate date, double mu, Frame frame, Map<String,AdditionalStateInfo> addStatesInfo, AttitudeProvider attProviderForces, AttitudeProvider attProviderEvents) throws PatriusException
If the additional state informations list contains a state with the prefix "ATTITUDE_FORCES" (or
"ATTITUDE_EVENTS" or "ATTITUDE"), it means that the attitude for forces computation (or events computation) was
added to the additional states map. Then the corresponding Attitude object is initialized with the additional
state value. Otherwise, the Attitude
is initialized using the corresponding AttitudeProvider
.
y
- the state vectororbitType
- the orbit typeangleType
- the position angle typedate
- the integration datemu
- central attraction coefficient used for propagation (m3/s2)frame
- frame in which integration is performedaddStatesInfo
- the additional states informations mapattProviderForces
- the attitude provider for forces computationattProviderEvents
- the attitude provider for events computationPatriusException
- if attitude cannot be computedpublic SpacecraftState(double[] y, OrbitType orbitType, PositionAngle angleType, AbsoluteDate date, double mu, Frame frame, Map<String,AdditionalStateInfo> addStatesInfo, Attitude attForces, Attitude attEvents) throws PatriusException
If the additional state informations list contains a state with the prefix "ATTITUDE_FORCES" (or
"ATTITUDE_EVENTS" or "ATTITUDE"), it means that the attitude for forces computation (or events computation) was
added to the additional states map. Then the corresponding Attitude object is initialized with the additional
state value. Otherwise, the Attitude
is initialized using the corresponding AttitudeProvider
.
y
- the state vectororbitType
- the orbit typeangleType
- the position angle typedate
- the integration datemu
- central attraction coefficient used for propagation (m3/s2)frame
- frame in which integration is performedaddStatesInfo
- the additional states informations mapattForces
- the attitude for forces computationattEvents
- the attitude for events computationPatriusException
- thrown if attitude cannot be computedpublic SpacecraftState addAdditionalState(String name, double[] state) throws PatriusException
If the additionalStates map already contained a mapping for the name entered, the old state is replaced by the specified state. It is not possible to add an additional state with "ATTITUDE_FORCES" or "ATTITUDE_EVENTS" or "ATTITTUDE" name : it is a reserved name.
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
name
- the additional state namestate
- the additional state valuePatriusException
- if the name of the additional state to be added is "ATTITUDE_FORCES" or "ATTITUDE_EVENTS" or
"ATTITUDE".
if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState addAttitudeToAdditionalStates(AttitudeEquation.AttitudeType attitudeType) throws PatriusException
The additional state name could be "ATTITUDE_FORCES" if AttitudeEquation.AttitudeType.ATTITUDE_FORCES
, "ATTITUDE_EVENTS"
if AttitudeEquation.AttitudeType.ATTITUDE_EVENTS
or "ATTITUDE" if AttitudeEquation.AttitudeType.ATTITUDE
. If AttitudeType#ATTITUDE,
the only one attitude available is added to the additional states map.
If an additional state with the name "ATTITUDE_FORCES", "ATTITUDE_EVENTS" or "ATTITUDE" is already in the additional state map, its value will be updated with the new one. The attitude additional state contains the rotation and the spin.
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
attitudeType
- one of AttitudeEquation.AttitudeType.ATTITUDE_FORCES
or AttitudeEquation.AttitudeType.ATTITUDE_EVENTS
or
AttitudeEquation.AttitudeType.ATTITUDE
PatriusException
- if no attitude information is defined
if additional states map contains (ATTITUDE_FORCES or ATTITUDE_EVENTS) state and ATTITUDE state.
if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState addMassProvider(MassProvider massProvider) throws PatriusException
If the additional state map already contained an additional state from the input mass provider, its value will be updated with the new one.
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
massProvider
- the mass provider to addPatriusException
- if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState addAttitude(Attitude newAttitude, AttitudeEquation.AttitudeType type) throws PatriusException
Add attitude to the additional states map. It is not possible to add an attitude for events computation if no attitude for forces computation is defined.
Be careful, additional states associated with attitude are not updated. The user should call addAttitudeToAdditionalStates to add it.
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
newAttitude
- the attitude to be added to the statetype
- the attitude typePatriusException
- if attitude cannot be computed
if attitude events cannot be computedIllegalArgumentException
- if attitudeForces == null and attitudeEvents!= nullpublic SpacecraftState updateMass(String partName, double newMass) throws PatriusException
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
partName
- given partnewMass
- new mass of the given partPatriusException
- if no mass informations already defined for the given part
if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState updateOrbit(Orbit newOrbit) throws PatriusException
SpacecraftState
object state being immutable, a new SpacecraftState
object is returned.
newOrbit
- the new orbitPatriusException
- if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState shiftedBy(double dt) throws PatriusException
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. It is not intended as a replacement for proper orbit and attitude propagation but should be sufficient for small time shifts or coarse accuracy.
WARNING : Additional states map is not changed (except for attitude objects if present) !
As a rough order of magnitude, the following table shows the interpolation errors obtained between this simple
shift method and an Eckstein-Heschler
propagator
for an 800km altitude nearly circular polar Earth orbit with
body center pointing
. Beware that these results may
be different for other orbits.
interpolation time (s) | position error (m) | velocity error (m/s) | attitude error (°) |
---|---|---|---|
60 | 20 | 1 | 0.001 |
120 | 100 | 2 | 0.002 |
300 | 600 | 4 | 0.005 |
600 | 2000 | 6 | 0.008 |
900 | 4000 | 6 | 0.010 |
shiftedBy
in interface TimeShiftable<SpacecraftState>
dt
- time shift in secondsPatriusException
- if attitude cannot be computed
if attitude events cannot be computedpublic SpacecraftState interpolate(AbsoluteDate date, Collection<SpacecraftState> sample) throws PatriusException
The input sample SpacecraftState should have the same additional states size and name. If no attitudes are defined, an error is handled.
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.
interpolate
in interface TimeInterpolable<SpacecraftState>
date
- interpolation datesample
- sample points on which interpolation should be donePatriusException
- if the sample points are inconsistent
if no attitudes are definedpublic Orbit getOrbit()
public AbsoluteDate getDate()
getDate
in interface TimeStamped
public Frame getFrame()
public Transform toTransform() throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
PatriusException
- if no attitude information is defined
if attitude cannot be computedpublic Transform toTransform(Frame frame) throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
frame
- input framePatriusException
- if no attitude information is definedpublic Transform toTransform(LOFType lofType)
lofType
- the LOF typepublic Transform toTransform(Frame frame, LOFType lofType) throws PatriusException
frame
- input framelofType
- the LOF typePatriusException
- if some frame specific error occurspublic Transform toTransformForces() throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
PatriusException
- if no attitude information is definedpublic Transform toTransformForces(Frame frame) throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
frame
- input framePatriusException
- if no attitude information is definedpublic Transform toTransformEvents() throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
PatriusException
- if no attitude information is defined
if attitude events cannot be computedpublic Transform toTransformEvents(Frame frame) throws PatriusException
The spacecraft frame origin is at the point defined by the orbit, and its orientation is defined by the attitude.
frame
- input framePatriusException
- if no attitude information is definedpublic 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 PVCoordinates getPVCoordinates()
PVCoordinates
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 PVCoordinates
, so the caller is
responsible to copy it in a separate PVCoordinates
if it needs to keep the value for a while.public PVCoordinates getPVCoordinates(Frame outputFrame) throws PatriusException
PVCoordinates
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 PVCoordinates
, so the caller is
responsible to copy it in a separate PVCoordinates
if it needs to keep the value for a while.outputFrame
- frame in which coordinates should be definedPatriusException
- if the transformation between frames cannot be computedpublic Attitude getAttitude() throws PatriusException
PatriusException
- if attitude cannot be computedpublic Attitude getAttitude(Frame outputFrame) throws PatriusException
outputFrame
- frame in which the attitude is wantedPatriusException
- if conversion between reference frames fails
if attitude cannot be computedpublic Attitude getAttitude(LOFType lofType) throws PatriusException
Warning: this method creates a new local orbital frame at each call. For multiple calls, prefer using
getAttitude(Frame)
with your own LocalOrbitalFrame
.
lofType
- the LOF typePatriusException
- if conversion between reference frames fails
if attitude cannot be computedpublic Attitude getAttitudeForces() throws PatriusException
PatriusException
- if attitude cannot be computedpublic Attitude getAttitudeForces(Frame outputFrame) throws PatriusException
outputFrame
- frame in which the attitude is wantedPatriusException
- if conversion between reference frames failspublic Attitude getAttitudeForces(LOFType lofType) throws PatriusException
Warning: this method creates a new local orbital frame at each call. For multiple calls, prefer using
getAttitude(Frame)
with your own LocalOrbitalFrame
.
lofType
- the LOF typePatriusException
- if conversion between reference frames failspublic Attitude getAttitudeEvents() throws PatriusException
getAttitude()
if there is no
specific attitude for Events).PatriusException
- if attitude events cannot be computedpublic Attitude getAttitudeEvents(Frame outputFrame) throws PatriusException
outputFrame
- frame in which the attitude is wantedgetAttitude(Frame)
if there is no specific attitude
for Events).PatriusException
- if conversion between reference frames fails
if attitude events cannot be computedpublic Attitude getAttitudeEvents(LOFType lofType) throws PatriusException
Warning: this method creates a new local orbital frame at each call. For multiple calls, prefer using
getAttitude(Frame)
with your own LocalOrbitalFrame
.
lofType
- the LOF typegetAttitude(LOFType)
if there is no specific attitude
for Events).PatriusException
- if conversion between reference frames fails
if attitude events cannot be computedpublic double getMass(String partName) throws PatriusException
partName
- given partPatriusException
- if no mass informations defined for the given part.public Map<String,double[]> getAdditionalStates()
public Map<String,double[]> getAdditionalStatesMass()
public double[] getAdditionalState(String name) throws PatriusException
name
- additional state name.PatriusException
- if the input additional state name is unknownpublic Map<String,AdditionalStateInfo> getAdditionalStatesInfos()
public void mapStateToArray(OrbitType orbitType, PositionAngle angleType, double[] stateVector)
orbitType
- the orbital
parameters typesangleType
- the position angles typestateVector
- flat array into which the state vector should be mappedpublic static boolean equalsAddStates(Map<String,double[]> addStates1, Map<String,double[]> addStates2)
addStates1
- the first additional states to compareaddStates2
- the second additional states to comparepublic int getStateVectorSize()
Copyright © 2019 CNES. All rights reserved.