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);
}
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);
}
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));
}
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);
}
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);
}
Aggregations