use of org.orekit.propagation.events.FieldApsideDetector in project Orekit by CS-SI.
the class FieldNumericalPropagatorTest method doTestEventDetectionBug.
private <T extends RealFieldElement<T>> void doTestEventDetectionBug(final Field<T> field) throws OrekitException {
T zero = field.getZero();
TimeScale utc = TimeScalesFactory.getUTC();
FieldAbsoluteDate<T> initialDate = new FieldAbsoluteDate<>(field, 2005, 1, 1, 0, 0, 0.0, utc);
T duration = zero.add(100000.0);
FieldAbsoluteDate<T> endDate = new FieldAbsoluteDate<>(initialDate, duration);
// Initialization of the frame EME2000
Frame EME2000 = FramesFactory.getEME2000();
// Initial orbit
double a = 35786000. + 6378137.0;
double e = 0.70;
double rApogee = a * (1 + e);
double vApogee = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
FieldOrbit<T> geo = new FieldCartesianOrbit<>(new FieldPVCoordinates<>(new FieldVector3D<>(zero.add(rApogee), zero, zero), new FieldVector3D<>(zero, zero.add(vApogee), zero)), EME2000, initialDate, mu);
duration = geo.getKeplerianPeriod();
endDate = new FieldAbsoluteDate<>(initialDate, duration);
// Numerical Integration
final double minStep = 0.001;
final double maxStep = 1000;
final double initStep = 60;
final OrbitType type = OrbitType.EQUINOCTIAL;
final double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
final double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, minStep, maxStep, absTolerance, relTolerance);
integrator.setInitialStepSize(zero.add(initStep));
// Numerical propagator based on the integrator
FieldNumericalPropagator<T> propagator = new FieldNumericalPropagator<>(field, integrator);
propagator.setOrbitType(type);
T mass = field.getZero().add(1000.0);
FieldSpacecraftState<T> initialState = new FieldSpacecraftState<>(geo, mass);
propagator.setInitialState(initialState);
propagator.setOrbitType(OrbitType.CARTESIAN);
// Set the events Detectors
FieldApsideDetector<T> event1 = new FieldApsideDetector<>(geo);
propagator.addEventDetector(event1);
// Set the propagation mode
propagator.setSlaveMode();
// Propagate
FieldSpacecraftState<T> finalState = propagator.propagate(endDate);
// we should stop long before endDate
Assert.assertTrue(endDate.durationFrom(finalState.getDate()).getReal() > 40000.0);
}
Aggregations