Search in sources :

Example 21 with DummyLocalizable

use of org.hipparchus.exception.DummyLocalizable 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 22 with DummyLocalizable

use of org.hipparchus.exception.DummyLocalizable in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestWrongAttitude.

private <T extends RealFieldElement<T>> void doTestWrongAttitude(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    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(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    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(new DummyLocalizable("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(new DummyLocalizable("gasp"), new RuntimeException());
        }
    };
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit, wrongLaw);
    propagator.propagate(new FieldAbsoluteDate<>(field).shiftedBy(10.0));
}
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)

Aggregations

DummyLocalizable (org.hipparchus.exception.DummyLocalizable)22 OrekitException (org.orekit.errors.OrekitException)21 IOException (java.io.IOException)10 AbsoluteDate (org.orekit.time.AbsoluteDate)8 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)7 BufferedReader (java.io.BufferedReader)6 InputStreamReader (java.io.InputStreamReader)6 Test (org.junit.Test)6 AttitudeProvider (org.orekit.attitudes.AttitudeProvider)6 Frame (org.orekit.frames.Frame)6 TopocentricFrame (org.orekit.frames.TopocentricFrame)6 FieldPVCoordinatesProvider (org.orekit.utils.FieldPVCoordinatesProvider)6 PVCoordinatesProvider (org.orekit.utils.PVCoordinatesProvider)6 Matcher (java.util.regex.Matcher)4 RealFieldElement (org.hipparchus.RealFieldElement)4 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)4 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)4 InputStream (java.io.InputStream)3 Pattern (java.util.regex.Pattern)3 File (java.io.File)2