Commit d7fe166f authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Merge branch 'issue-872' into develop

parents da389790 e2eca82e
......@@ -21,6 +21,10 @@
</properties>
<body>
<release version="11.1" date="TBD" description="TBD">
<action dev="luc" type="fix" issue="872">
Fixed multiple detection of events when using propagate(start, target) with
integration-based propagators.
</action>
<action dev="bryan" type="add" issue="869">
Allowed Brouwer-Lyddane model to work for the critical inclination.
</action>
......
......@@ -439,7 +439,9 @@ public abstract class AbstractIntegratedPropagator extends AbstractPropagator {
if (!tStart.equals(getInitialState().getDate())) {
// if propagation start date is not initial date,
// propagate from initial to start date without event detection
integrateDynamics(tStart);
try (IntegratorResetter startResetter = new IntegratorResetter(integrator)) {
integrateDynamics(tStart);
}
}
// set up events added by user
......@@ -1167,7 +1169,7 @@ public abstract class AbstractIntegratedPropagator extends AbstractPropagator {
* This class is intended to be used in a try-with-resource statement.
* If propagator-specific event handlers and step handlers are added to
* the integrator in the try block, they will be removed automatically
* when leaving the block, so the integrator only keep its own handlers
* when leaving the block, so the integrator only keeps its own handlers
* between calls to {@link AbstractIntegratedPropagator#propagate(AbsoluteDate, AbsoluteDate).
* </p>
* @since 11.0
......
......@@ -392,7 +392,9 @@ public abstract class FieldAbstractIntegratedPropagator<T extends CalculusFieldE
if (!tStart.equals(getInitialState().getDate())) {
// if propagation start date is not initial date,
// propagate from initial to start date without event detection
integrateDynamics(tStart);
try (IntegratorResetter<T> startResetter = new IntegratorResetter<>(integrator)) {
integrateDynamics(tStart);
}
}
// set up events added by user
......
......@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Stream;
......@@ -112,6 +113,32 @@ public class NumericalPropagatorTest {
private SpacecraftState initialState;
private NumericalPropagator propagator;
@Test
public void testEventsWithTimeRangePropagation() {
final AtomicInteger counter = new AtomicInteger(0);
final double dt = 60.0;
final EventDetector singleDetector = new DateDetector(initDate.shiftedBy(dt / 2)).
withHandler((state, detector, increasing) -> {
counter.incrementAndGet();
return Action.CONTINUE;
});
ForceModel force = new ForceModelAdapter() {
@Override
public Stream<EventDetector> getEventsDetectors() {
return Stream.of(singleDetector);
}
};
// action
propagator.setOrbitType(OrbitType.CARTESIAN);
propagator.addForceModel(force);
AbsoluteDate target = initDate.shiftedBy(dt);
propagator.propagate(initDate.shiftedBy(1.0), target);
Assert.assertEquals(1, counter.intValue());
}
@Test
public void testForceModelInitialized() {
// setup
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment