Search in sources :

Example 36 with FieldPVCoordinates

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

the class FieldCartesianOrbitTest method doTestErr1.

private <T extends RealFieldElement<T>> void doTestErr1(Field<T> field) throws IllegalArgumentException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    FieldVector3D<T> position = new FieldVector3D<>(zero.add(-26655470.0), zero.add(29881667.0), zero.add(-113657.0));
    FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-1125.0), zero.add(-1122.0), zero.add(195.0));
    FieldPVCoordinates<T> FieldPVCoordinates = new FieldPVCoordinates<>(position, velocity);
    double mu = 3.9860047e14;
    new FieldCartesianOrbit<>(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 37 with FieldPVCoordinates

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

the class FieldCircularOrbitTest method doTestCopyNonKeplerianAcceleration.

private <T extends RealFieldElement<T>> void doTestCopyNonKeplerianAcceleration(Field<T> field) throws OrekitException {
    final Frame eme2000 = FramesFactory.getEME2000();
    // Define GEO satellite position
    final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(42164140), field.getZero(), field.getZero());
    // Build PVCoodrinates starting from its position and computing the corresponding circular velocity
    final FieldPVCoordinates<T> pv = new FieldPVCoordinates<>(position, new FieldVector3D<>(field.getZero(), position.getNorm().reciprocal().multiply(mu).sqrt(), field.getZero()));
    // Build a KeplerianOrbit in eme2000
    final FieldOrbit<T> orbit = new FieldCircularOrbit<>(pv, eme2000, FieldAbsoluteDate.getJ2000Epoch(field), mu);
    // Build another KeplerianOrbit as a copy of the first one
    final FieldOrbit<T> orbitCopy = new FieldCircularOrbit<>(orbit);
    // Shift the orbit of a time-interval
    // This works good
    final FieldOrbit<T> shiftedOrbit = orbit.shiftedBy(10);
    // This does not work
    final FieldOrbit<T> shiftedOrbitCopy = orbitCopy.shiftedBy(10);
    Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getPosition(), shiftedOrbitCopy.getPVCoordinates().getPosition()).getReal(), 1.0e-10);
    Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getVelocity(), shiftedOrbitCopy.getPVCoordinates().getVelocity()).getReal(), 1.0e-10);
}
Also used : Frame(org.orekit.frames.Frame) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 38 with FieldPVCoordinates

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

the class FieldEquinoctialOrbitTest method doTestCopyNonKeplerianAcceleration.

private <T extends RealFieldElement<T>> void doTestCopyNonKeplerianAcceleration(Field<T> field) throws OrekitException {
    final Frame eme2000 = FramesFactory.getEME2000();
    // Define GEO satellite position
    final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(42164140), field.getZero(), field.getZero());
    // Build PVCoodrinates starting from its position and computing the corresponding circular velocity
    final FieldPVCoordinates<T> pv = new FieldPVCoordinates<>(position, new FieldVector3D<>(field.getZero(), position.getNorm().reciprocal().multiply(mu).sqrt(), field.getZero()));
    // Build a KeplerianOrbit in eme2000
    final FieldOrbit<T> orbit = new FieldKeplerianOrbit<>(pv, eme2000, FieldAbsoluteDate.getJ2000Epoch(field), mu);
    // Build another KeplerianOrbit as a copy of the first one
    final FieldOrbit<T> orbitCopy = new FieldKeplerianOrbit<>(orbit);
    // Shift the orbit of a time-interval
    // This works good
    final FieldOrbit<T> shiftedOrbit = orbit.shiftedBy(10);
    // This does not work
    final FieldOrbit<T> shiftedOrbitCopy = orbitCopy.shiftedBy(10);
    Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getPosition(), shiftedOrbitCopy.getPVCoordinates().getPosition()).getReal(), 1.0e-10);
    Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getVelocity(), shiftedOrbitCopy.getPVCoordinates().getVelocity()).getReal(), 1.0e-10);
}
Also used : Frame(org.orekit.frames.Frame) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D)

Example 39 with FieldPVCoordinates

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

the class FieldKeplerianOrbitTest method doTestNonInertialFrame.

private <T extends RealFieldElement<T>> void doTestNonInertialFrame(final Field<T> field) throws IllegalArgumentException {
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(-4947831.), field.getZero().add(-3765382.), field.getZero().add(-3708221.));
    FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(-2079.), field.getZero().add(5291.), field.getZero().add(-7842.));
    FieldPVCoordinates<T> pvCoordinates = new FieldPVCoordinates<>(position, velocity);
    new FieldKeplerianOrbit<>(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 40 with FieldPVCoordinates

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

the class FieldTransformTest method doTestJacobianPVA.

private <T extends RealFieldElement<T>> void doTestJacobianPVA(Field<T> field) {
    // base directions for finite differences
    @SuppressWarnings("unchecked") FieldPVCoordinates<T>[] directions = (FieldPVCoordinates<T>[]) Array.newInstance(FieldPVCoordinates.class, 9);
    directions[0] = new FieldPVCoordinates<>(FieldVector3D.getPlusI(field), FieldVector3D.getZero(field), FieldVector3D.getZero(field));
    directions[1] = new FieldPVCoordinates<>(FieldVector3D.getPlusJ(field), FieldVector3D.getZero(field), FieldVector3D.getZero(field));
    directions[2] = new FieldPVCoordinates<>(FieldVector3D.getPlusK(field), FieldVector3D.getZero(field), FieldVector3D.getZero(field));
    directions[3] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getPlusI(field), FieldVector3D.getZero(field));
    directions[4] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getPlusJ(field), FieldVector3D.getZero(field));
    directions[5] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getPlusK(field), FieldVector3D.getZero(field));
    directions[6] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getZero(field), FieldVector3D.getPlusI(field));
    directions[7] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getZero(field), FieldVector3D.getPlusJ(field));
    directions[8] = new FieldPVCoordinates<>(FieldVector3D.getZero(field), FieldVector3D.getZero(field), FieldVector3D.getPlusK(field));
    double h = 0.01;
    RandomGenerator random = new Well19937a(0xd223e88b6232198fl);
    for (int i = 0; i < 20; ++i) {
        // generate a random transform
        FieldTransform<T> combined = randomTransform(field, random);
        // compute Jacobian
        T[][] jacobian = MathArrays.buildArray(field, 9, 9);
        for (int l = 0; l < jacobian.length; ++l) {
            for (int c = 0; c < jacobian[l].length; ++c) {
                jacobian[l][c] = field.getZero().add(1 + 0.1 * c);
            }
        }
        combined.getJacobian(CartesianDerivativesFilter.USE_PVA, jacobian);
        for (int j = 0; j < 100; ++j) {
            FieldPVCoordinates<T> pv0 = new FieldPVCoordinates<>(randomVector(field, 1e3, random), randomVector(field, 1.0, random), randomVector(field, 1.0e-3, random));
            double epsilonP = 2.0e-12 * pv0.getPosition().getNorm().getReal();
            double epsilonV = 6.0e-11 * pv0.getVelocity().getNorm().getReal();
            double epsilonA = 2.0e-9 * pv0.getAcceleration().getNorm().getReal();
            for (int c = 0; c < directions.length; ++c) {
                // eight points finite differences estimation of a Jacobian column
                FieldPVCoordinates<T> pvm4h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, -4 * h, directions[c]));
                FieldPVCoordinates<T> pvm3h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, -3 * h, directions[c]));
                FieldPVCoordinates<T> pvm2h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, -2 * h, directions[c]));
                FieldPVCoordinates<T> pvm1h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, -1 * h, directions[c]));
                FieldPVCoordinates<T> pvp1h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, +1 * h, directions[c]));
                FieldPVCoordinates<T> pvp2h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, +2 * h, directions[c]));
                FieldPVCoordinates<T> pvp3h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, +3 * h, directions[c]));
                FieldPVCoordinates<T> pvp4h = combined.transformPVCoordinates(new FieldPVCoordinates<>(1.0, pv0, +4 * h, directions[c]));
                FieldPVCoordinates<T> d4 = new FieldPVCoordinates<>(pvm4h, pvp4h);
                FieldPVCoordinates<T> d3 = new FieldPVCoordinates<>(pvm3h, pvp3h);
                FieldPVCoordinates<T> d2 = new FieldPVCoordinates<>(pvm2h, pvp2h);
                FieldPVCoordinates<T> d1 = new FieldPVCoordinates<>(pvm1h, pvp1h);
                double d = 1.0 / (840 * h);
                FieldPVCoordinates<T> estimatedColumn = new FieldPVCoordinates<>(-3 * d, d4, 32 * d, d3, -168 * d, d2, 672 * d, d1);
                // check analytical Jacobian against finite difference reference
                Assert.assertEquals(estimatedColumn.getPosition().getX().getReal(), jacobian[0][c].getReal(), epsilonP);
                Assert.assertEquals(estimatedColumn.getPosition().getY().getReal(), jacobian[1][c].getReal(), epsilonP);
                Assert.assertEquals(estimatedColumn.getPosition().getZ().getReal(), jacobian[2][c].getReal(), epsilonP);
                Assert.assertEquals(estimatedColumn.getVelocity().getX().getReal(), jacobian[3][c].getReal(), epsilonV);
                Assert.assertEquals(estimatedColumn.getVelocity().getY().getReal(), jacobian[4][c].getReal(), epsilonV);
                Assert.assertEquals(estimatedColumn.getVelocity().getZ().getReal(), jacobian[5][c].getReal(), epsilonV);
                Assert.assertEquals(estimatedColumn.getAcceleration().getX().getReal(), jacobian[6][c].getReal(), epsilonA);
                Assert.assertEquals(estimatedColumn.getAcceleration().getY().getReal(), jacobian[7][c].getReal(), epsilonA);
                Assert.assertEquals(estimatedColumn.getAcceleration().getZ().getReal(), jacobian[8][c].getReal(), epsilonA);
            }
        }
    }
}
Also used : FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator)

Aggregations

FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)41 Frame (org.orekit.frames.Frame)27 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)22 TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)19 PVCoordinates (org.orekit.utils.PVCoordinates)17 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)16 RandomGenerator (org.hipparchus.random.RandomGenerator)16 Well19937a (org.hipparchus.random.Well19937a)16 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)16 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)15 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)14 Test (org.junit.Test)14 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)13 OrbitType (org.orekit.orbits.OrbitType)13 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)13 SpacecraftState (org.orekit.propagation.SpacecraftState)13 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)13 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)13 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)12