Search in sources :

Example 6 with RealFieldElement

use of org.hipparchus.RealFieldElement in project Orekit by CS-SI.

the class MODProviderTest method testEuler2000.

@Test
public void testEuler2000() throws OrekitException {
    // this alternate representation of the transform
    // is from equation 33 in IERS conventions 2003
    TransformProvider eulerBasedProvider = new TransformProvider() {

        private static final long serialVersionUID = 1L;

        private final PolynomialNutation zetaA = new PolynomialNutation(2.5976176 * Constants.ARC_SECONDS_TO_RADIANS, 2306.0809506 * Constants.ARC_SECONDS_TO_RADIANS, 0.3019015 * Constants.ARC_SECONDS_TO_RADIANS, 0.0179663 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000327 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000002 * Constants.ARC_SECONDS_TO_RADIANS);

        private final PolynomialNutation thetaA = new PolynomialNutation(0.0, 2004.1917476 * Constants.ARC_SECONDS_TO_RADIANS, -0.4269353 * Constants.ARC_SECONDS_TO_RADIANS, -0.0418251 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000601 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000001 * Constants.ARC_SECONDS_TO_RADIANS);

        private final PolynomialNutation zA = new PolynomialNutation(-2.5976176 * Constants.ARC_SECONDS_TO_RADIANS, 2306.0803226 * Constants.ARC_SECONDS_TO_RADIANS, 1.0947790 * Constants.ARC_SECONDS_TO_RADIANS, 0.0182273 * Constants.ARC_SECONDS_TO_RADIANS, 0.0000470 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000003 * Constants.ARC_SECONDS_TO_RADIANS);

        public Transform getTransform(AbsoluteDate date) {
            final double tc = IERSConventions.IERS_2003.evaluateTC(date);
            final Rotation r1 = new Rotation(Vector3D.PLUS_K, zA.value(tc), RotationConvention.VECTOR_OPERATOR);
            final Rotation r2 = new Rotation(Vector3D.PLUS_J, -thetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
            final Rotation r3 = new Rotation(Vector3D.PLUS_K, zetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
            return new Transform(date, r1.compose(r2.compose(r3, RotationConvention.VECTOR_OPERATOR), RotationConvention.VECTOR_OPERATOR));
        }

        public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {
            throw new UnsupportedOperationException("never called in this test");
        }
    };
    MODProvider modProvider = new MODProvider(IERSConventions.IERS_2003);
    for (double dt = -Constants.JULIAN_CENTURY; dt < Constants.JULIAN_CENTURY; dt += 50 * Constants.JULIAN_DAY) {
        AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Transform t = new Transform(date, modProvider.getTransform(date).getInverse(), eulerBasedProvider.getTransform(date));
        Assert.assertEquals(0, t.getRotation().getAngle(), 6.6e-13);
    }
}
Also used : RealFieldElement(org.hipparchus.RealFieldElement) PolynomialNutation(org.orekit.data.PolynomialNutation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 7 with RealFieldElement

use of org.hipparchus.RealFieldElement in project Orekit by CS-SI.

the class MODProviderTest method testEuler1976.

@Test
public void testEuler1976() throws OrekitException {
    TransformProvider eulerBasedProvider = new TransformProvider() {

        private static final long serialVersionUID = 1L;

        private final PolynomialNutation zetaA = new PolynomialNutation(0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 0.30188 * Constants.ARC_SECONDS_TO_RADIANS, 0.017998 * Constants.ARC_SECONDS_TO_RADIANS);

        private final PolynomialNutation thetaA = new PolynomialNutation(0.0, 2004.3109 * Constants.ARC_SECONDS_TO_RADIANS, -0.42665 * Constants.ARC_SECONDS_TO_RADIANS, -0.041833 * Constants.ARC_SECONDS_TO_RADIANS);

        private final PolynomialNutation zA = new PolynomialNutation(0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 1.09468 * Constants.ARC_SECONDS_TO_RADIANS, 0.018203 * Constants.ARC_SECONDS_TO_RADIANS);

        public Transform getTransform(AbsoluteDate date) {
            final double tc = IERSConventions.IERS_1996.evaluateTC(date);
            final Rotation r1 = new Rotation(Vector3D.PLUS_K, zA.value(tc), RotationConvention.VECTOR_OPERATOR);
            final Rotation r2 = new Rotation(Vector3D.PLUS_J, -thetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
            final Rotation r3 = new Rotation(Vector3D.PLUS_K, zetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
            return new Transform(date, r1.compose(r2.compose(r3, RotationConvention.VECTOR_OPERATOR), RotationConvention.VECTOR_OPERATOR));
        }

        public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {
            throw new UnsupportedOperationException("never called in this test");
        }
    };
    MODProvider modProvider = new MODProvider(IERSConventions.IERS_1996);
    for (double dt = -5 * Constants.JULIAN_YEAR; dt < 5 * Constants.JULIAN_YEAR; dt += 10 * Constants.JULIAN_DAY) {
        AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Transform t = new Transform(date, modProvider.getTransform(date).getInverse(), eulerBasedProvider.getTransform(date));
        Assert.assertEquals(0, t.getRotation().getAngle(), 1.01e-11);
    }
}
Also used : RealFieldElement(org.hipparchus.RealFieldElement) PolynomialNutation(org.orekit.data.PolynomialNutation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 8 with RealFieldElement

use of org.hipparchus.RealFieldElement in project Orekit by CS-SI.

the class FramesFactoryTest method testUnwrapInterpolatingTransformProvider.

@Test
public void testUnwrapInterpolatingTransformProvider() throws OrekitException {
    TransformProvider raw = new TransformProvider() {

        private static final long serialVersionUID = 1L;

        public Transform getTransform(final AbsoluteDate date) {
            double dt = date.durationFrom(AbsoluteDate.J2000_EPOCH);
            double sin = FastMath.sin(dt * MathUtils.TWO_PI / Constants.JULIAN_DAY);
            return new Transform(date, new PVCoordinates(new Vector3D(sin, Vector3D.PLUS_I), Vector3D.ZERO));
        }

        public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {
            throw new UnsupportedOperationException("never called in this test");
        }
    };
    Frame parent = FramesFactory.getGCRF();
    Frame frame = new Frame(parent, new InterpolatingTransformProvider(raw, CartesianDerivativesFilter.USE_P, AngularDerivativesFilter.USE_R, 4, Constants.JULIAN_DAY, 10, Constants.JULIAN_YEAR, 2 * Constants.JULIAN_DAY), "sine");
    double maxErrorNonInterpolating = 0;
    double maxErrorInterpolating = 0;
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 60.0) {
        AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Transform reference = raw.getTransform(date);
        Transform nonInterpolating = FramesFactory.getNonInterpolatingTransform(parent, frame, date);
        Transform interpolating = parent.getTransformTo(frame, date);
        double errorNonInterpolating = Vector3D.distance(reference.getTranslation(), nonInterpolating.getTranslation());
        maxErrorNonInterpolating = FastMath.max(maxErrorNonInterpolating, errorNonInterpolating);
        double errorInterpolating = Vector3D.distance(reference.getTranslation(), interpolating.getTranslation());
        maxErrorInterpolating = FastMath.max(maxErrorInterpolating, errorInterpolating);
    }
    Assert.assertEquals(0.0, maxErrorNonInterpolating, 1.0e-15);
    Assert.assertEquals(1.0, maxErrorInterpolating, 1.0e-15);
}
Also used : RealFieldElement(org.hipparchus.RealFieldElement) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 9 with RealFieldElement

use of org.hipparchus.RealFieldElement in project Orekit by CS-SI.

the class FieldEquinoctialOrbitTest 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 FieldEquinoctialOrbit<T> orbit = new FieldEquinoctialOrbit<>(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(), 1.5e-15);
    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.7e-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(), 6.9e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 3.5e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.TRUE)), orbit.getLDot(PositionAngle.TRUE).getReal(), 1.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.ECCENTRIC)), orbit.getLDot(PositionAngle.ECCENTRIC).getReal(), 7.7e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.MEAN)), orbit.getLDot(PositionAngle.MEAN).getReal(), 8.8e-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) 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) 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 10 with RealFieldElement

use of org.hipparchus.RealFieldElement in project Orekit by CS-SI.

the class FieldKeplerianOrbitTest method doTestNonKeplerianEllipticDerivatives.

private <T extends RealFieldElement<T>> void doTestNonKeplerianEllipticDerivatives(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 FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(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(), 1.6e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot().getReal(), 7.3e-17);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot().getReal(), 1.1e-14);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot().getReal(), 7.2e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot().getReal(), 4.7e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot().getReal(), 6.9e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 5.7e-16);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getPerigeeArgument()), orbit.getPerigeeArgumentDot().getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getRightAscensionOfAscendingNode()), orbit.getRightAscensionOfAscendingNodeDot().getReal(), 1.5e-15);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getTrueAnomaly()), orbit.getTrueAnomalyDot().getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEccentricAnomaly()), orbit.getEccentricAnomalyDot().getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getMeanAnomaly()), orbit.getMeanAnomalyDot().getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.TRUE)), orbit.getAnomalyDot(PositionAngle.TRUE).getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.ECCENTRIC)), orbit.getAnomalyDot(PositionAngle.ECCENTRIC).getReal(), 1.5e-12);
    Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.MEAN)), orbit.getAnomalyDot(PositionAngle.MEAN).getReal(), 1.5e-12);
}
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) 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) OrekitIllegalArgumentException(org.orekit.errors.OrekitIllegalArgumentException) Field(org.hipparchus.Field) MathUtils(org.hipparchus.util.MathUtils) OrekitMessages(org.orekit.errors.OrekitMessages) 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)

Aggregations

RealFieldElement (org.hipparchus.RealFieldElement)18 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)16 Test (org.junit.Test)12 Frame (org.orekit.frames.Frame)11 AbsoluteDate (org.orekit.time.AbsoluteDate)11 OrekitException (org.orekit.errors.OrekitException)10 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)7 Transform (org.orekit.frames.Transform)7 Field (org.hipparchus.Field)6 UnivariateFunction (org.hipparchus.analysis.UnivariateFunction)6 FastMath (org.hipparchus.util.FastMath)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Function (java.util.function.Function)5 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)5 FiniteDifferencesDifferentiator (org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator)5 UnivariateDifferentiableFunction (org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction)5 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)5 FieldMatrixPreservingVisitor (org.hipparchus.linear.FieldMatrixPreservingVisitor)5 MatrixUtils (org.hipparchus.linear.MatrixUtils)5