use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class NumericalPropagatorTest method testEphemerisModeWithHandler.
@Test
public void testEphemerisModeWithHandler() throws OrekitException {
// setup
AbsoluteDate end = initDate.shiftedBy(90 * 60);
// action
final List<SpacecraftState> states = new ArrayList<>();
propagator.setEphemerisMode((interpolator, isLast) -> states.add(interpolator.getCurrentState()));
propagator.propagate(end);
final BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
// verify
// got some data
Assert.assertTrue(states.size() > 10);
for (SpacecraftState state : states) {
PVCoordinates actual = ephemeris.propagate(state.getDate()).getPVCoordinates();
Assert.assertThat(actual, OrekitMatchers.pvIs(state.getPVCoordinates()));
}
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class NumericalPropagatorTest method testStopEvent.
@Test
public void testStopEvent() throws OrekitException {
final AbsoluteDate stopDate = initDate.shiftedBy(1000);
CheckingHandler<DateDetector> checking = new CheckingHandler<DateDetector>(Action.STOP);
propagator.addEventDetector(new DateDetector(stopDate).withHandler(checking));
Assert.assertEquals(1, propagator.getEventsDetectors().size());
checking.assertEvent(false);
final SpacecraftState finalState = propagator.propagate(initDate.shiftedBy(3200));
checking.assertEvent(true);
Assert.assertEquals(0, finalState.getDate().durationFrom(stopDate), 1.0e-10);
propagator.clearEventsDetectors();
Assert.assertEquals(0, propagator.getEventsDetectors().size());
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class PartialDerivativesTest method testWrongParametersDimension.
@Test
public void testWrongParametersDimension() throws OrekitException {
Orbit initialOrbit = new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
double dP = 0.001;
ForceModel sunAttraction = new ThirdBodyAttraction(CelestialBodyFactory.getSun());
sunAttraction.getParameterDriver("Sun attraction coefficient").setSelected(true);
ForceModel moonAttraction = new ThirdBodyAttraction(CelestialBodyFactory.getMoon());
NumericalPropagator propagator = setUpPropagator(initialOrbit, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE, sunAttraction, moonAttraction);
PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
try {
partials.setInitialJacobians(new SpacecraftState(initialOrbit), new double[6][6], new double[6][3]);
partials.computeDerivatives(new SpacecraftState(initialOrbit), new double[6]);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.INITIAL_MATRIX_AND_PARAMETERS_NUMBER_MISMATCH, oe.getSpecifier());
}
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class PartialDerivativesTest method testTooLargeDimension.
@Test(expected = OrekitException.class)
public void testTooLargeDimension() throws OrekitException {
Orbit initialOrbit = new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
double dP = 0.001;
NumericalPropagator propagator = setUpPropagator(initialOrbit, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE);
PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
partials.setInitialJacobians(new SpacecraftState(initialOrbit), new double[8][6], new double[6][2]);
}
use of org.orekit.propagation.SpacecraftState in project Orekit by CS-SI.
the class PartialDerivativesTest method testTooSmallDimension.
@Test(expected = OrekitException.class)
public void testTooSmallDimension() throws OrekitException {
Orbit initialOrbit = new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
double dP = 0.001;
NumericalPropagator propagator = setUpPropagator(initialOrbit, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE);
PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
partials.setInitialJacobians(new SpacecraftState(initialOrbit), new double[5][6], new double[6][2]);
}
Aggregations