Search in sources :

Example 16 with TimeStampedFieldPVCoordinates

use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.

the class FieldNumericalPropagatorTest method createEllipticOrbit.

private static <T extends RealFieldElement<T>> FieldCartesianOrbit<T> createEllipticOrbit(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(6896874.444705), zero.add(1956581.072644), zero.add(-147476.245054));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(166.816407662), zero.add(-1106.783301861), zero.add(-7372.745712770));
    final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, FieldVector3D.getZero(field));
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    return new FieldCartesianOrbit<>(pv, frame, mu);
}
Also used : Frame(org.orekit.frames.Frame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) FieldCartesianOrbit(org.orekit.orbits.FieldCartesianOrbit)

Example 17 with TimeStampedFieldPVCoordinates

use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestNoDerivatives.

private <T extends RealFieldElement<T>> void doTestNoDerivatives(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    for (OrbitType type : OrbitType.values()) {
        // create an initial orbit with non-Keplerian acceleration
        final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, TimeScalesFactory.getUTC());
        final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
        final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
        final FieldVector3D<T> keplerAcceleration = new FieldVector3D<>(position.getNormSq().reciprocal().multiply(-mu), position.normalize());
        final FieldVector3D<T> nonKeplerAcceleration = new FieldVector3D<>(zero.add(0.001), zero.add(0.002), zero.add(0.003));
        final FieldVector3D<T> acceleration = keplerAcceleration.add(nonKeplerAcceleration);
        final TimeStampedFieldPVCoordinates<T> pva = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
        final FieldOrbit<T> initial = type.convertType(new FieldCartesianOrbit<>(pva, FramesFactory.getEME2000(), mu));
        Assert.assertEquals(type, initial.getType());
        // the derivatives are available at this stage
        checkDerivatives(initial, true);
        FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(initial);
        Assert.assertEquals(type, propagator.getInitialState().getOrbit().getType());
        // non-Keplerian derivatives are explicitly removed when building the Keplerian-only propagator
        checkDerivatives(propagator.getInitialState().getOrbit(), false);
        FieldPVCoordinates<T> initPV = propagator.getInitialState().getOrbit().getPVCoordinates();
        Assert.assertEquals(nonKeplerAcceleration.getNorm().getReal(), FieldVector3D.distance(acceleration, initPV.getAcceleration()).getReal(), 2.0e-15);
        Assert.assertEquals(0.0, FieldVector3D.distance(keplerAcceleration, initPV.getAcceleration()).getReal(), 5.0e-15);
        T dt = initial.getKeplerianPeriod().multiply(0.2);
        FieldOrbit<T> orbit = propagator.propagateOrbit(initial.getDate().shiftedBy(dt));
        Assert.assertEquals(type, orbit.getType());
        // at the end, we don't have non-Keplerian derivatives
        checkDerivatives(orbit, false);
        // using shiftedBy on the initial orbit, non-Keplerian derivatives would have been preserved
        checkDerivatives(initial.shiftedBy(dt), true);
    }
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) OrbitType(org.orekit.orbits.OrbitType) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Example 18 with TimeStampedFieldPVCoordinates

use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.

the class FieldCartesianOrbitTest method doTestNonKeplerianDerivatives.

private <T extends RealFieldElement<T>> void doTestNonKeplerianDerivatives(Field<T> field) throws OrekitException {
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
    final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
    final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
    final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final FieldCartesianOrbit<T> orbit = new FieldCartesianOrbit<>(pv, frame, mu);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getA()), orbit.getADot().getReal(), 4.3e-8);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEx()), orbit.getEquinoctialExDot().getReal(), 2.1e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEy()), orbit.getEquinoctialEyDot().getReal(), 5.3e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHx()), orbit.getHxDot().getReal(), 4.4e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot().getReal(), 8.0e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot().getReal(), 1.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot().getReal(), 7.8e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot().getReal(), 8.8e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot().getReal(), 7.0e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 5.7e-16);
}
Also used : Frame(org.orekit.frames.Frame) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) Function(java.util.function.Function) FieldMatrixPreservingVisitor(org.hipparchus.linear.FieldMatrixPreservingVisitor) FieldEcksteinHechlerPropagator(org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator) ArrayList(java.util.ArrayList) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) MathArrays(org.hipparchus.util.MathArrays) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FastMath(org.hipparchus.util.FastMath) Method(java.lang.reflect.Method) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) OrekitMatchers.relativelyCloseTo(org.orekit.OrekitMatchers.relativelyCloseTo) FramesFactory(org.orekit.frames.FramesFactory) Test(org.junit.Test) InvocationTargetException(java.lang.reflect.InvocationTargetException) Field(org.hipparchus.Field) MathUtils(org.hipparchus.util.MathUtils) List(java.util.List) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator) OrekitException(org.orekit.errors.OrekitException) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) RealFieldElement(org.hipparchus.RealFieldElement) TimeScalesFactory(org.orekit.time.TimeScalesFactory) MatrixUtils(org.hipparchus.linear.MatrixUtils) Decimal64Field(org.hipparchus.util.Decimal64Field) Transform(org.orekit.frames.Transform) Assert(org.junit.Assert) Frame(org.orekit.frames.Frame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Example 19 with TimeStampedFieldPVCoordinates

use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.

the class FieldCircularOrbitTest method doTestPositionAngleDerivatives.

private <T extends RealFieldElement<T>> void doTestPositionAngleDerivatives(final Field<T> field) throws OrekitException {
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
    final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
    final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
    final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final FieldCircularOrbit<T> orbit = new FieldCircularOrbit<>(pv, frame, mu);
    for (PositionAngle type : PositionAngle.values()) {
        final FieldCircularOrbit<T> rebuilt = new FieldCircularOrbit<>(orbit.getA(), orbit.getCircularEx(), orbit.getCircularEy(), orbit.getI(), orbit.getRightAscensionOfAscendingNode(), orbit.getAlpha(type), orbit.getADot(), orbit.getCircularExDot(), orbit.getCircularEyDot(), orbit.getIDot(), orbit.getRightAscensionOfAscendingNodeDot(), orbit.getAlphaDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
        Assert.assertThat(rebuilt.getA().getReal(), relativelyCloseTo(orbit.getA().getReal(), 1));
        Assert.assertThat(rebuilt.getCircularEx().getReal(), relativelyCloseTo(orbit.getCircularEx().getReal(), 1));
        Assert.assertThat(rebuilt.getCircularEy().getReal(), relativelyCloseTo(orbit.getCircularEy().getReal(), 1));
        Assert.assertThat(rebuilt.getE().getReal(), relativelyCloseTo(orbit.getE().getReal(), 1));
        Assert.assertThat(rebuilt.getI().getReal(), relativelyCloseTo(orbit.getI().getReal(), 1));
        Assert.assertThat(rebuilt.getRightAscensionOfAscendingNode().getReal(), relativelyCloseTo(orbit.getRightAscensionOfAscendingNode().getReal(), 1));
        Assert.assertThat(rebuilt.getADot().getReal(), relativelyCloseTo(orbit.getADot().getReal(), 1));
        Assert.assertThat(rebuilt.getCircularExDot().getReal(), relativelyCloseTo(orbit.getCircularExDot().getReal(), 1));
        Assert.assertThat(rebuilt.getCircularEyDot().getReal(), relativelyCloseTo(orbit.getCircularEyDot().getReal(), 1));
        Assert.assertThat(rebuilt.getEDot().getReal(), relativelyCloseTo(orbit.getEDot().getReal(), 1));
        Assert.assertThat(rebuilt.getIDot().getReal(), relativelyCloseTo(orbit.getIDot().getReal(), 1));
        Assert.assertThat(rebuilt.getRightAscensionOfAscendingNodeDot().getReal(), relativelyCloseTo(orbit.getRightAscensionOfAscendingNodeDot().getReal(), 1));
        for (PositionAngle type2 : PositionAngle.values()) {
            Assert.assertThat(rebuilt.getAlpha(type2).getReal(), relativelyCloseTo(orbit.getAlpha(type2).getReal(), 1));
            Assert.assertThat(rebuilt.getAlphaDot(type2).getReal(), relativelyCloseTo(orbit.getAlphaDot(type2).getReal(), 1));
        }
    }
}
Also used : Frame(org.orekit.frames.Frame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Example 20 with TimeStampedFieldPVCoordinates

use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.

the class FieldEquinoctialOrbitTest method doTestPositionAngleDerivatives.

private <T extends RealFieldElement<T>> void doTestPositionAngleDerivatives(final Field<T> field) throws OrekitException {
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
    final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
    final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
    final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
    final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
    final Frame frame = FramesFactory.getEME2000();
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final FieldEquinoctialOrbit<T> orbit = new FieldEquinoctialOrbit<>(pv, frame, mu);
    for (PositionAngle type : PositionAngle.values()) {
        final FieldEquinoctialOrbit<T> rebuilt = new FieldEquinoctialOrbit<>(orbit.getA(), orbit.getEquinoctialEx(), orbit.getEquinoctialEy(), orbit.getHx(), orbit.getHy(), orbit.getL(type), orbit.getADot(), orbit.getEquinoctialExDot(), orbit.getEquinoctialEyDot(), orbit.getHxDot(), orbit.getHyDot(), orbit.getLDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
        Assert.assertThat(rebuilt.getA().getReal(), relativelyCloseTo(orbit.getA().getReal(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEx().getReal(), relativelyCloseTo(orbit.getEquinoctialEx().getReal(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEy().getReal(), relativelyCloseTo(orbit.getEquinoctialEy().getReal(), 1));
        Assert.assertThat(rebuilt.getHx().getReal(), relativelyCloseTo(orbit.getHx().getReal(), 1));
        Assert.assertThat(rebuilt.getHy().getReal(), relativelyCloseTo(orbit.getHy().getReal(), 1));
        Assert.assertThat(rebuilt.getADot().getReal(), relativelyCloseTo(orbit.getADot().getReal(), 1));
        Assert.assertThat(rebuilt.getEquinoctialExDot().getReal(), relativelyCloseTo(orbit.getEquinoctialExDot().getReal(), 1));
        Assert.assertThat(rebuilt.getEquinoctialEyDot().getReal(), relativelyCloseTo(orbit.getEquinoctialEyDot().getReal(), 1));
        Assert.assertThat(rebuilt.getHxDot().getReal(), relativelyCloseTo(orbit.getHxDot().getReal(), 1));
        Assert.assertThat(rebuilt.getHyDot().getReal(), relativelyCloseTo(orbit.getHyDot().getReal(), 1));
        for (PositionAngle type2 : PositionAngle.values()) {
            Assert.assertThat(rebuilt.getL(type2).getReal(), relativelyCloseTo(orbit.getL(type2).getReal(), 1));
            Assert.assertThat(rebuilt.getLDot(type2).getReal(), relativelyCloseTo(orbit.getLDot(type2).getReal(), 1));
        }
    }
}
Also used : Frame(org.orekit.frames.Frame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Aggregations

TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)21 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)19 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)18 Frame (org.orekit.frames.Frame)11 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)9 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)8 Transform (org.orekit.frames.Transform)7 ArrayList (java.util.ArrayList)6 Field (org.hipparchus.Field)6 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)6 Assert (org.junit.Assert)6 Test (org.junit.Test)6 OrekitException (org.orekit.errors.OrekitException)6 List (java.util.List)5 Function (java.util.function.Function)5 RealFieldElement (org.hipparchus.RealFieldElement)5 UnivariateFunction (org.hipparchus.analysis.UnivariateFunction)5 FiniteDifferencesDifferentiator (org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)5 UnivariateDifferentiableFunction (org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction)5 FieldMatrixPreservingVisitor (org.hipparchus.linear.FieldMatrixPreservingVisitor)5