Search in sources :

Example 36 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class FieldCircularOrbitTest method doTestNonInertialFrame.

private <T extends RealFieldElement<T>> void doTestNonInertialFrame(Field<T> field) throws IllegalArgumentException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    FieldVector3D<T> position = new FieldVector3D<>(zero.add(33051.2), zero.add(26184.9), zero.add(-1.3E-5));
    FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-60376.2), zero.add(76208.), zero.add(2.7E-4));
    FieldPVCoordinates<T> pvCoordinates = new FieldPVCoordinates<>(position, velocity);
    new FieldCircularOrbit<>(pvCoordinates, new Frame(FramesFactory.getEME2000(), Transform.IDENTITY, "non-inertial", false), date, mu);
}
Also used : Frame(org.orekit.frames.Frame) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 37 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class TransformTest method testTransPV.

@Test
public void testTransPV() {
    RandomGenerator rnd = new Well19937a(0x73d5554d99427af0l);
    for (int i = 0; i < 10; ++i) {
        // random position, velocity and acceleration
        Vector3D pos = randomVector(1.0e3, rnd);
        Vector3D vel = randomVector(1.0, rnd);
        Vector3D acc = randomVector(1.0e-3, rnd);
        PVCoordinates pvOne = new PVCoordinates(pos, vel, acc);
        // random transform
        Vector3D transPos = randomVector(1.0e3, rnd);
        Vector3D transVel = randomVector(1.0, rnd);
        Vector3D transAcc = randomVector(1.0e-3, rnd);
        Transform tr = new Transform(AbsoluteDate.J2000_EPOCH, transPos, transVel, transAcc);
        double dt = 1;
        // we should obtain
        Vector3D good = tr.transformPosition(pos.add(new Vector3D(dt, vel))).add(new Vector3D(dt, transVel));
        // we have
        PVCoordinates pvTwo = tr.transformPVCoordinates(pvOne);
        Vector3D result = pvTwo.getPosition().add(new Vector3D(dt, pvTwo.getVelocity()));
        checkVector(good, result, 1.0e-15);
        FieldPVCoordinates<Decimal64> fieldPVOne = new FieldPVCoordinates<Decimal64>(new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getPosition()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getVelocity()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getAcceleration()));
        FieldPVCoordinates<Decimal64> fieldPVTwo = tr.transformPVCoordinates(fieldPVOne);
        FieldVector3D<Decimal64> fieldResult = fieldPVTwo.getPosition().add(new FieldVector3D<Decimal64>(dt, fieldPVTwo.getVelocity()));
        checkVector(good, fieldResult.toVector3D(), 1.0e-15);
        TimeStampedFieldPVCoordinates<Decimal64> fieldTPVOne = new TimeStampedFieldPVCoordinates<Decimal64>(tr.getDate(), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getPosition()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getVelocity()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getAcceleration()));
        TimeStampedFieldPVCoordinates<Decimal64> fieldTPVTwo = tr.transformPVCoordinates(fieldTPVOne);
        FieldVector3D<Decimal64> fieldTResult = fieldTPVTwo.getPosition().add(new FieldVector3D<Decimal64>(dt, fieldTPVTwo.getVelocity()));
        checkVector(good, fieldTResult.toVector3D(), 1.0e-15);
        // test inverse
        Vector3D resultvel = tr.getInverse().transformPVCoordinates(pvTwo).getVelocity();
        checkVector(resultvel, vel, 1.0e-15);
    }
}
Also used : Decimal64(org.hipparchus.util.Decimal64) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Test(org.junit.Test)

Example 38 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class AbstractMeasurement method getCoordinates.

/**
 * Get Cartesian coordinates as derivatives.
 * <p>
 * The position will correspond to variables {@code firstDerivative},
 * {@code firstDerivative + 1} and {@code firstDerivative + 2}.
 * The velocity will correspond to variables {@code firstDerivative + 3},
 * {@code firstDerivative + 4} and {@code firstDerivative + 5}.
 * The acceleration will correspond to constants.
 * </p>
 * @param state state of the satellite considered
 * @param firstDerivative index of the first derivative
 * @param factory factory for building the derivatives
 * @return Cartesian coordinates as derivatives
 */
public static TimeStampedFieldPVCoordinates<DerivativeStructure> getCoordinates(final SpacecraftState state, final int firstDerivative, final DSFactory factory) {
    // Position of the satellite expressed as a derivative structure
    // The components of the position are the 3 first derivative parameters
    final Vector3D p = state.getPVCoordinates().getPosition();
    final FieldVector3D<DerivativeStructure> pDS = new FieldVector3D<>(factory.variable(firstDerivative + 0, p.getX()), factory.variable(firstDerivative + 1, p.getY()), factory.variable(firstDerivative + 2, p.getZ()));
    // Velocity of the satellite expressed as a derivative structure
    // The components of the velocity are the 3 second derivative parameters
    final Vector3D v = state.getPVCoordinates().getVelocity();
    final FieldVector3D<DerivativeStructure> vDS = new FieldVector3D<>(factory.variable(firstDerivative + 3, v.getX()), factory.variable(firstDerivative + 4, v.getY()), factory.variable(firstDerivative + 5, v.getZ()));
    // Acceleration of the satellite
    // The components of the acceleration are not derivative parameters
    final Vector3D a = state.getPVCoordinates().getAcceleration();
    final FieldVector3D<DerivativeStructure> aDS = new FieldVector3D<>(factory.constant(a.getX()), factory.constant(a.getY()), factory.constant(a.getZ()));
    return new TimeStampedFieldPVCoordinates<>(state.getDate(), pDS, vDS, aDS);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates)

Example 39 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.

the class FieldEquinoctialOrbitTest method doTestNonInertialFrame.

private <T extends RealFieldElement<T>> void doTestNonInertialFrame(Field<T> field) throws IllegalArgumentException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    FieldVector3D<T> position = new FieldVector3D<>(zero.add(4512.9), zero.add(18260.), zero.add(-5127.));
    FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(134664.6), zero.add(90066.8), zero.add(72047.6));
    FieldPVCoordinates<T> FieldPVCoordinates = new FieldPVCoordinates<>(position, velocity);
    new FieldEquinoctialOrbit<>(FieldPVCoordinates, new Frame(FramesFactory.getEME2000(), Transform.IDENTITY, "non-inertial", false), date, mu);
}
Also used : Frame(org.orekit.frames.Frame) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 40 with FieldVector3D

use of org.hipparchus.geometry.euclidean.threed.FieldVector3D 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)

Aggregations

FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)124 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)53 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)49 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)38 Test (org.junit.Test)38 Frame (org.orekit.frames.Frame)36 TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)31 OrekitException (org.orekit.errors.OrekitException)23 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)20 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)20 Decimal64 (org.hipparchus.util.Decimal64)18 FieldEquinoctialOrbit (org.orekit.orbits.FieldEquinoctialOrbit)15 OrbitType (org.orekit.orbits.OrbitType)15 AbsoluteDate (org.orekit.time.AbsoluteDate)15 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)14 Transform (org.orekit.frames.Transform)14 FieldDerivativeStructure (org.hipparchus.analysis.differentiation.FieldDerivativeStructure)12 FieldEcksteinHechlerPropagator (org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator)10 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)9 ArrayList (java.util.ArrayList)8