Search in sources :

Example 36 with Decimal64

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

the class FieldPVCoordinatesTest method testToDerivativeStructureVector1.

@Test
public void testToDerivativeStructureVector1() throws OrekitException {
    FieldVector3D<FieldDerivativeStructure<Decimal64>> fv = new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(1), new Decimal64(0.1), new Decimal64(10)), new FieldVector3D<>(new Decimal64(-1), new Decimal64(-0.1), new Decimal64(-10)), new FieldVector3D<>(new Decimal64(10), new Decimal64(-1.0), new Decimal64(-100))).toDerivativeStructureVector(1);
    Assert.assertEquals(1, fv.getX().getFreeParameters());
    Assert.assertEquals(1, fv.getX().getOrder());
    Assert.assertEquals(1.0, fv.getX().getReal(), 1.0e-10);
    Assert.assertEquals(0.1, fv.getY().getReal(), 1.0e-10);
    Assert.assertEquals(10.0, fv.getZ().getReal(), 1.0e-10);
    Assert.assertEquals(-1.0, fv.getX().getPartialDerivative(1).getReal(), 1.0e-15);
    Assert.assertEquals(-0.1, fv.getY().getPartialDerivative(1).getReal(), 1.0e-15);
    Assert.assertEquals(-10.0, fv.getZ().getPartialDerivative(1).getReal(), 1.0e-15);
    checkPV(new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(1), new Decimal64(0.1), new Decimal64(10)), new FieldVector3D<>(new Decimal64(-1), new Decimal64(-0.1), new Decimal64(-10)), FieldVector3D.getZero(Decimal64Field.getInstance())), new FieldPVCoordinates<>(fv), 1.0e-15);
}
Also used : Decimal64(org.hipparchus.util.Decimal64) FieldDerivativeStructure(org.hipparchus.analysis.differentiation.FieldDerivativeStructure) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 37 with Decimal64

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

the class FieldPVCoordinatesTest method testMomentumDerivative.

@Test
public void testMomentumDerivative() throws OrekitException {
    final FieldPVCoordinates<Decimal64> pva = new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(-4947831.), new Decimal64(-3765382.), new Decimal64(-3708221.)), new FieldVector3D<>(new Decimal64(-2079.), new Decimal64(5291.), new Decimal64(-7842.)));
    final FieldVector3D<Decimal64> p = pva.getPosition();
    final FieldVector3D<Decimal64> v = pva.getVelocity();
    final FieldVector3D<Decimal64> a = pva.getAcceleration();
    final Decimal64 r2 = p.getNormSq();
    final Decimal64 r = r2.sqrt();
    final FieldVector3D<Decimal64> keplerianJerk = new FieldVector3D<>(FieldVector3D.dotProduct(p, v).multiply(-2).divide(r2), a, a.getNorm().negate().divide(r), v);
    final FieldPVCoordinates<Decimal64> velocity = new FieldPVCoordinates<>(v, a, keplerianJerk);
    final FieldVector3D<Decimal64> momentumRef = pva.getMomentum();
    final FieldVector3D<Decimal64> momentumDotRef = pva.crossProduct(velocity).getVelocity();
    final FieldVector3D<FieldDerivativeStructure<Decimal64>> momentumDot = pva.toDerivativeStructurePV(1).getMomentum();
    Assert.assertEquals(momentumRef.getX().getReal(), momentumDot.getX().getReal(), 1.0e-15);
    Assert.assertEquals(momentumRef.getY().getReal(), momentumDot.getY().getReal(), 1.0e-15);
    Assert.assertEquals(momentumRef.getZ().getReal(), momentumDot.getZ().getReal(), 1.0e-15);
    Assert.assertEquals(momentumDotRef.getX().getReal(), momentumDot.getX().getPartialDerivative(1).getReal(), 1.0e-15);
    Assert.assertEquals(momentumDotRef.getY().getReal(), momentumDot.getY().getPartialDerivative(1).getReal(), 1.0e-15);
    Assert.assertEquals(momentumDotRef.getZ().getReal(), momentumDot.getZ().getPartialDerivative(1).getReal(), 1.0e-15);
}
Also used : Decimal64(org.hipparchus.util.Decimal64) FieldDerivativeStructure(org.hipparchus.analysis.differentiation.FieldDerivativeStructure) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 38 with Decimal64

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

the class FieldPVCoordinatesTest method testJerkIsVelocitySecondDerivative.

@Test
public void testJerkIsVelocitySecondDerivative() throws OrekitException {
    final FieldCartesianOrbit<Decimal64> orbit = new FieldCartesianOrbit<>(new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(-4947831.), new Decimal64(-3765382.), new Decimal64(-3708221.)), new FieldVector3D<>(new Decimal64(-2079.), new Decimal64(5291.), new Decimal64(-7842.))), FramesFactory.getEME2000(), FieldAbsoluteDate.getJ2000Epoch(Decimal64Field.getInstance()), Constants.EIGEN5C_EARTH_MU);
    FieldPVCoordinates<FieldDerivativeStructure<Decimal64>> fv = orbit.getPVCoordinates().toDerivativeStructurePV(2);
    FieldVector3D<Decimal64> numericalJerk = differentiate(orbit, o -> o.getPVCoordinates().getAcceleration());
    Assert.assertEquals(numericalJerk.getX().getReal(), fv.getVelocity().getX().getPartialDerivative(2).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getY().getReal(), fv.getVelocity().getY().getPartialDerivative(2).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getZ().getReal(), fv.getVelocity().getZ().getPartialDerivative(2).getReal(), 1.0e-13);
}
Also used : Decimal64(org.hipparchus.util.Decimal64) FieldDerivativeStructure(org.hipparchus.analysis.differentiation.FieldDerivativeStructure) FieldCartesianOrbit(org.orekit.orbits.FieldCartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 39 with Decimal64

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

the class FieldPVCoordinatesTest method testToDerivativeStructureVector0.

@Test
public void testToDerivativeStructureVector0() throws OrekitException {
    FieldVector3D<FieldDerivativeStructure<Decimal64>> fv = new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(1), new Decimal64(0.1), new Decimal64(10)), new FieldVector3D<>(new Decimal64(-1), new Decimal64(-0.1), new Decimal64(-10)), new FieldVector3D<>(new Decimal64(10), new Decimal64(-1.0), new Decimal64(-100))).toDerivativeStructureVector(0);
    Assert.assertEquals(1, fv.getX().getFreeParameters());
    Assert.assertEquals(0, fv.getX().getOrder());
    Assert.assertEquals(1.0, fv.getX().getReal(), 1.0e-10);
    Assert.assertEquals(0.1, fv.getY().getReal(), 1.0e-10);
    Assert.assertEquals(10.0, fv.getZ().getReal(), 1.0e-10);
    checkPV(new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(1), new Decimal64(0.1), new Decimal64(10)), FieldVector3D.getZero(Decimal64Field.getInstance()), FieldVector3D.getZero(Decimal64Field.getInstance())), new FieldPVCoordinates<>(fv), 1.0e-15);
}
Also used : Decimal64(org.hipparchus.util.Decimal64) FieldDerivativeStructure(org.hipparchus.analysis.differentiation.FieldDerivativeStructure) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 40 with Decimal64

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

the class FieldPVCoordinatesTest method testJerkIsAccelerationDerivative.

@Test
public void testJerkIsAccelerationDerivative() throws OrekitException {
    final FieldCartesianOrbit<Decimal64> orbit = new FieldCartesianOrbit<>(new FieldPVCoordinates<>(new FieldVector3D<>(new Decimal64(-4947831.), new Decimal64(-3765382.), new Decimal64(-3708221.)), new FieldVector3D<>(new Decimal64(-2079.), new Decimal64(5291.), new Decimal64(-7842.))), FramesFactory.getEME2000(), FieldAbsoluteDate.getJ2000Epoch(Decimal64Field.getInstance()), Constants.EIGEN5C_EARTH_MU);
    FieldPVCoordinates<FieldDerivativeStructure<Decimal64>> fv1 = orbit.getPVCoordinates().toDerivativeStructurePV(1);
    FieldVector3D<Decimal64> numericalJerk = differentiate(orbit, o -> o.getPVCoordinates().getAcceleration());
    Assert.assertEquals(numericalJerk.getX().getReal(), fv1.getAcceleration().getX().getPartialDerivative(1).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getY().getReal(), fv1.getAcceleration().getY().getPartialDerivative(1).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getZ().getReal(), fv1.getAcceleration().getZ().getPartialDerivative(1).getReal(), 1.0e-13);
    FieldPVCoordinates<FieldDerivativeStructure<Decimal64>> fv2 = orbit.getPVCoordinates().toDerivativeStructurePV(2);
    Assert.assertEquals(numericalJerk.getX().getReal(), fv2.getAcceleration().getX().getPartialDerivative(1).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getY().getReal(), fv2.getAcceleration().getY().getPartialDerivative(1).getReal(), 1.0e-13);
    Assert.assertEquals(numericalJerk.getZ().getReal(), fv2.getAcceleration().getZ().getPartialDerivative(1).getReal(), 1.0e-13);
}
Also used : Decimal64(org.hipparchus.util.Decimal64) FieldDerivativeStructure(org.hipparchus.analysis.differentiation.FieldDerivativeStructure) FieldCartesianOrbit(org.orekit.orbits.FieldCartesianOrbit) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Aggregations

Decimal64 (org.hipparchus.util.Decimal64)41 Test (org.junit.Test)37 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)21 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)18 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)12 FieldDerivativeStructure (org.hipparchus.analysis.differentiation.FieldDerivativeStructure)10 AbsoluteDate (org.orekit.time.AbsoluteDate)9 RandomGenerator (org.hipparchus.random.RandomGenerator)5 Well19937a (org.hipparchus.random.Well19937a)5 GeodeticPoint (org.orekit.bodies.GeodeticPoint)4 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)4 Frame (org.orekit.frames.Frame)4 FieldCartesianOrbit (org.orekit.orbits.FieldCartesianOrbit)3 TimeScale (org.orekit.time.TimeScale)3 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)3 PVCoordinates (org.orekit.utils.PVCoordinates)3 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)3 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)2 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)2 CelestialBody (org.orekit.bodies.CelestialBody)2