Search in sources :

Example 36 with FieldKeplerianOrbit

use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.

the class FieldEcksteinHechlerPropagatorTest method doWrongAttitude.

private <T extends RealFieldElement<T>> void doWrongAttitude(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(1.0e10), zero.add(1.0e-4), zero.add(1.0e-2), zero, zero, zero, PositionAngle.TRUE, FramesFactory.getEME2000(), date, 3.986004415e14);
    final DummyLocalizable gasp = new DummyLocalizable("gasp");
    AttitudeProvider wrongLaw = new AttitudeProvider() {

        private static final long serialVersionUID = 1L;

        @Override
        public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame) throws OrekitException {
            throw new OrekitException(gasp, new RuntimeException());
        }

        @Override
        public <Q extends RealFieldElement<Q>> FieldAttitude<Q> getAttitude(FieldPVCoordinatesProvider<Q> pvProv, FieldAbsoluteDate<Q> date, Frame frame) throws OrekitException {
            throw new OrekitException(gasp, new RuntimeException());
        }
    };
    try {
        FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, wrongLaw, provider);
        propagator.propagate(date.shiftedBy(10.0));
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertSame(gasp, oe.getSpecifier());
    }
}
Also used : DummyLocalizable(org.hipparchus.exception.DummyLocalizable) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) RealFieldElement(org.hipparchus.RealFieldElement) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldPVCoordinatesProvider(org.orekit.utils.FieldPVCoordinatesProvider) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) FieldPVCoordinatesProvider(org.orekit.utils.FieldPVCoordinatesProvider) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AttitudeProvider(org.orekit.attitudes.AttitudeProvider)

Example 37 with FieldKeplerianOrbit

use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.

the class FieldEcksteinHechlerPropagatorTest method doSetting.

private <T extends RealFieldElement<T>> void doSetting(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), date, 3.986004415e14);
    FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, provider);
    final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame topo = new TopocentricFrame(earthShape, new GeodeticPoint(0.389, -2.962, 0), null);
    FieldElevationDetector<T> detector = new FieldElevationDetector<>(zero.add(60), zero.add(1.0e-9), topo).withConstantElevation(0.09);
    Assert.assertEquals(0.09, detector.getMinElevation(), 1.0e-12);
    Assert.assertTrue(topo == detector.getTopocentricFrame());
    propagator.addEventDetector(detector);
    FieldAbsoluteDate<T> farTarget = date.shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    final double elevation = topo.getElevation(propagated.getPVCoordinates().getPosition().toVector3D(), propagated.getFrame(), propagated.getDate().toAbsoluteDate());
    final double zVelocity = propagated.getPVCoordinates(topo).getVelocity().getZ().getReal();
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 7800.0);
    Assert.assertTrue("Incorrect value " + farTarget.durationFrom(propagated.getDate()) + " !< 7900", farTarget.durationFrom(propagated.getDate()).getReal() < 7900.0);
    Assert.assertEquals(0.09, elevation, 1.0e-11);
    Assert.assertTrue(zVelocity < 0);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 38 with FieldKeplerianOrbit

use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestSetting.

private <T extends RealFieldElement<T>> void doTestSetting(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame topo = new TopocentricFrame(earthShape, new GeodeticPoint(0.389, -2.962, 0), null);
    propagator.addEventDetector(new FieldElevationDetector<>(zero.add(60), zero.add(FieldAbstractDetector.DEFAULT_THRESHOLD), topo).withConstantElevation(0.09));
    FieldAbsoluteDate<T> farTarget = new FieldAbsoluteDate<>(field).shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    final double elevation = topo.getElevation(propagated.getPVCoordinates().getPosition().toVector3D(), propagated.getFrame(), propagated.getDate().toAbsoluteDate());
    final T zVelocity = propagated.getPVCoordinates(topo).getVelocity().getZ();
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 7800.0);
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() < 7900.0);
    Assert.assertEquals(0.09, elevation, 1.0e-9);
    Assert.assertTrue(zVelocity.getReal() < 0);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) FieldElevationDetector(org.orekit.propagation.events.FieldElevationDetector) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint)

Example 39 with FieldKeplerianOrbit

use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestStepException.

private <T extends RealFieldElement<T>> void doTestStepException(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    FieldOrekitStepHandlerMultiplexer<T> multiplexer = new FieldOrekitStepHandlerMultiplexer<>();
    propagator.setMasterMode(multiplexer);
    multiplexer.add(new FieldOrekitStepHandler<T>() {

        public void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t) {
        }

        public void handleStep(FieldOrekitStepInterpolator<T> interpolator, boolean isLast) throws OrekitException {
            if (isLast) {
                throw new OrekitException((Throwable) null, new DummyLocalizable("dummy error"));
            }
        }
    });
    propagator.propagate(orbit.getDate().shiftedBy(-3600));
}
Also used : DummyLocalizable(org.hipparchus.exception.DummyLocalizable) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldOrekitStepHandlerMultiplexer(org.orekit.propagation.sampling.FieldOrekitStepHandlerMultiplexer) OrekitException(org.orekit.errors.OrekitException)

Example 40 with FieldKeplerianOrbit

use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestStopAtTargetDate.

private <T extends RealFieldElement<T>> void doTestStopAtTargetDate(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    propagator.addEventDetector(new FieldNodeDetector<>(orbit, itrf).withHandler(new FieldContinueOnEvent<FieldNodeDetector<T>, T>()));
    FieldAbsoluteDate<T> farTarget = orbit.getDate().shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate()).getReal()), 1.0e-3);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldNodeDetector(org.orekit.propagation.events.FieldNodeDetector) FieldContinueOnEvent(org.orekit.propagation.events.handlers.FieldContinueOnEvent) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit)

Aggregations

FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)45 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)39 Frame (org.orekit.frames.Frame)25 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)17 OrbitType (org.orekit.orbits.OrbitType)16 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)16 PVCoordinates (org.orekit.utils.PVCoordinates)16 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)14 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)14 Test (org.junit.Test)14 SpacecraftState (org.orekit.propagation.SpacecraftState)14 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)14 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)13 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)13 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)13 DateComponents (org.orekit.time.DateComponents)13 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)12 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)12 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)10