Search in sources :

Example 1 with OrekitStepHandlerMultiplexer

use of org.orekit.propagation.sampling.OrekitStepHandlerMultiplexer in project Orekit by CS-SI.

the class KeplerianPropagatorTest method testStepException.

@Test(expected = OrekitException.class)
public void testStepException() throws OrekitException {
    final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
    KeplerianPropagator propagator = new KeplerianPropagator(orbit);
    OrekitStepHandlerMultiplexer multiplexer = new OrekitStepHandlerMultiplexer();
    propagator.setMasterMode(multiplexer);
    multiplexer.add(new OrekitStepHandler() {

        public void init(SpacecraftState s0, AbsoluteDate t) {
        }

        public void handleStep(OrekitStepInterpolator interpolator, boolean isLast) throws OrekitException {
            if (isLast) {
                throw new OrekitException((Throwable) null, new DummyLocalizable("dummy error"));
            }
        }
    });
    propagator.propagate(orbit.getDate().shiftedBy(-3600));
}
Also used : OrekitStepHandlerMultiplexer(org.orekit.propagation.sampling.OrekitStepHandlerMultiplexer) DummyLocalizable(org.hipparchus.exception.DummyLocalizable) SpacecraftState(org.orekit.propagation.SpacecraftState) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) OrekitStepInterpolator(org.orekit.propagation.sampling.OrekitStepInterpolator) Test(org.junit.Test)

Aggregations

DummyLocalizable (org.hipparchus.exception.DummyLocalizable)1 Test (org.junit.Test)1 OrekitException (org.orekit.errors.OrekitException)1 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)1 SpacecraftState (org.orekit.propagation.SpacecraftState)1 OrekitStepHandler (org.orekit.propagation.sampling.OrekitStepHandler)1 OrekitStepHandlerMultiplexer (org.orekit.propagation.sampling.OrekitStepHandlerMultiplexer)1 OrekitStepInterpolator (org.orekit.propagation.sampling.OrekitStepInterpolator)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)1