use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.
the class FieldEcksteinHechlerPropagatorTest method doWrongAttitude.
private <T extends RealFieldElement<T>> void doWrongAttitude(Field<T> field) throws OrekitException {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(zero.add(1.0e10), zero.add(1.0e-4), zero.add(1.0e-2), zero, zero, zero, PositionAngle.TRUE, FramesFactory.getEME2000(), date, 3.986004415e14);
final DummyLocalizable gasp = new DummyLocalizable("gasp");
AttitudeProvider wrongLaw = new AttitudeProvider() {
private static final long serialVersionUID = 1L;
@Override
public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame) throws OrekitException {
throw new OrekitException(gasp, new RuntimeException());
}
@Override
public <Q extends RealFieldElement<Q>> FieldAttitude<Q> getAttitude(FieldPVCoordinatesProvider<Q> pvProv, FieldAbsoluteDate<Q> date, Frame frame) throws OrekitException {
throw new OrekitException(gasp, new RuntimeException());
}
};
try {
FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, wrongLaw, provider);
propagator.propagate(date.shiftedBy(10.0));
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertSame(gasp, oe.getSpecifier());
}
}
use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.
the class FieldEcksteinHechlerPropagatorTest method doSetting.
private <T extends RealFieldElement<T>> void doSetting(Field<T> field) throws OrekitException {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
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(), date, 3.986004415e14);
FieldEcksteinHechlerPropagator<T> propagator = new FieldEcksteinHechlerPropagator<>(orbit, provider);
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);
FieldElevationDetector<T> detector = new FieldElevationDetector<>(zero.add(60), zero.add(1.0e-9), topo).withConstantElevation(0.09);
Assert.assertEquals(0.09, detector.getMinElevation(), 1.0e-12);
Assert.assertTrue(topo == detector.getTopocentricFrame());
propagator.addEventDetector(detector);
FieldAbsoluteDate<T> farTarget = date.shiftedBy(10000.0);
FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
final double elevation = topo.getElevation(propagated.getPVCoordinates().getPosition().toVector3D(), propagated.getFrame(), propagated.getDate().toAbsoluteDate());
final double zVelocity = propagated.getPVCoordinates(topo).getVelocity().getZ().getReal();
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()).getReal() > 7800.0);
Assert.assertTrue("Incorrect value " + farTarget.durationFrom(propagated.getDate()) + " !< 7900", farTarget.durationFrom(propagated.getDate()).getReal() < 7900.0);
Assert.assertEquals(0.09, elevation, 1.0e-11);
Assert.assertTrue(zVelocity < 0);
}
use of org.orekit.orbits.FieldKeplerianOrbit 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);
}
use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.
the class FieldKeplerianPropagatorTest method doTestStepException.
private <T extends RealFieldElement<T>> void doTestStepException(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);
FieldOrekitStepHandlerMultiplexer<T> multiplexer = new FieldOrekitStepHandlerMultiplexer<>();
propagator.setMasterMode(multiplexer);
multiplexer.add(new FieldOrekitStepHandler<T>() {
public void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t) {
}
public void handleStep(FieldOrekitStepInterpolator<T> interpolator, boolean isLast) throws OrekitException {
if (isLast) {
throw new OrekitException((Throwable) null, new DummyLocalizable("dummy error"));
}
}
});
propagator.propagate(orbit.getDate().shiftedBy(-3600));
}
use of org.orekit.orbits.FieldKeplerianOrbit in project Orekit by CS-SI.
the class FieldKeplerianPropagatorTest method doTestStopAtTargetDate.
private <T extends RealFieldElement<T>> void doTestStopAtTargetDate(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);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
propagator.addEventDetector(new FieldNodeDetector<>(orbit, itrf).withHandler(new FieldContinueOnEvent<FieldNodeDetector<T>, T>()));
FieldAbsoluteDate<T> farTarget = orbit.getDate().shiftedBy(10000.0);
FieldSpacecraftState<T> propagated = propagator.propagate(farTarget);
Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate()).getReal()), 1.0e-3);
}
Aggregations