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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations