Search in sources :

Example 6 with FieldKeplerianPropagator

use of org.orekit.propagation.analytical.FieldKeplerianPropagator in project Orekit by CS-SI.

the class FieldEventDetectorTest method doTestWrappedException.

private <T extends RealFieldElement<T>> void doTestWrappedException(Field<T> field) throws OrekitException {
    final T zero = field.getZero();
    final Throwable dummyCause = new RuntimeException();
    try {
        // initial conditions
        Frame eme2000 = FramesFactory.getEME2000();
        TimeScale utc = TimeScalesFactory.getUTC();
        final FieldAbsoluteDate<T> initialDate = new FieldAbsoluteDate<>(field, 2011, 5, 11, utc);
        final FieldAbsoluteDate<T> exceptionDate = initialDate.shiftedBy(3600.0);
        FieldKeplerianPropagator<T> k = new FieldKeplerianPropagator<>(new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(new FieldVector3D<>(zero.add(4008462.4706055815), zero.add(-3155502.5373837613), zero.add(-5044275.9880020910)), new FieldVector3D<>(zero.add(-5012.9298276860990), zero.add(1920.3567095973078), zero.add(-5172.7403501801580))), eme2000, initialDate, Constants.WGS84_EARTH_MU));
        k.addEventDetector(new FieldDateDetector<T>(initialDate.shiftedBy(Constants.JULIAN_DAY)) {

            @Override
            public T g(final FieldSpacecraftState<T> s) throws OrekitException {
                final T dt = s.getDate().durationFrom(exceptionDate);
                if (dt.abs().getReal() < 1.0) {
                    throw new OrekitException(dummyCause, LocalizedCoreFormats.SIMPLE_MESSAGE, "dummy");
                }
                return dt;
            }
        });
        k.propagate(initialDate.shiftedBy(Constants.JULIAN_YEAR));
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertSame(dummyCause, oe.getCause());
    }
}
Also used : Frame(org.orekit.frames.Frame) TimeScale(org.orekit.time.TimeScale) FieldKeplerianPropagator(org.orekit.propagation.analytical.FieldKeplerianPropagator) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 7 with FieldKeplerianPropagator

use of org.orekit.propagation.analytical.FieldKeplerianPropagator 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 8 with FieldKeplerianPropagator

use of org.orekit.propagation.analytical.FieldKeplerianPropagator 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)

Aggregations

FieldKeplerianPropagator (org.orekit.propagation.analytical.FieldKeplerianPropagator)8 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)8 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)4 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)4 TimeScale (org.orekit.time.TimeScale)4 Frame (org.orekit.frames.Frame)3 DateComponents (org.orekit.time.DateComponents)3 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)3 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 BodyCenterPointing (org.orekit.attitudes.BodyCenterPointing)2 OrekitException (org.orekit.errors.OrekitException)2 FieldCircularOrbit (org.orekit.orbits.FieldCircularOrbit)2 HashMap (java.util.HashMap)1 MathIllegalStateException (org.hipparchus.exception.MathIllegalStateException)1 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)1 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)1 Transform (org.orekit.frames.Transform)1 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)1 FieldContinueOnEvent (org.orekit.propagation.events.handlers.FieldContinueOnEvent)1 TimeComponents (org.orekit.time.TimeComponents)1