Search in sources :

Example 21 with EcksteinHechlerPropagator

use of org.orekit.propagation.analytical.EcksteinHechlerPropagator in project Orekit by CS-SI.

the class LatitudeCrossingDetectorTest method testNoCrossing.

@Test
public void testNoCrossing() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LatitudeCrossingDetector d = new LatitudeCrossingDetector(10.0, 1.e-6, earth, FastMath.toRadians(82.0)).withHandler(new ContinueOnEvent<LatitudeCrossingDetector>());
    Assert.assertEquals(10.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(82.0, FastMath.toDegrees(d.getLatitude()), 1.0e-14);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    Assert.assertEquals(0, logger.getLoggedEvents().size());
}
Also used : EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 22 with EcksteinHechlerPropagator

use of org.orekit.propagation.analytical.EcksteinHechlerPropagator in project Orekit by CS-SI.

the class LatitudeCrossingDetectorTest method testRegularCrossing.

@Test
public void testRegularCrossing() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LatitudeCrossingDetector d = new LatitudeCrossingDetector(60.0, 1.e-6, earth, FastMath.toRadians(60.0)).withHandler(new ContinueOnEvent<LatitudeCrossingDetector>());
    Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(60.0, FastMath.toDegrees(d.getLatitude()), 1.0e-14);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    AbsoluteDate previous = null;
    for (LoggedEvent e : logger.getLoggedEvents()) {
        SpacecraftState state = e.getState();
        double latitude = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null).getLatitude();
        Assert.assertEquals(60.0, FastMath.toDegrees(latitude), 3.0e-10);
        if (previous != null) {
            if (e.isIncreasing()) {
                // crossing northward
                Assert.assertTrue(state.getPVCoordinates().getVelocity().getZ() > 3611.0);
                Assert.assertEquals(4954.70, state.getDate().durationFrom(previous), 0.01);
            } else {
                // crossing southward
                Assert.assertTrue(state.getPVCoordinates().getVelocity().getZ() < -3615.0);
                Assert.assertEquals(956.17, state.getDate().durationFrom(previous), 0.01);
            }
        }
        previous = state.getDate();
    }
    Assert.assertEquals(30, logger.getLoggedEvents().size());
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Test(org.junit.Test)

Example 23 with EcksteinHechlerPropagator

use of org.orekit.propagation.analytical.EcksteinHechlerPropagator in project Orekit by CS-SI.

the class ElevationExtremumDetectorTest method testLEO.

@Test
public void testLEO() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
    final ElevationExtremumDetector raw = new ElevationExtremumDetector(new TopocentricFrame(earth, gp, "test")).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<ElevationExtremumDetector>());
    final EventSlopeFilter<ElevationExtremumDetector> maxElevationDetector = new EventSlopeFilter<ElevationExtremumDetector>(raw, FilterType.TRIGGER_ONLY_DECREASING_EVENTS);
    Assert.assertEquals(60.0, raw.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, raw.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, raw.getMaxIterationCount());
    Assert.assertEquals("test", raw.getTopocentricFrame().getName());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(maxElevationDetector));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    int visibleEvents = 0;
    for (LoggedEvent e : logger.getLoggedEvents()) {
        final double eMinus = raw.getElevation(e.getState().shiftedBy(-10.0));
        final double e0 = raw.getElevation(e.getState());
        final double ePlus = raw.getElevation(e.getState().shiftedBy(+10.0));
        if (e0 > FastMath.toRadians(5.0)) {
            ++visibleEvents;
        }
        Assert.assertTrue(e0 > eMinus);
        Assert.assertTrue(e0 > ePlus);
    }
    Assert.assertEquals(15, logger.getLoggedEvents().size());
    Assert.assertEquals(6, visibleEvents);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 24 with EcksteinHechlerPropagator

use of org.orekit.propagation.analytical.EcksteinHechlerPropagator in project Orekit by CS-SI.

the class EventEnablingPredicateFilterTest method doElevationTest.

private void doElevationTest(final double minElevation, final AbsoluteDate start, final AbsoluteDate end, final int expectedEvents, final boolean sameSign) throws OrekitException {
    final ElevationExtremumDetector raw = new ElevationExtremumDetector(0.001, 1.e-6, new TopocentricFrame(earth, gp, "test")).withHandler(new ContinueOnEvent<ElevationExtremumDetector>());
    final EventEnablingPredicateFilter<ElevationExtremumDetector> aboveGroundElevationDetector = new EventEnablingPredicateFilter<ElevationExtremumDetector>(raw, new EnablingPredicate<ElevationExtremumDetector>() {

        public boolean eventIsEnabled(final SpacecraftState state, final ElevationExtremumDetector eventDetector, final double g) throws OrekitException {
            return eventDetector.getElevation(state) > minElevation;
        }
    }).withMaxCheck(60.0);
    Assert.assertEquals(0.001, raw.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(60.0, aboveGroundElevationDetector.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, aboveGroundElevationDetector.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, aboveGroundElevationDetector.getMaxIterationCount());
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(aboveGroundElevationDetector));
    propagator.propagate(start, end);
    for (LoggedEvent e : logger.getLoggedEvents()) {
        final double eMinus = raw.getElevation(e.getState().shiftedBy(-10.0));
        final double e0 = raw.getElevation(e.getState());
        final double ePlus = raw.getElevation(e.getState().shiftedBy(+10.0));
        Assert.assertTrue(e0 > eMinus);
        Assert.assertTrue(e0 > ePlus);
        Assert.assertTrue(e0 > minElevation);
    }
    Assert.assertEquals(expectedEvents, logger.getLoggedEvents().size());
    propagator.clearEventsDetectors();
    double g1Raw = raw.g(propagator.propagate(orbit.getDate().shiftedBy(18540.0)));
    double g2Raw = raw.g(propagator.propagate(orbit.getDate().shiftedBy(18624.0)));
    double g1 = aboveGroundElevationDetector.g(propagator.propagate(orbit.getDate().shiftedBy(18540.0)));
    double g2 = aboveGroundElevationDetector.g(propagator.propagate(orbit.getDate().shiftedBy(18624.0)));
    Assert.assertTrue(g1Raw > 0);
    Assert.assertTrue(g2Raw < 0);
    if (sameSign) {
        Assert.assertTrue(g1 > 0);
        Assert.assertTrue(g2 < 0);
    } else {
        Assert.assertTrue(g1 < 0);
        Assert.assertTrue(g2 > 0);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) TopocentricFrame(org.orekit.frames.TopocentricFrame)

Example 25 with EcksteinHechlerPropagator

use of org.orekit.propagation.analytical.EcksteinHechlerPropagator in project Orekit by CS-SI.

the class EcksteinHechlerConverterTest method checkFit.

protected void checkFit(final Orbit orbit, final double duration, final double stepSize, final double threshold, final boolean positionOnly, final double expectedRMS) throws OrekitException {
    // shift position by 3m
    CircularOrbit modified = new CircularOrbit(new TimeStampedPVCoordinates(orbit.getDate(), new Vector3D(1, orbit.getPVCoordinates().getPosition(), 3.0, Vector3D.PLUS_J), orbit.getPVCoordinates().getVelocity()), orbit.getFrame(), orbit.getMu());
    Propagator p = new EcksteinHechlerPropagator(modified, provider);
    List<SpacecraftState> sample = new ArrayList<SpacecraftState>();
    for (double dt = 0; dt < duration; dt += stepSize) {
        sample.add(p.propagate(modified.getDate().shiftedBy(dt)));
    }
    UnnormalizedSphericalHarmonics harmonics = provider.onDate(orbit.getDate());
    PropagatorBuilder builder = new EcksteinHechlerPropagatorBuilder(orbit, provider.getAe(), provider.getMu(), provider.getTideSystem(), harmonics.getUnnormalizedCnm(2, 0), harmonics.getUnnormalizedCnm(3, 0), harmonics.getUnnormalizedCnm(4, 0), harmonics.getUnnormalizedCnm(5, 0), harmonics.getUnnormalizedCnm(6, 0), OrbitType.CIRCULAR, PositionAngle.TRUE, 1.0);
    FiniteDifferencePropagatorConverter fitter = new FiniteDifferencePropagatorConverter(builder, threshold, 1000);
    fitter.convert(sample, positionOnly);
    Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.01 * expectedRMS);
    EcksteinHechlerPropagator prop = (EcksteinHechlerPropagator) fitter.getAdaptedPropagator();
    Orbit fitted = prop.getInitialState().getOrbit();
    final double eps = 1.0e-12;
    Assert.assertEquals(modified.getPVCoordinates().getPosition().getX(), fitted.getPVCoordinates().getPosition().getX(), eps * modified.getPVCoordinates().getPosition().getX());
    Assert.assertEquals(modified.getPVCoordinates().getPosition().getY(), fitted.getPVCoordinates().getPosition().getY(), eps * modified.getPVCoordinates().getPosition().getY());
    Assert.assertEquals(modified.getPVCoordinates().getPosition().getZ(), fitted.getPVCoordinates().getPosition().getZ(), eps * modified.getPVCoordinates().getPosition().getZ());
    Assert.assertEquals(modified.getPVCoordinates().getVelocity().getX(), fitted.getPVCoordinates().getVelocity().getX(), eps * modified.getPVCoordinates().getVelocity().getX());
    Assert.assertEquals(modified.getPVCoordinates().getVelocity().getY(), fitted.getPVCoordinates().getVelocity().getY(), -eps * modified.getPVCoordinates().getVelocity().getY());
    Assert.assertEquals(modified.getPVCoordinates().getVelocity().getZ(), fitted.getPVCoordinates().getVelocity().getZ(), -eps * modified.getPVCoordinates().getVelocity().getZ());
}
Also used : Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) ArrayList(java.util.ArrayList) UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator)

Aggregations

EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)34 AbsoluteDate (org.orekit.time.AbsoluteDate)30 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)27 PVCoordinates (org.orekit.utils.PVCoordinates)25 Orbit (org.orekit.orbits.Orbit)24 Propagator (org.orekit.propagation.Propagator)22 Test (org.junit.Test)17 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)17 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)16 SpacecraftState (org.orekit.propagation.SpacecraftState)16 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)14 TimeScale (org.orekit.time.TimeScale)14 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)9 ArrayList (java.util.ArrayList)8 BodyShape (org.orekit.bodies.BodyShape)8 TopocentricFrame (org.orekit.frames.TopocentricFrame)8 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)8 GeodeticPoint (org.orekit.bodies.GeodeticPoint)7 OrekitException (org.orekit.errors.OrekitException)7 Frame (org.orekit.frames.Frame)7