Search in sources :

Example 1 with AltitudeDetector

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) AltitudeDetector(org.orekit.propagation.events.AltitudeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) BodyShape(org.orekit.bodies.BodyShape) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BodyShape (org.orekit.bodies.BodyShape)1 GeodeticPoint (org.orekit.bodies.GeodeticPoint)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)1 SpacecraftState (org.orekit.propagation.SpacecraftState)1 AltitudeDetector (org.orekit.propagation.events.AltitudeDetector)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)1