Search in sources :

Example 1 with FieldAltitudeDetector

use of org.orekit.propagation.events.FieldAltitudeDetector in project Orekit by CS-SI.

the class FieldKeplerianPropagatorTest method doTestAltitude.

private <T extends RealFieldElement<T>> void doTestAltitude(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    final FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(7.8e6), zero.add(0.032), zero.add(0.4), zero.add(0.1), zero.add(0.2), zero.add(0.3), PositionAngle.TRUE, FramesFactory.getEME2000(), new FieldAbsoluteDate<>(field), 3.986004415e14);
    FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
    BodyShape bodyShape = new OneAxisEllipsoid(6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    FieldAltitudeDetector<T> detector = new FieldAltitudeDetector<>(orbit.getKeplerianPeriod().multiply(0.05), zero.add(1500000), bodyShape);
    Assert.assertEquals(1500000, detector.getAltitude().getReal(), 1.0e-12);
    propagator.addEventDetector(detector);
    FieldAbsoluteDate<T> farTarget = new FieldAbsoluteDate<>(field).shiftedBy(10000.0);
    FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 5400.0);
    Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() < 5500.0);
    FieldGeodeticPoint<T> gp = bodyShape.transform(propagated.getPVCoordinates().getPosition(), propagated.getFrame(), propagated.getDate());
    Assert.assertEquals(1500000, gp.getAltitude().getReal(), 0.1);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) BodyShape(org.orekit.bodies.BodyShape) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) FieldAltitudeDetector(org.orekit.propagation.events.FieldAltitudeDetector)

Aggregations

BodyShape (org.orekit.bodies.BodyShape)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)1 FieldAltitudeDetector (org.orekit.propagation.events.FieldAltitudeDetector)1