Search in sources :

Example 6 with OrekitStepHandler

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

the class KeplerianPropagatorTest method variableStep.

@Test
public void variableStep() 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);
    final double step = orbit.getKeplerianPeriod() / 100;
    propagator.setMasterMode(new OrekitStepHandler() {

        private AbsoluteDate previous;

        public void handleStep(OrekitStepInterpolator interpolator, boolean isLast) throws OrekitException {
            if ((previous != null) && !isLast) {
                Assert.assertEquals(step, interpolator.getCurrentState().getDate().durationFrom(previous), 1.0e-10);
            }
            previous = interpolator.getCurrentState().getDate();
        }
    });
    AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
    propagator.propagate(farTarget);
}
Also used : 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

OrekitException (org.orekit.errors.OrekitException)6 OrekitStepHandler (org.orekit.propagation.sampling.OrekitStepHandler)6 Test (org.junit.Test)5 OrekitStepInterpolator (org.orekit.propagation.sampling.OrekitStepInterpolator)5 SpacecraftState (org.orekit.propagation.SpacecraftState)4 AbsoluteDate (org.orekit.time.AbsoluteDate)4 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)3 JacobiansMapper (org.orekit.propagation.numerical.JacobiansMapper)2 PartialDerivativesEquations (org.orekit.propagation.numerical.PartialDerivativesEquations)2 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)2 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 DummyLocalizable (org.hipparchus.exception.DummyLocalizable)1 Array2DRowRealMatrix (org.hipparchus.linear.Array2DRowRealMatrix)1 RealMatrix (org.hipparchus.linear.RealMatrix)1 ODEIntegrator (org.hipparchus.ode.ODEIntegrator)1 ClassicalRungeKuttaIntegrator (org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator)1 FastMath (org.hipparchus.util.FastMath)1 After (org.junit.After)1 Assert (org.junit.Assert)1 Before (org.junit.Before)1