Class FieldSpacecraftState<T extends CalculusFieldElement<T>>

    • 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 state
        value - value of the additional state
        Returns:
        a new instance, with the additional state added
        See Also:
        hasAdditionalState(String), getAdditionalState(String), getAdditionalStates()
      • addAdditionalStateDerivative

        @SafeVarargs
        public final FieldSpacecraftState<T> addAdditionalStateDerivative​(String name,
                                                                          T... value)
        Add an additional state derivative. FieldSpacecraftState 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.
        Parameters:
        name - name of the additional state derivative
        value - value of the additional state derivative
        Returns:
        a new instance, with the additional state derivative added
        See Also:
        hasAdditionalStateDerivative(String), getAdditionalStateDerivative(String), getAdditionalStatesDerivatives()
      • isOrbitDefined

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

        A state contains either an absolute position-velocity-acceleration or an orbit.

        Returns:
        true if state contains an orbit (in which case getOrbit() will not throw an exception), or false if the state contains an absolut position-velocity-acceleration (in which case getAbsPVA() will not throw an exception)
      • 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
        60016011067
        90031413307
        Specified by:
        shiftedBy in interface FieldTimeShiftable<FieldSpacecraftState<T extends CalculusFieldElement<T>>,​T extends CalculusFieldElement<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
        60016011067
        90031413307
        Specified by:
        shiftedBy in interface FieldTimeShiftable<FieldSpacecraftState<T extends CalculusFieldElement<T>>,​T extends CalculusFieldElement<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.

        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 10-20 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 position-velocity-acceleration. Any inconsistency will trigger an OrekitIllegalStateException.

        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 interface FieldTimeInterpolable<FieldSpacecraftState<T extends CalculusFieldElement<T>>,​T extends CalculusFieldElement<T>>
        Parameters:
        date - interpolation date
        sample - sample points on which interpolation should be done
        Returns:
        a new instance, interpolated at specified date
        Throws:
        OrekitIllegalStateException - if some instances are not based on similar trajectory data
      • getFrame

        public Frame getFrame()
        Get the defining frame.
        Returns:
        the frame in which state is defined
      • ensureCompatibleAdditionalStates

        public void ensureCompatibleAdditionalStates​(FieldSpacecraftState<T> state)
                                              throws 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:
        MathIllegalArgumentException - if an additional state does not have the same dimension in both states
      • toTransform

        public FieldTransform<T> toTransform()
        Compute the transform from state defining 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 T getMu()
        Get the central attraction coefficient.
        Returns:
        mu central attraction coefficient (m^3/s^2), or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
      • 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, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
      • 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, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
      • getA

        public T getA()
        Get the semi-major axis.
        Returns:
        semi-major axis (m), or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
      • getEquinoctialEx

        public T getEquinoctialEx()
        Get the first component of the eccentricity vector (as per equinoctial parameters).
        Returns:
        e cos(ω + Ω), first component of eccentricity vector, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        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, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        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, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        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, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        See Also:
        getI()
      • getLv

        public T getLv()
        Get the true latitude argument (as per equinoctial parameters).
        Returns:
        v + ω + Ω true longitude argument (rad), or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        See Also:
        getLE(), getLM()
      • getLE

        public T getLE()
        Get the eccentric latitude argument (as per equinoctial parameters).
        Returns:
        E + ω + Ω eccentric longitude argument (rad), or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        See Also:
        getLv(), getLM()
      • getLM

        public T getLM()
        Get the mean longitude argument (as per equinoctial parameters).
        Returns:
        M + ω + Ω mean latitude argument (rad), or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        See Also:
        getLv(), getLE()
      • getE

        public T getE()
        Get the eccentricity.
        Returns:
        eccentricity, or {code Double.NaN} if the state is contains an absolute position-velocity-acceleration rather than an orbit
        See Also:
        getEquinoctialEx(), getEquinoctialEy()
      • getI

        public T getI()
        Get the inclination.
        Returns:
        inclination (rad)
        See Also:
        getHx(), getHy()
      • getPVCoordinates

        public TimeStampedFieldPVCoordinates<T> getPVCoordinates​(Frame outputFrame)
        Get the TimeStampedFieldPVCoordinates 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 TimeStampedFieldPVCoordinates, so the caller is responsible to copy it in a separate TimeStampedFieldPVCoordinates 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