Commit 66b7bdb0 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Fixed initialization of maneuver trigger events.

Fixes #874
parent 24c4da7a
Pipeline #1629 passed with stages
in 20 minutes and 5 seconds
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.1" date="TBD" description="TBD">
<action dev="bryan" type="fix" issue="874">
Fixed initialization of maneuver trigger events when using EventBasedManeuverTriggers.
</action>
<action dev="luc" type="fix" issue="872">
Fixed multiple detection of events when using propagate(start, target) with
integration-based propagators.
......
......@@ -144,6 +144,8 @@ public class EventBasedManeuverTriggers implements ManeuverTriggers, EventHandle
// backward propagation was forbidden
throw new OrekitException(OrekitMessages.BACKWARD_PROPAGATION_NOT_ALLOWED);
}
startFiringDetector.init(initialState, target);
stopFiringDetector.init(initialState, target);
checkInitialFiringState(initialState);
......
......@@ -50,6 +50,7 @@ import org.orekit.propagation.events.AbstractDetector;
import org.orekit.propagation.events.BooleanDetector;
import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.events.NegateDetector;
import org.orekit.propagation.events.PositionAngleDetector;
import org.orekit.propagation.events.handlers.ContinueOnEvent;
import org.orekit.propagation.events.handlers.EventHandler;
import org.orekit.propagation.events.handlers.StopOnEvent;
......@@ -358,6 +359,19 @@ public class ConfigurableLowThrustManeuverTest {
maneuverStopDetector, thrust, isp);
}
private ConfigurableLowThrustManeuver buildPsoManeuver() {
final PositionAngleDetector maneuverStartDetector = new PositionAngleDetector(OrbitType.EQUINOCTIAL,
PositionAngle.MEAN, FastMath.toRadians(0.0));
final PositionAngleDetector maneuverStopDetector = new PositionAngleDetector(OrbitType.EQUINOCTIAL,
PositionAngle.MEAN, FastMath.toRadians(90.0));
// thrust in velocity direction to increase semi-major-axis
return new ConfigurableLowThrustManeuver(buildVelocityThrustDirectionProvider(), maneuverStartDetector,
maneuverStopDetector, thrust, isp);
}
@Test
public void testNominalUseCase() {
/////////////////// initial conditions /////////////////////////////////
......@@ -734,6 +748,31 @@ public class ConfigurableLowThrustManeuverTest {
}
@Test
public void testIssue874() {
/////////////////// initial conditions /////////////////////////////////
final KeplerianOrbit initOrbit = buildInitOrbit();
final double initMass = 20;
final SpacecraftState initialState = new SpacecraftState(initOrbit, initMass);
final AbsoluteDate initialDate = initOrbit.getDate();
final double simulationDuration = 2 * 86400;
final AbsoluteDate finalDate = initialDate.shiftedBy(simulationDuration);
/////////////////// propagations /////////////////////////////////
final NumericalPropagator numericalPropagator = buildNumericalPropagator(initOrbit);
numericalPropagator.addForceModel(buildPsoManeuver());
numericalPropagator.setInitialState(initialState);
final SpacecraftState finalStateNumerical = numericalPropagator.propagate(finalDate);
/////////////////// results check /////////////////////////////////
final double expectedPropellantConsumption = -0.028;
final double expectedDeltaSemiMajorAxisRealized = 20920;
Assert.assertEquals(expectedPropellantConsumption, finalStateNumerical.getMass() - initialState.getMass(),
0.005);
Assert.assertEquals(expectedDeltaSemiMajorAxisRealized, finalStateNumerical.getA() - initialState.getA(), 100);
}
@Test(expected = OrekitException.class)
public void testStartDetectorNotSet() {
new ConfigurableLowThrustManeuver(buildVelocityThrustDirectionProvider(), null,
......
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