Search in sources :

Example 1 with ContinueOnEvent

use of org.orekit.propagation.events.handlers.ContinueOnEvent in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method stopAtTargetDate.

@Test
public void stopAtTargetDate() 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);
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    propagator.addEventDetector(new NodeDetector(orbit, itrf).withHandler(new ContinueOnEvent<NodeDetector>()));
    AbsoluteDate farTarget = orbit.getDate().shiftedBy(10000.0);
    SpacecraftState propagated = propagator.propagate(farTarget);
    Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate())), 1.0e-3);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) NodeDetector(org.orekit.propagation.events.NodeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 2 with ContinueOnEvent

use of org.orekit.propagation.events.handlers.ContinueOnEvent in project Orekit by CS-SI.

the class DateDetectorTest method testAutoEmbeddedTimer.

@Test
public void testAutoEmbeddedTimer() throws OrekitException {
    dateDetector = new DateDetector(maxCheck, threshold, iniDate.shiftedBy(-dt)).withHandler(new ContinueOnEvent<DateDetector>() {

        private static final long serialVersionUID = 1L;

        public Action eventOccurred(SpacecraftState s, DateDetector dd, boolean increasing) throws OrekitException {
            AbsoluteDate nextDate = s.getDate().shiftedBy(-dt);
            dd.addEventDate(nextDate);
            ++evtno;
            return Action.CONTINUE;
        }
    });
    propagator.addEventDetector(dateDetector);
    propagator.propagate(iniDate.shiftedBy(-100. * dt));
    Assert.assertEquals(100, evtno);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 3 with ContinueOnEvent

use of org.orekit.propagation.events.handlers.ContinueOnEvent in project Orekit by CS-SI.

the class DateDetectorTest method testExceptionTimer.

@Test(expected = IllegalArgumentException.class)
public void testExceptionTimer() throws OrekitException {
    dateDetector = new DateDetector(maxCheck, threshold, iniDate.shiftedBy(dt)).withHandler(new ContinueOnEvent<DateDetector>() {

        private static final long serialVersionUID = 1L;

        public Action eventOccurred(SpacecraftState s, DateDetector dd, boolean increasing) throws OrekitException {
            double step = (evtno % 2 == 0) ? 2. * maxCheck : maxCheck / 2.;
            AbsoluteDate nextDate = s.getDate().shiftedBy(step);
            dd.addEventDate(nextDate);
            ++evtno;
            return Action.CONTINUE;
        }
    });
    propagator.addEventDetector(dateDetector);
    propagator.propagate(iniDate.shiftedBy(100. * dt));
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 4 with ContinueOnEvent

use of org.orekit.propagation.events.handlers.ContinueOnEvent in project Orekit by CS-SI.

the class EventDetectorTest method testNoisyGFunction.

@Test
public void testNoisyGFunction() throws OrekitException {
    // initial conditions
    Frame eme2000 = FramesFactory.getEME2000();
    TimeScale utc = TimeScalesFactory.getUTC();
    AbsoluteDate initialDate = new AbsoluteDate(2011, 5, 11, utc);
    AbsoluteDate startDate = new AbsoluteDate(2032, 10, 17, utc);
    AbsoluteDate interruptDate = new AbsoluteDate(2032, 10, 18, utc);
    AbsoluteDate targetDate = new AbsoluteDate(2211, 5, 11, utc);
    KeplerianPropagator k1 = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008462.4706055815, -3155502.5373837613, -5044275.9880020910), new Vector3D(-5012.9298276860990, 1920.3567095973078, -5172.7403501801580)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
    KeplerianPropagator k2 = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008912.4039522274, -3155453.3125615157, -5044297.6484738905), new Vector3D(-5012.5883854112530, 1920.6332221785074, -5172.2177085540500)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
    k2.addEventDetector(new CloseApproachDetector(2015.243454166727, 0.0001, 100, new ContinueOnEvent<CloseApproachDetector>(), k1));
    k2.addEventDetector(new DateDetector(Constants.JULIAN_DAY, 1.0e-6, interruptDate));
    SpacecraftState s = k2.propagate(startDate, targetDate);
    Assert.assertEquals(0.0, interruptDate.durationFrom(s.getDate()), 1.1e-6);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 5 with ContinueOnEvent

use of org.orekit.propagation.events.handlers.ContinueOnEvent in project Orekit by CS-SI.

the class KeplerianPropagatorTest method stopAtTargetDate.

@Test
public void stopAtTargetDate() 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);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    propagator.addEventDetector(new NodeDetector(orbit, itrf).withHandler(new ContinueOnEvent<NodeDetector>()));
    AbsoluteDate farTarget = orbit.getDate().shiftedBy(10000.0);
    SpacecraftState propagated = propagator.propagate(farTarget);
    Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate())), 1.0e-3);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) NodeDetector(org.orekit.propagation.events.NodeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 SpacecraftState (org.orekit.propagation.SpacecraftState)5 ContinueOnEvent (org.orekit.propagation.events.handlers.ContinueOnEvent)5 AbsoluteDate (org.orekit.time.AbsoluteDate)5 Frame (org.orekit.frames.Frame)3 TopocentricFrame (org.orekit.frames.TopocentricFrame)2 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)2 NodeDetector (org.orekit.propagation.events.NodeDetector)2 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)1 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)1 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)1 TimeScale (org.orekit.time.TimeScale)1 PVCoordinates (org.orekit.utils.PVCoordinates)1