Search in sources :

Example 41 with KeplerianPropagator

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

the class AltitudeDetectorTest method testBackAndForth.

@Test
public void testBackAndForth() throws OrekitException {
    final Frame EME2000 = FramesFactory.getEME2000();
    final AbsoluteDate initialDate = new AbsoluteDate(2009, 1, 1, TimeScalesFactory.getUTC());
    final double a = 8000000;
    final double e = 0.1;
    final double earthRadius = 6378137.0;
    final double earthF = 1.0 / 298.257223563;
    final double apogee = a * (1 + e);
    final double alt = apogee - earthRadius - 500;
    // initial state is at apogee
    final Orbit initialOrbit = new KeplerianOrbit(a, e, 0, 0, 0, FastMath.PI, PositionAngle.MEAN, EME2000, initialDate, CelestialBodyFactory.getEarth().getGM());
    final SpacecraftState initialState = new SpacecraftState(initialOrbit);
    final KeplerianPropagator kepPropagator = new KeplerianPropagator(initialOrbit);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(earthRadius, earthF, EME2000);
    final AltitudeDetector altDetector = new AltitudeDetector(alt, earth).withHandler(new StopOnEvent<AltitudeDetector>());
    Assert.assertEquals(alt, altDetector.getAltitude(), 1.0e-15);
    Assert.assertSame(earth, altDetector.getBodyShape());
    // altitudeDetector should stop propagation upon reaching required altitude
    kepPropagator.addEventDetector(altDetector);
    // propagation to the future
    SpacecraftState finalState = kepPropagator.propagate(initialDate.shiftedBy(1000));
    Assert.assertEquals(finalState.getPVCoordinates().getPosition().getNorm() - earthRadius, alt, 1e-5);
    Assert.assertEquals(44.079, finalState.getDate().durationFrom(initialDate), 1.0e-3);
    // propagation to the past
    kepPropagator.resetInitialState(initialState);
    finalState = kepPropagator.propagate(initialDate.shiftedBy(-1000));
    Assert.assertEquals(finalState.getPVCoordinates().getPosition().getNorm() - earthRadius, alt, 1e-5);
    Assert.assertEquals(-44.079, finalState.getDate().durationFrom(initialDate), 1.0e-3);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 42 with KeplerianPropagator

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

the class AngularSeparationDetectorTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
        acatenango = new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(14.500833), FastMath.toRadians(-90.87583), 3976.0), "Acatenango");
        iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
        initialOrbit = new KeplerianOrbit(7e6, 1.0e-4, FastMath.toRadians(98.5), FastMath.toRadians(87.0), FastMath.toRadians(216.59976025619), FastMath.toRadians(319.7), PositionAngle.MEAN, FramesFactory.getEME2000(), iniDate, Constants.EIGEN5C_EARTH_MU);
        propagator = new KeplerianPropagator(initialOrbit);
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) TopocentricFrame(org.orekit.frames.TopocentricFrame) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 43 with KeplerianPropagator

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

the class OrekitStepHandlerTest method testForwardBackwardStep.

@Test
public void testForwardBackwardStep() throws OrekitException, InterruptedException, ExecutionException {
    final AbsoluteDate initialDate = new AbsoluteDate(2014, 01, 01, 00, 00, 00.000, TimeScalesFactory.getUTC());
    final double mu = CelestialBodyFactory.getEarth().getGM();
    FactoryManagedFrame inertialFrame = FramesFactory.getEME2000();
    // seconds
    final double propagationTime = 7200.0;
    // seconds
    final double fixedStepSize = 3600;
    // meters
    final double semimajorAxis = 8000e3;
    // unitless
    final double eccentricity = 0.001;
    final double inclination = FastMath.toRadians(15.0);
    final double argPerigee = FastMath.toRadians(10.0);
    final double raan = FastMath.toRadians(45.0);
    final double trueAnomaly = FastMath.toRadians(10.0);
    KeplerianOrbit initialOrbit = new KeplerianOrbit(semimajorAxis, eccentricity, inclination, argPerigee, raan, trueAnomaly, PositionAngle.TRUE, inertialFrame, initialDate, mu);
    final Propagator kepler = new KeplerianPropagator(initialOrbit);
    kepler.setMasterMode(fixedStepSize, new OrekitFixedStepHandler() {

        @Override
        public void handleStep(SpacecraftState currentState, boolean isLast) {
        }
    });
    kepler.propagate(initialDate.shiftedBy(propagationTime));
    final double stepSizeInSeconds = 120;
    final long longestWaitTimeMS = 20;
    ExecutorService service = Executors.newSingleThreadExecutor();
    for (double elapsedTime = 0; elapsedTime <= propagationTime; elapsedTime += stepSizeInSeconds) {
        final double dt = elapsedTime;
        Future<SpacecraftState> stateFuture = service.submit(new Callable<SpacecraftState>() {

            public SpacecraftState call() throws OrekitException {
                return kepler.propagate(initialDate.shiftedBy(dt));
            }
        });
        Thread.sleep(longestWaitTimeMS);
        assertTrue(stateFuture.isDone());
        SpacecraftState finalState = stateFuture.get();
        assertNotNull(finalState);
    }
}
Also used : FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ExecutorService(java.util.concurrent.ExecutorService) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 44 with KeplerianPropagator

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

the class LongitudeCrossingDetectorTest method testZigZag.

@Test
public void testZigZag() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LongitudeCrossingDetector d = new LongitudeCrossingDetector(600.0, 1.e-6, earth, FastMath.toRadians(-100.0)).withHandler(new ContinueOnEvent<LongitudeCrossingDetector>());
    Assert.assertEquals(600.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(-100.0, FastMath.toDegrees(d.getLongitude()), 1.0e-14);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    KeplerianOrbit orbit = new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681, 0.048363, PositionAngle.MEAN, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new KeplerianPropagator(orbit);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(orbit.getDate().shiftedBy(Constants.JULIAN_DAY));
    double[] expectedLatitudes = new double[] { -6.5394381901, -0.4918760372, +6.5916016832 };
    Assert.assertEquals(3, logger.getLoggedEvents().size());
    for (int i = 0; i < 3; ++i) {
        SpacecraftState state = logger.getLoggedEvents().get(i).getState();
        GeodeticPoint gp = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null);
        Assert.assertEquals(expectedLatitudes[i], FastMath.toDegrees(gp.getLatitude()), 1.0e-10);
        Assert.assertEquals(-100.0, FastMath.toDegrees(gp.getLongitude()), 1.2e-9);
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 45 with KeplerianPropagator

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

the class LongitudeExtremumDetectorTest method testZigZag.

@Test
public void testZigZag() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LongitudeExtremumDetector d = new LongitudeExtremumDetector(600.0, 1.e-6, earth).withHandler(new ContinueOnEvent<LongitudeExtremumDetector>());
    Assert.assertEquals(600.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    KeplerianOrbit orbit = new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681, 0.048363, PositionAngle.MEAN, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new KeplerianPropagator(orbit);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(orbit.getDate().shiftedBy(Constants.JULIAN_DAY));
    double[] expectedLongitudes = new double[] { 74.85115958654778, 39.51032449280883, -84.25729072475329, -119.598124966418, 116.63425894645886 };
    double[] expectedLatitudes = new double[] { -3.8404256460679336, 3.4237236065561536, -3.840419828222964, 3.4237214483413734, -3.840413360572555 };
    Assert.assertEquals(5, logger.getLoggedEvents().size());
    for (int i = 0; i < 5; ++i) {
        SpacecraftState state = logger.getLoggedEvents().get(i).getState();
        GeodeticPoint gp = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null);
        Assert.assertEquals(expectedLongitudes[i], FastMath.toDegrees(gp.getLongitude()), 1.0e-10);
        Assert.assertEquals(expectedLatitudes[i], FastMath.toDegrees(gp.getLatitude()), 1.0e-10);
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Aggregations

KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)59 Test (org.junit.Test)47 SpacecraftState (org.orekit.propagation.SpacecraftState)41 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)40 AbsoluteDate (org.orekit.time.AbsoluteDate)36 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)34 Propagator (org.orekit.propagation.Propagator)32 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)21 GeodeticPoint (org.orekit.bodies.GeodeticPoint)20 Orbit (org.orekit.orbits.Orbit)20 PVCoordinates (org.orekit.utils.PVCoordinates)15 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)14 OrekitException (org.orekit.errors.OrekitException)13 Frame (org.orekit.frames.Frame)13 TopocentricFrame (org.orekit.frames.TopocentricFrame)12 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)11 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 CartesianOrbit (org.orekit.orbits.CartesianOrbit)8 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)8 DateComponents (org.orekit.time.DateComponents)7