Search in sources :

Example 86 with FieldVector3D

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

the class FieldNumericalPropagatorTest method doTestKepler.

private <T extends RealFieldElement<T>> void doTestKepler(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    // setup
    final FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    FieldSpacecraftState<T> initialState;
    FieldNumericalPropagator<T> propagator;
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, orbit.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    // Propagation of the initial at t + dt
    final double dt = 3200;
    final FieldSpacecraftState<T> finalState = propagator.propagate(initDate.shiftedBy(-60), initDate.shiftedBy(dt));
    // Check results
    final double n = FastMath.sqrt(initialState.getMu() / initialState.getA().getReal()) / initialState.getA().getReal();
    Assert.assertEquals(initialState.getA().getReal(), finalState.getA().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getEquinoctialEx().getReal(), finalState.getEquinoctialEx().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getEquinoctialEy().getReal(), finalState.getEquinoctialEy().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getHx().getReal(), finalState.getHx().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getHy().getReal(), finalState.getHy().getReal(), 1.0e-10);
    Assert.assertEquals(initialState.getLM().getReal() + n * dt, finalState.getLM().getReal(), 2.0e-9);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType)

Example 87 with FieldVector3D

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

the class FieldNumericalPropagatorTest method createPropagator.

private <T extends RealFieldElement<T>> FieldNumericalPropagator<T> createPropagator(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    FieldSpacecraftState<T> initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = FieldNumericalPropagator.tolerances(zero.add(0.001), orbit, type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    FieldNumericalPropagator<T> propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    return propagator;
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType)

Example 88 with FieldVector3D

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

the class FieldEventDetectorTest method doTestIssue108Analytical.

private <T extends RealFieldElement<T>> void doTestIssue108Analytical(Field<T> field) throws OrekitException {
    final T zero = field.getZero();
    final TimeScale utc = TimeScalesFactory.getUTC();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, utc);
    final FieldOrbit<T> orbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, mu);
    final T step = zero.add(60.0);
    final int n = 100;
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    GCallsCounter<T> counter = new GCallsCounter<>(zero.add(100000.0), zero.add(1.0e-6), 20, new FieldStopOnEvent<GCallsCounter<T>, T>());
    propagator.addEventDetector(counter);
    propagator.setMasterMode(step, new FieldOrekitFixedStepHandler<T>() {

        public void handleStep(FieldSpacecraftState<T> currentState, boolean isLast) {
        }
    });
    propagator.propagate(date.shiftedBy(step.multiply(n)));
    Assert.assertEquals(n + 1, counter.getCount());
}
Also used : TimeScale(org.orekit.time.TimeScale) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldKeplerianPropagator(org.orekit.propagation.analytical.FieldKeplerianPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldCircularOrbit(org.orekit.orbits.FieldCircularOrbit)

Example 89 with FieldVector3D

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

the class FieldEventDetectorTest method doTestBasicScheduling.

private <T extends RealFieldElement<T>> void doTestBasicScheduling(Field<T> field) throws OrekitException {
    final T zero = field.getZero();
    final TimeScale utc = TimeScalesFactory.getUTC();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, utc);
    final FieldOrbit<T> orbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, mu);
    FieldPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    T stepSize = zero.add(60.0);
    OutOfOrderChecker<T> checker = new OutOfOrderChecker<>(stepSize);
    propagator.addEventDetector(new FieldDateDetector<>(date.shiftedBy(stepSize.multiply(5.25))).withHandler(checker));
    propagator.setMasterMode(stepSize, checker);
    propagator.propagate(date.shiftedBy(stepSize.multiply(10)));
    Assert.assertTrue(checker.outOfOrderCallDetected());
}
Also used : TimeScale(org.orekit.time.TimeScale) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldKeplerianPropagator(org.orekit.propagation.analytical.FieldKeplerianPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) FieldCircularOrbit(org.orekit.orbits.FieldCircularOrbit)

Example 90 with FieldVector3D

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

the class FieldApsideDetectorTest method doTestSimple.

private <T extends RealFieldElement<T>> void doTestSimple(Field<T> field) throws OrekitException {
    final T zero = field.getZero();
    final TimeScale utc = TimeScalesFactory.getUTC();
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(506.0), zero.add(943.0), zero.add(7450));
    final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, utc);
    final FieldOrbit<T> orbit = new FieldCartesianOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    FieldEventDetector<T> detector = new FieldApsideDetector<>(propagator.getInitialState().getOrbit()).withMaxCheck(zero.add(600.0)).withThreshold(zero.add(1.0e-12)).withHandler(new FieldContinueOnEvent<FieldApsideDetector<T>, T>());
    Assert.assertEquals(600.0, detector.getMaxCheckInterval().getReal(), 1.0e-15);
    Assert.assertEquals(1.0e-12, detector.getThreshold().getReal(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, detector.getMaxIterationCount());
    FieldEventsLogger<T> logger = new FieldEventsLogger<>();
    propagator.addEventDetector(logger.monitorDetector(detector));
    propagator.propagate(propagator.getInitialState().getOrbit().getDate().shiftedBy(Constants.JULIAN_DAY));
    Assert.assertEquals(30, logger.getLoggedEvents().size());
    for (FieldLoggedEvent<T> e : logger.getLoggedEvents()) {
        FieldKeplerianOrbit<T> o = (FieldKeplerianOrbit<T>) OrbitType.KEPLERIAN.convertType(e.getState().getOrbit());
        double expected = e.isIncreasing() ? 0.0 : FastMath.PI;
        Assert.assertEquals(expected, MathUtils.normalizeAngle(o.getMeanAnomaly().getReal(), expected), 4.0e-14);
    }
}
Also used : TimeScale(org.orekit.time.TimeScale) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldCartesianOrbit(org.orekit.orbits.FieldCartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldEcksteinHechlerPropagator(org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

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