Search in sources :

Example 66 with SpacecraftState

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()));
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) ArrayList(java.util.ArrayList) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 67 with SpacecraftState

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());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 68 with SpacecraftState

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());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ThirdBodyAttraction(org.orekit.forces.gravity.ThirdBodyAttraction) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) ForceModel(org.orekit.forces.ForceModel) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 69 with SpacecraftState

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]);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 70 with SpacecraftState

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]);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Aggregations

SpacecraftState (org.orekit.propagation.SpacecraftState)470 Test (org.junit.Test)324 AbsoluteDate (org.orekit.time.AbsoluteDate)280 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)178 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)153 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)138 Orbit (org.orekit.orbits.Orbit)131 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)127 PVCoordinates (org.orekit.utils.PVCoordinates)98 CartesianOrbit (org.orekit.orbits.CartesianOrbit)95 Propagator (org.orekit.propagation.Propagator)92 Frame (org.orekit.frames.Frame)79 OrekitException (org.orekit.errors.OrekitException)74 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)74 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)74 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)70 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)64 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)61 CircularOrbit (org.orekit.orbits.CircularOrbit)58 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)57