[Bug ?] Cannot use Dsst with Osculating propagation type and event detector

Hi,

I do not know if I found a bug in the Dsst propagator or I my usage is wrong, but when I try to propagate with the Dsst propagator in Osculating propagation type and with an event detector I have the following error

org.orekit.errors.OrekitException: sample for interpolation is empty

	at org.orekit.errors.OrekitException.unwrap(OrekitException.java:154)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:492)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:414)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:397)
Caused by: org.hipparchus.exception.MathIllegalArgumentException: sample for interpolation is empty
	at org.hipparchus.analysis.interpolation.HermiteInterpolator.checkInterpolation(HermiteInterpolator.java:277)
	at org.hipparchus.analysis.interpolation.HermiteInterpolator.value(HermiteInterpolator.java:176)
	at org.orekit.propagation.semianalytical.dsst.utilities.ShortPeriodicsInterpolatedCoefficient.value(ShortPeriodicsInterpolatedCoefficient.java:76)
	at org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal$ZonalShortPeriodicCoefficients.value(DSSTZonal.java:1484)
	at org.orekit.propagation.semianalytical.dsst.DSSTPropagator$MeanPlusShortPeriodicMapper.mapArrayToState(DSSTPropagator.java:780)
	at org.orekit.propagation.integration.StateMapper.mapArrayToState(StateMapper.java:167)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.getCompleteState(AbstractIntegratedPropagator.java:593)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.access$600(AbstractIntegratedPropagator.java:63)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator$AdaptedEventDetector.init(AbstractIntegratedPropagator.java:772)
	at org.hipparchus.ode.AbstractIntegrator.initIntegration(AbstractIntegrator.java:225)
	at org.hipparchus.ode.nonstiff.EmbeddedRungeKuttaIntegrator.integrate(EmbeddedRungeKuttaIntegrator.java:196)
	at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:466)
	... 42 more

As far as I analyzed, I think the detector is the main problem because it uses the complete state to be initialized and I guess some short period coefficients used by the Dsst Force Model have not be initialized. Indeed when I remove the event detector, I have no problem to propagate with Dsst.

Another thing interesting, when I propagate with in Mean propagation type, the problem does not occur.

You will find my test below (after orekit data initialization).

import org.hipparchus.util.FastMath;
import org.junit.jupiter.api.Test;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
import org.orekit.frames.FactoryManagedFrame;
import org.orekit.frames.FramesFactory;
import org.orekit.orbits.KeplerianOrbit;
import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.PropagationType;
import org.orekit.propagation.conversion.DSSTPropagatorBuilder;
import org.orekit.propagation.conversion.DormandPrince853IntegratorBuilder;
import org.orekit.propagation.events.NodeDetector;
import org.orekit.propagation.events.handlers.StopOnEvent;
import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;

public class DsstTest {

    @Test
    public void testDsst() {
        AbsoluteDate date = new AbsoluteDate(2000, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC());
        FactoryManagedFrame frame = FramesFactory.getTOD(false);
        KeplerianOrbit orbit = new KeplerianOrbit(7000e3, 1e-3, FastMath.toRadians(98.0), 0.0, 0.0, 0.0, PositionAngle.TRUE, frame, date, Constants.WGS84_EARTH_MU);
        DormandPrince853IntegratorBuilder integrator = new DormandPrince853IntegratorBuilder(1.0, 86400, 10.0);
        DSSTPropagatorBuilder builder = new DSSTPropagatorBuilder(orbit, integrator, 10e3, PropagationType.OSCULATING, PropagationType.OSCULATING);
        DSSTPropagator dsstPropagator = builder.buildPropagator(builder.getSelectedNormalizedParameters());
        dsstPropagator.addEventDetector(new NodeDetector(orbit, frame).withHandler(new StopOnEvent<>()));
        dsstPropagator.addForceModel(newDsstZonal());
        dsstPropagator.propagate(date.shiftedBy(10.0));
    }

    private DSSTZonal newDsstZonal() {
        UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(6, 4);
        int maxDegreeShortPeriodics = 6;
        int maxEccPowShortPeriodics = 4;
        int maxFrequencyShortPeriodics = 12;
        return new DSSTZonal(provider, maxDegreeShortPeriodics, maxEccPowShortPeriodics, maxFrequencyShortPeriodics);
    }
}

Thank you for your answer.

Best regards,

Dorian

Hi @dorian,

I looked at your test and performed it with different configurations:

  • Change the initial spacecraft state (orbit, date, integrator, frame).
  • Change the integrator.
  • Change the DSST force model. I tested with DSSTThirdBody and DSSTSolarRadiationPressure.
  • Change the event detector. I tested with an elevation detector.

With all the configurations, the test fail with the same error message you have.

So, I think there is a bug when using the DSST with osculating propagation and event detector. There is no test in Orekit that verify a DSST osculating propagation with an event detector. Could you open an issue in our tracker at https://gitlab.orekit.org/orekit/orekit/issues ?

If you want to use mean propagation type, the short periodic terms are not computed. The bug occurs during the computation of the short periodic terms. That’s why you don’t have the bug when using a mean propagation type.

Kind regards,

Bryan

Hi Bryan,

Thanks for the answer, the issue is opened:

Kind regards,

Dorian