use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testMu.
@Test
public void testMu() throws OrekitException {
final KeplerianOrbit orbit1 = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.WGS84_EARTH_MU);
final KeplerianOrbit orbit2 = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
final AbsoluteDate target = orbit1.getDate().shiftedBy(10000.0);
PVCoordinates pv1 = new KeplerianPropagator(orbit1).propagate(target).getPVCoordinates();
PVCoordinates pv2 = new KeplerianPropagator(orbit2).propagate(target).getPVCoordinates();
PVCoordinates pvWithMu1 = new KeplerianPropagator(orbit2, orbit1.getMu()).propagate(target).getPVCoordinates();
Assert.assertEquals(0.026054, Vector3D.distance(pv1.getPosition(), pv2.getPosition()), 1.0e-6);
Assert.assertEquals(0.0, Vector3D.distance(pv1.getPosition(), pvWithMu1.getPosition()), 1.0e-15);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method date.
@Test
public void date() throws OrekitException {
final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
KeplerianPropagator propagator = new KeplerianPropagator(orbit);
final AbsoluteDate stopDate = AbsoluteDate.J2000_EPOCH.shiftedBy(500.0);
propagator.addEventDetector(new DateDetector(stopDate));
AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
SpacecraftState propagated = propagator.propagate(farTarget);
Assert.assertEquals(0, stopDate.durationFrom(propagated.getDate()), 1.0e-10);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testEphemerisModeWithHandler.
@Test
public void testEphemerisModeWithHandler() throws OrekitException {
// setup
AbsoluteDate initDate = AbsoluteDate.GPS_EPOCH;
Orbit ic = new KeplerianOrbit(6378137 + 500e3, 1e-3, 0, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getGCRF(), initDate, mu);
Propagator propagator = new KeplerianPropagator(ic);
AbsoluteDate end = initDate.shiftedBy(90 * 60);
// action
final List<SpacecraftState> states = new ArrayList<>();
propagator.setEphemerisMode((interpolator, isLast) -> {
states.add(interpolator.getCurrentState());
states.add(interpolator.getPreviousState());
});
propagator.propagate(end);
final BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
// verify
// got some data
Assert.assertTrue(states.size() > 1);
for (SpacecraftState state : states) {
PVCoordinates actual = ephemeris.propagate(state.getDate()).getPVCoordinates();
Assert.assertThat(actual, OrekitMatchers.pvIs(state.getPVCoordinates()));
}
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method sameDateKeplerian.
@Test
public void sameDateKeplerian() throws OrekitException {
// Definition of initial conditions with Keplerian parameters
// -----------------------------------------------------------
AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
Orbit initialOrbit = new KeplerianOrbit(7209668.0, 0.5e-4, 1.7, 2.1, 2.9, 6.2, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
// Extrapolator definition
// -----------------------
KeplerianPropagator extrapolator = new KeplerianPropagator(initialOrbit);
// Extrapolation at the initial date
// ---------------------------------
// extrapolation duration in seconds
double delta_t = 0.0;
AbsoluteDate extrapDate = initDate.shiftedBy(delta_t);
SpacecraftState finalOrbit = extrapolator.propagate(extrapDate);
double a = finalOrbit.getA();
// another way to compute n
double n = FastMath.sqrt(finalOrbit.getMu() / FastMath.pow(a, 3));
Assert.assertEquals(n * delta_t, finalOrbit.getLM() - initialOrbit.getLM(), Utils.epsilonTest * FastMath.max(100., FastMath.abs(n * delta_t)));
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbit.getLM(), initialOrbit.getLM()), initialOrbit.getLM(), Utils.epsilonAngle * FastMath.abs(initialOrbit.getLM()));
Assert.assertEquals(finalOrbit.getA(), initialOrbit.getA(), Utils.epsilonTest * initialOrbit.getA());
Assert.assertEquals(finalOrbit.getE(), initialOrbit.getE(), Utils.epsilonE * initialOrbit.getE());
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbit.getI(), initialOrbit.getI()), initialOrbit.getI(), Utils.epsilonAngle * FastMath.abs(initialOrbit.getI()));
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method fixedStep.
@Test
public void fixedStep() throws OrekitException {
final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
KeplerianPropagator propagator = new KeplerianPropagator(orbit);
final double step = 100.0;
propagator.setMasterMode(step, new OrekitFixedStepHandler() {
private AbsoluteDate previous;
public void handleStep(SpacecraftState currentState, boolean isLast) throws OrekitException {
if (previous != null) {
Assert.assertEquals(step, currentState.getDate().durationFrom(previous), 1.0e-10);
}
previous = currentState.getDate();
}
});
AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
propagator.propagate(farTarget);
}
Aggregations