use of org.orekit.propagation.events.AltitudeDetector in project Orekit by CS-SI.
the class KeplerianPropagatorTest method altitude.
@Test
public void altitude() 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);
BodyShape bodyShape = new OneAxisEllipsoid(6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
AltitudeDetector detector = new AltitudeDetector(0.05 * orbit.getKeplerianPeriod(), 1500000, bodyShape);
Assert.assertEquals(1500000, detector.getAltitude(), 1.0e-12);
propagator.addEventDetector(detector);
AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
SpacecraftState propagated = propagator.propagate(farTarget);
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) > 5400.0);
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) < 5500.0);
GeodeticPoint gp = bodyShape.transform(propagated.getPVCoordinates().getPosition(), propagated.getFrame(), propagated.getDate());
Assert.assertEquals(1500000, gp.getAltitude(), 0.1);
}
Aggregations