Search in sources :

Example 1 with StopOnEvent

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

the class PropagatorsParallelizerTest method testStopOnLateEvent.

@Test
public void testStopOnLateEvent() throws OrekitException {
    final AbsoluteDate startDate = orbit.getDate();
    final AbsoluteDate endDate = startDate.shiftedBy(3600.0);
    final AbsoluteDate stopDate = startDate.shiftedBy(900.0);
    List<Propagator> propagators = Arrays.asList(buildEcksteinHechler(), buildNumerical());
    propagators.get(0).addEventDetector(new DateDetector(stopDate).withHandler(new StopOnEvent<>()));
    List<SpacecraftState> results = new PropagatorsParallelizer(propagators, (interpolators, isLast) -> {
    }).propagate(startDate, endDate);
    Assert.assertEquals(2, results.size());
    Assert.assertEquals(0.0, results.get(0).getDate().durationFrom(stopDate), 1.0e-15);
    Assert.assertEquals(0.0, results.get(1).getDate().durationFrom(stopDate), 1.0e-15);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) Arrays(java.util.Arrays) ForceModel(org.orekit.forces.ForceModel) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) IERSConventions(org.orekit.utils.IERSConventions) Orbit(org.orekit.orbits.Orbit) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) BodyCenterPointing(org.orekit.attitudes.BodyCenterPointing) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) After(org.junit.After) StopOnEvent(org.orekit.propagation.events.handlers.StopOnEvent) OrbitType(org.orekit.orbits.OrbitType) PositionAngle(org.orekit.orbits.PositionAngle) DateDetector(org.orekit.propagation.events.DateDetector) FastMath(org.hipparchus.util.FastMath) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DateComponents(org.orekit.time.DateComponents) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FramesFactory(org.orekit.frames.FramesFactory) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test) GravityFieldFactory(org.orekit.forces.gravity.potential.GravityFieldFactory) OrekitMessages(org.orekit.errors.OrekitMessages) List(java.util.List) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) LocalizedCoreFormats(org.hipparchus.exception.LocalizedCoreFormats) TimeComponents(org.orekit.time.TimeComponents) Assert(org.junit.Assert) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) StopOnEvent(org.orekit.propagation.events.handlers.StopOnEvent) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 2 with StopOnEvent

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

the class PropagatorsParallelizerTest method testStopOnEarlyEvent.

@Test
public void testStopOnEarlyEvent() throws OrekitException {
    final AbsoluteDate startDate = orbit.getDate();
    final AbsoluteDate endDate = startDate.shiftedBy(3600.0);
    final AbsoluteDate stopDate = startDate.shiftedBy(0.01);
    List<Propagator> propagators = Arrays.asList(buildEcksteinHechler(), buildNumerical());
    propagators.get(0).addEventDetector(new DateDetector(stopDate).withHandler(new StopOnEvent<>()));
    List<SpacecraftState> results = new PropagatorsParallelizer(propagators, (interpolators, isLast) -> {
    }).propagate(startDate, endDate);
    Assert.assertEquals(2, results.size());
    Assert.assertEquals(0.0, results.get(0).getDate().durationFrom(stopDate), 1.0e-15);
    Assert.assertEquals(0.0, results.get(1).getDate().durationFrom(stopDate), 1.0e-15);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) Arrays(java.util.Arrays) ForceModel(org.orekit.forces.ForceModel) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) IERSConventions(org.orekit.utils.IERSConventions) Orbit(org.orekit.orbits.Orbit) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) BodyCenterPointing(org.orekit.attitudes.BodyCenterPointing) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) After(org.junit.After) StopOnEvent(org.orekit.propagation.events.handlers.StopOnEvent) OrbitType(org.orekit.orbits.OrbitType) PositionAngle(org.orekit.orbits.PositionAngle) DateDetector(org.orekit.propagation.events.DateDetector) FastMath(org.hipparchus.util.FastMath) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DateComponents(org.orekit.time.DateComponents) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FramesFactory(org.orekit.frames.FramesFactory) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test) GravityFieldFactory(org.orekit.forces.gravity.potential.GravityFieldFactory) OrekitMessages(org.orekit.errors.OrekitMessages) List(java.util.List) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) LocalizedCoreFormats(org.hipparchus.exception.LocalizedCoreFormats) TimeComponents(org.orekit.time.TimeComponents) Assert(org.junit.Assert) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) StopOnEvent(org.orekit.propagation.events.handlers.StopOnEvent) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Arrays (java.util.Arrays)2 List (java.util.List)2 LocalizedCoreFormats (org.hipparchus.exception.LocalizedCoreFormats)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 ODEIntegrator (org.hipparchus.ode.ODEIntegrator)2 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)2 FastMath (org.hipparchus.util.FastMath)2 After (org.junit.After)2 Assert (org.junit.Assert)2 Before (org.junit.Before)2 Test (org.junit.Test)2 Utils (org.orekit.Utils)2 AttitudeProvider (org.orekit.attitudes.AttitudeProvider)2 BodyCenterPointing (org.orekit.attitudes.BodyCenterPointing)2 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)2 OrekitException (org.orekit.errors.OrekitException)2 OrekitMessages (org.orekit.errors.OrekitMessages)2 ForceModel (org.orekit.forces.ForceModel)2 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)2 GravityFieldFactory (org.orekit.forces.gravity.potential.GravityFieldFactory)2