Search in sources :

Example 1 with ApsideDetector

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);
}
Also used : Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) ApsideDetector(org.orekit.propagation.events.ApsideDetector) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) Test(org.junit.Test)

Example 2 with ApsideDetector

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) ApsideDetector(org.orekit.propagation.events.ApsideDetector) Test(org.junit.Test)

Example 3 with ApsideDetector

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) ApsideDetector(org.orekit.propagation.events.ApsideDetector) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)3 SpacecraftState (org.orekit.propagation.SpacecraftState)3 ApsideDetector (org.orekit.propagation.events.ApsideDetector)3 AbsoluteDate (org.orekit.time.AbsoluteDate)3 PVCoordinates (org.orekit.utils.PVCoordinates)3 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)3 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)2 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)1 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)1 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)1 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)1 Frame (org.orekit.frames.Frame)1 CartesianOrbit (org.orekit.orbits.CartesianOrbit)1 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)1 Orbit (org.orekit.orbits.Orbit)1 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)1 TimeScale (org.orekit.time.TimeScale)1