Integration with InterSatDirectViewDetector needs smaller and smaller minimal step size

Hello,
I am getting the following error when I try to run a Generator to which I have added an EventBasedScheduler with an InterSatDirectViewDetector. When I reduce the minimum step size, I just keep getting the error with smaller and smaller step sizes required.

Java exception occurred:
org.orekit.errors.OrekitException: minimal step size (1.00E-03) reached, integration needs 4.89E-04
at org.orekit.errors.OrekitException.unwrap(OrekitException.java:154)
at
org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:511)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:425)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:385)
at org.orekit.propagation.numerical.NumericalPropagator.getPVCoordinates(NumericalPropagator.java:747)
at org.orekit.propagation.events.InterSatDirectViewDetector.g(InterSatDirectViewDetector.java:152)
at org.orekit.propagation.events.AdapterDetector.g(AdapterDetector.java:61)
at org.orekit.estimation.measurements.generation.EventBasedScheduler$FeasibilityAdapter.init(EventBasedScheduler.java:148)
at
org.orekit.propagation.integration.AbstractIntegratedPropagator$AdaptedEventDetector.init(AbstractIntegratedPropagator.java:899)
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.integrateDynamics(AbstractIntegratedPropagator.java:477)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:425)
at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.lambda$new$0(PropagatorsParallelizer.java:395)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.hipparchus.exception.MathIllegalArgumentException: minimal step size (1.00E-03) reached, integration needs 4.89E-04
at org.hipparchus.ode.nonstiff.StepsizeHelper.filterStep(StepsizeHelper.java:179)
at org.hipparchus.ode.nonstiff.EmbeddedRungeKuttaIntegrator.integrate(EmbeddedRungeKuttaIntegrator.java:276)
at
org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:477)
… 16 more

I have made sure that the propagator is a separate propagator, not run in a propagators parallelizer with the propagator that the detector is registered within.
Is there any other debugging step that you would recommend?
Thank you,
Erin

Hi @erinf,

Can it come from the dynamics ? like the altitude is very low and the drag model needs very small steps ?
You can maybe try with a fixed time step integrator like RK4, or provide a sample code (JUnit preferably) that we could run and debug.

Best,
Maxime

Thank you for the advice, @MaximeJ.
I don’t think it is the dynamics because I have simplified them as much as possible.
I tried switching to ClassicalRungeKuttaIntegratorBuilder rather than DormandPrince853IntegratorBuilder, and now I am getting a new error (below). Does this error shed any light on the problem? I can’t really tell what might be causing the NullPointerException.
Erin

org.orekit.errors.OrekitException: java.lang.NullPointerException
at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.manageException(PropagatorsParallelizer.java:452)
at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.retrieveNextParameters(PropagatorsParallelizer.java:434)
at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.waitFirstStepCompletion(PropagatorsParallelizer.java:408)
at org.orekit.propagation.PropagatorsParallelizer.propagate(PropagatorsParallelizer.java:150)
at org.orekit.estimation.measurements.generation.Generator.generate(Generator.java:95)
Caused by: java.lang.NullPointerException
at org.hipparchus.ode.nonstiff.RungeKuttaIntegrator.integrate(RungeKuttaIntegrator.java:146)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:477)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:425)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:385)
at org.orekit.propagation.numerical.NumericalPropagator.getPVCoordinates(NumericalPropagator.java:747)
at org.orekit.propagation.events.InterSatDirectViewDetector.g(InterSatDirectViewDetector.java:152)
at org.orekit.propagation.events.AdapterDetector.g(AdapterDetector.java:61)
at org.orekit.estimation.measurements.generation.EventBasedScheduler$FeasibilityAdapter.init(EventBasedScheduler.java:148)
at
org.orekit.propagation.integration.AbstractIntegratedPropagator$AdaptedEventDetector.init(AbstractIntegratedPropagator.java:899)
at org.hipparchus.ode.AbstractIntegrator.initIntegration(AbstractIntegrator.java:225)
at org.hipparchus.ode.nonstiff.RungeKuttaIntegrator.integrate(RungeKuttaIntegrator.java:103)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.integrateDynamics(AbstractIntegratedPropagator.java:477)
at org.orekit.propagation.integration.AbstractIntegratedPropagator.propagate(AbstractIntegratedPropagator.java:425)
at org.orekit.propagation.PropagatorsParallelizer$PropagatorMonitoring.lambda$new$0(PropagatorsParallelizer.java:395)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Is your second propagator a numerical or an analytical propagator?
The javadoc warns against using a numerical propagator for the secondary because it will be called by the primary during search. I guess this could end up with attempting propagation on too small time ranges.

Yes, all propagators are numerical in this case. Is it true of all EventDetectors that they should not use numerical propagators for the second propagator?

The other event detectors don’t embed a secondary propagator. The limitation here is that you have two satellites to handle at the same time. The even detector is driven by a propagator to some dates, searching for the exact date of the event. During this search, it knows what time is it and were the first satellite is at that time (the propagator provides a state interpolator for that), but it had to find were the second satellite is, and the propagator doesn’t even know this second satellite exists, so the detector drives it. It does so by running the underlying PVCoordinatesProvider that was used at construction time (it is the parameter secondary). If this secondary provider is a numerical propagator, it will be called during the search. However, as numerical propagators must always go through all intermediate steps, they have a special setting: they reset their initial state at the end of each propagation, hence allowing them to restart from where they stopped if the same propagator is reused several time in a row. In your case, this means that just before convergence, you will propagate for time ranges in the order of magnitude of your threshold, which typically counts in milliseconds.

If you want full accuracy and don’t have interdependence of dynamics between the two satellites, I would suggest that you propagate the secondary satellite with ephemeris generation activated during a first pass, and then use the generated ephemeris as the secondary PVCoordinatesProvider for the event detector used by the second propagator. The ephemeris is analytical, it will be fast and as accurate as the initial numerical propagator (it in facts stores the step interpolators produced by thge integrator itself).