use of org.orekit.propagation.events.FieldElevationDetector in project Orekit by CS-SI.
the class FieldKeplerianPropagatorTest method doTestSetting.
private <T extends RealFieldElement<T>> void doTestSetting(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);
final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final TopocentricFrame topo = new TopocentricFrame(earthShape, new GeodeticPoint(0.389, -2.962, 0), null);
propagator.addEventDetector(new FieldElevationDetector<>(zero.add(60), zero.add(FieldAbstractDetector.DEFAULT_THRESHOLD), topo).withConstantElevation(0.09));
FieldAbsoluteDate<T> farTarget = new FieldAbsoluteDate<>(field).shiftedBy(10000.0);
FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
final double elevation = topo.getElevation(propagated.getPVCoordinates().getPosition().toVector3D(), propagated.getFrame(), propagated.getDate().toAbsoluteDate());
final T zVelocity = propagated.getPVCoordinates(topo).getVelocity().getZ();
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 7800.0);
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() < 7900.0);
Assert.assertEquals(0.09, elevation, 1.0e-9);
Assert.assertTrue(zVelocity.getReal() < 0);
}
Aggregations