use of org.orekit.propagation.events.ApsideDetector in project Orekit by CS-SI.
the class NumericalPropagatorTest method testEventDetectionBug.
@Test
public void testEventDetectionBug() throws OrekitException, IOException, ParseException {
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2005, 1, 1, 0, 0, 0.0, utc);
double duration = 100000.;
AbsoluteDate endDate = new AbsoluteDate(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)));
Orbit geo = new CartesianOrbit(new PVCoordinates(new Vector3D(rApogee, 0., 0.), new Vector3D(0., vApogee, 0.)), EME2000, initialDate, mu);
duration = geo.getKeplerianPeriod();
endDate = new AbsoluteDate(initialDate, duration);
// Numerical Integration
final double minStep = 0.001;
final double maxStep = 1000;
final double initStep = 60;
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 };
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, absTolerance, relTolerance);
integrator.setInitialStepSize(initStep);
// Numerical propagator based on the integrator
propagator = new NumericalPropagator(integrator);
double mass = 1000.;
SpacecraftState initialState = new SpacecraftState(geo, mass);
propagator.setInitialState(initialState);
propagator.setOrbitType(OrbitType.CARTESIAN);
// Set the events Detectors
ApsideDetector event1 = new ApsideDetector(geo);
propagator.addEventDetector(event1);
// Set the propagation mode
propagator.setSlaveMode();
// Propagate
SpacecraftState finalState = propagator.propagate(endDate);
// we should stop long before endDate
Assert.assertTrue(endDate.durationFrom(finalState.getDate()) > 40000.0);
}
use of org.orekit.propagation.events.ApsideDetector in project Orekit by CS-SI.
the class KeplerianPropagatorTest method perigee.
@Test
public void perigee() 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);
propagator.addEventDetector(new ApsideDetector(orbit));
AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
SpacecraftState propagated = propagator.propagate(farTarget);
PVCoordinates pv = propagated.getPVCoordinates(FramesFactory.getITRF(IERSConventions.IERS_2010, true));
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) > 3000.0);
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) < 3500.0);
Assert.assertEquals(orbit.getA() * (1.0 - orbit.getE()), pv.getPosition().getNorm(), 1.0e-6);
}
use of org.orekit.propagation.events.ApsideDetector in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method perigee.
@Test
public void perigee() 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, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
propagator.addEventDetector(new ApsideDetector(orbit));
AbsoluteDate farTarget = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
SpacecraftState propagated = propagator.propagate(farTarget);
PVCoordinates pv = propagated.getPVCoordinates(FramesFactory.getITRF(IERSConventions.IERS_2010, true));
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) > 3000.0);
Assert.assertTrue(farTarget.durationFrom(propagated.getDate()) < 3500.0);
Assert.assertEquals(orbit.getA() * (1.0 - orbit.getE()), pv.getPosition().getNorm(), 410);
}
Aggregations