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 @@ ...@@ -21,6 +21,9 @@
</properties> </properties>
<body> <body>
<release version="11.1" date="TBD" description="TBD"> <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"> <action dev="luc" type="fix" issue="872">
Fixed multiple detection of events when using propagate(start, target) with Fixed multiple detection of events when using propagate(start, target) with
integration-based propagators. integration-based propagators.
......
...@@ -144,6 +144,8 @@ public class EventBasedManeuverTriggers implements ManeuverTriggers, EventHandle ...@@ -144,6 +144,8 @@ public class EventBasedManeuverTriggers implements ManeuverTriggers, EventHandle
// backward propagation was forbidden // backward propagation was forbidden
throw new OrekitException(OrekitMessages.BACKWARD_PROPAGATION_NOT_ALLOWED); throw new OrekitException(OrekitMessages.BACKWARD_PROPAGATION_NOT_ALLOWED);
} }
startFiringDetector.init(initialState, target);
stopFiringDetector.init(initialState, target);
checkInitialFiringState(initialState); checkInitialFiringState(initialState);
......
...@@ -50,6 +50,7 @@ import org.orekit.propagation.events.AbstractDetector; ...@@ -50,6 +50,7 @@ import org.orekit.propagation.events.AbstractDetector;
import org.orekit.propagation.events.BooleanDetector; import org.orekit.propagation.events.BooleanDetector;
import org.orekit.propagation.events.EventDetector; import org.orekit.propagation.events.EventDetector;
import org.orekit.propagation.events.NegateDetector; 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.ContinueOnEvent;
import org.orekit.propagation.events.handlers.EventHandler; import org.orekit.propagation.events.handlers.EventHandler;
import org.orekit.propagation.events.handlers.StopOnEvent; import org.orekit.propagation.events.handlers.StopOnEvent;
...@@ -358,6 +359,19 @@ public class ConfigurableLowThrustManeuverTest { ...@@ -358,6 +359,19 @@ public class ConfigurableLowThrustManeuverTest {
maneuverStopDetector, thrust, isp); 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 @Test
public void testNominalUseCase() { public void testNominalUseCase() {
/////////////////// initial conditions ///////////////////////////////// /////////////////// initial conditions /////////////////////////////////
...@@ -734,6 +748,31 @@ public class ConfigurableLowThrustManeuverTest { ...@@ -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) @Test(expected = OrekitException.class)
public void testStartDetectorNotSet() { public void testStartDetectorNotSet() {
new ConfigurableLowThrustManeuver(buildVelocityThrustDirectionProvider(), null, 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